> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Create an API key

POST https://api.postman.com/api-keys
Content-Type: application/json

Creates an API key of the given `type`:

- `user-key` — Owned by you. Not allowed if your team admin disabled API key creation.
- `scim-key` — Owned by you, for SCIM provisioning in your team. Requires the permission to manage SCIM keys, the SCIM feature on your team's plan, SCIM enabled for the team, and at least one configured SSO authentication method. Use the `lifetime` property to set how many days the key is valid.
- `service-account-key` — Owned by the service account in the `serviceAccountId` property. Requires the permission to manage service accounts and the service accounts feature. The service account must belong to your team. If the service account is a Super Admin, you must be a Super Admin too.
- `service-account-scim-key` — A SCIM key owned by the service account in the `serviceAccountId` property. Requires everything the `service-account-key` type requires, plus the permission to manage SCIM keys. The service account must also hold that permission, and the SCIM requirements for `scim-key` apply. The key is valid for 180 days.

Keys are created with the default API key scopes. On success, this returns an HTTP `201 Created` response that includes the key's full value. This is the only time the API returns the full value, so store it securely. An owner can have at most 30 API keys.


Reference: https://learning.postman.com/api-docs/api-reference/api-keys/create-api-key

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Body (application/json)

This endpoint expects a createApiKeyRequest.

- `createApiKeyRequest`
  - Create User API Key Request: createUserApiKeyRequest
  - Create SCIM API Key Request: createScimApiKeyRequest
  - Create Service Account API Key Request: createServiceAccountApiKeyRequest
  - Create Service Account SCIM API Key Request: createServiceAccountScimApiKeyRequest

## Response

### 201

Created. The response includes the API key's full value, which you cannot retrieve again.

- `id` (string, required) — The API key's ID.
- `name` (string, required) — The API key's name.
- `type` (enum, required) — The API key's type.
  - Allowed values: `user-key`, `scim-key`, `service-account-key`, `service-account-scim-key`
- `version` (enum, required) — The API key's version. Both SCIM key types use `scim`.
  - Allowed values: `v1`, `v2`, `scim`
- `owner` (apiKeyUser, required) — A user. By default, only the `id` property is returned. If you set `populateUsers` to `true`, the `name`, `username`, `email`, and `profilePic` properties are also returned. These properties are `null` if the user cannot be found.
- `createdBy` (apiKeyUser, required, nullable) — The user who created the key. For `user-key` and `scim-key` keys, this is the same as `owner`. For the service account key types, this is the admin who created the key. This value is `null` if the system did not record who created it.
- `enabled` (boolean, required) — If true, the key is enabled.
- `revoked` (boolean, required) — If true, the key is revoked. The API returns an expired key as revoked.
- `revocation` (ApiKeyRevocation, required, nullable) — Why the key was revoked. This value is `null` unless `revoked` is `true`.
- `createdAt` (datetime, required) — The date and time at which the key was created.
- `accessedAt` (datetime, required, nullable) — The date and time at which the key was last used. This value is `null` if the key has never been used.
- `expiresAt` (datetime, required, nullable) — The date and time after which the key expires. This value is `null` if the key does not expire.
- `key` (string, required) — The full API key. The API only returns this value in the create and rotate responses. You cannot retrieve it again.

## Errors

### 400 Bad Request Error

Bad Request. The request is invalid, API key creation is disabled for the team, the API key limit is reached, or the requested key type is unavailable.

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 401 Unauthorized Error

Unauthorized

- `CreateApiKeyRequestUnauthorizedError`
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

### 403 Forbidden Error

Forbidden. You do not have permission to create this API key.

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 429 Too Many Requests Error

Too Many Requests. You exceeded your request limit, or another key is being created for the same owner.

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

### 500 Internal Server Error

Internal Server Error

- `CreateApiKeyRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

### 503 Service Unavailable Error

Service Unavailable. API keys are temporarily unavailable.

- `type` (string, optional) — The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that identifies the type of problem.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — An explanation about the problem.
- `status` (integer, optional) — The HTTP status code generated by the origin server.
- `instance` (string, optional) — The URI reference that identifies the specific occurrence of the problem.

## Types

### createUserApiKeyRequest

- `type` (enum, required) — The API key's type.
  - Allowed values: `user-key`
- `name` (string, required) — The API key's name. The name must be 3 to 50 characters long, start with an alphanumeric character, and contain at least one letter. It cannot contain special characters other than underscores and hyphens.

### createScimApiKeyRequest

- `type` (enum, required) — The API key's type.
  - Allowed values: `scim-key`
- `name` (string, required) — The API key's name. The name must be 3 to 50 characters long, start with an alphanumeric character, and contain at least one letter. It cannot contain special characters other than underscores and hyphens.
- `lifetime` (enum, optional, default: 180) — The number of days the key is valid for.
  - Allowed values: `30`, `60`, `180`

### createServiceAccountApiKeyRequest

- `type` (enum, required) — The API key's type.
  - Allowed values: `service-account-key`
- `name` (string, required) — The API key's name. The name must be 3 to 50 characters long, start with an alphanumeric character, and contain at least one letter. It cannot contain special characters other than underscores and hyphens.
- `serviceAccountId` (integer, required) — The ID of the service account that owns the key. The service account must belong to your team.

### createServiceAccountScimApiKeyRequest

- `type` (enum, required) — The API key's type.
  - Allowed values: `service-account-scim-key`
- `name` (string, required) — The API key's name. The name must be 3 to 50 characters long, start with an alphanumeric character, and contain at least one letter. It cannot contain special characters other than underscores and hyphens.
- `serviceAccountId` (integer, required) — The ID of the service account that owns the key. The service account must belong to your team.

### apiKeyUser

A user. By default, only the `id` property is returned. If you set `populateUsers` to `true`, the `name`, `username`, `email`, and `profilePic` properties are also returned. These properties are `null` if the user cannot be found.

- `id` (integer, required) — The user's ID.
- `name` (string, optional, nullable) — The user's name. Only returned if `populateUsers` is `true`.
- `username` (string, optional, nullable) — The user's username. Only returned if `populateUsers` is `true`.
- `email` (string, optional, nullable) — The user's email address. Only returned if `populateUsers` is `true`.
- `profilePic` (string, optional, nullable) — The URL of the user's profile picture. Only returned if `populateUsers` is `true`.

### ApiKeyRevocation

Why the key was revoked. This value is `null` unless `revoked` is `true`.

- `reason` (string, required) — The reason code. For example, `inactivity`, `lifetime_reached`, `security`, or `revoked_by_admin`.
- `message` (string, required) — A readable description of the reason.

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

## Examples

### Created User Key

**Response**

```json
{
  "id": "e5f6a1b2c3d4e5f6a1b2c3d4",
  "name": "CI pipeline key",
  "type": "user-key",
  "version": "v2",
  "owner": {
    "id": 12345678
  },
  "createdBy": {
    "id": 12345678
  },
  "enabled": true,
  "revoked": false,
  "revocation": null,
  "createdAt": "2026-10-08T09:12:44.000Z",
  "accessedAt": null,
  "expiresAt": "2027-01-06T09:12:44.000Z",
  "key": "PMAK-XXXX-XXXX"
}
```

**SDK Code**

```python Created User Key
import requests

url = "https://api.postman.com/api-keys"

headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Created User Key
const url = 'https://api.postman.com/api-keys';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Created User Key
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/api-keys"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Created User Key
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Created User Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/api-keys")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Created User Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/api-keys', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Created User Key
using RestSharp;

var client = new RestClient("https://api.postman.com/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Created User Key
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### User Key

**Request**

```json
{
  "name": "CI pipeline key",
  "type": "user-key"
}
```

**Response**

```json
{
  "id": "e5f6a1b2c3d4e5f6a1b2c3d4",
  "name": "CI pipeline key",
  "type": "user-key",
  "version": "v2",
  "owner": {
    "id": 12345678
  },
  "createdBy": {
    "id": 12345678
  },
  "enabled": true,
  "revoked": false,
  "revocation": null,
  "createdAt": "2026-10-08T09:12:44.000Z",
  "accessedAt": null,
  "expiresAt": "2027-01-06T09:12:44.000Z",
  "key": "PMAK-XXXX-XXXX"
}
```

**SDK Code**

```python User Key
import requests

url = "https://api.postman.com/api-keys"

payload = {
    "name": "CI pipeline key",
    "type": "user-key"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript User Key
const url = 'https://api.postman.com/api-keys';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"CI pipeline key","type":"user-key"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go User Key
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/api-keys"

	payload := strings.NewReader("{\n  \"name\": \"CI pipeline key\",\n  \"type\": \"user-key\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby User Key
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"CI pipeline key\",\n  \"type\": \"user-key\"\n}"

response = http.request(request)
puts response.read_body
```

```java User Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/api-keys")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"CI pipeline key\",\n  \"type\": \"user-key\"\n}")
  .asString();
```

```php User Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/api-keys', [
  'body' => '{
  "name": "CI pipeline key",
  "type": "user-key"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp User Key
using RestSharp;

var client = new RestClient("https://api.postman.com/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"CI pipeline key\",\n  \"type\": \"user-key\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift User Key
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "CI pipeline key",
  "type": "user-key"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### SCIM Key

**Request**

```json
{
  "lifetime": 180,
  "name": "Okta SCIM key",
  "type": "scim-key"
}
```

**Response**

```json
{
  "id": "e5f6a1b2c3d4e5f6a1b2c3d4",
  "name": "CI pipeline key",
  "type": "user-key",
  "version": "v2",
  "owner": {
    "id": 12345678
  },
  "createdBy": {
    "id": 12345678
  },
  "enabled": true,
  "revoked": false,
  "revocation": null,
  "createdAt": "2026-10-08T09:12:44.000Z",
  "accessedAt": null,
  "expiresAt": "2027-01-06T09:12:44.000Z",
  "key": "PMAK-XXXX-XXXX"
}
```

**SDK Code**

```python SCIM Key
import requests

url = "https://api.postman.com/api-keys"

payload = {
    "lifetime": 180,
    "name": "Okta SCIM key",
    "type": "scim-key"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript SCIM Key
const url = 'https://api.postman.com/api-keys';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"lifetime":180,"name":"Okta SCIM key","type":"scim-key"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go SCIM Key
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/api-keys"

	payload := strings.NewReader("{\n  \"lifetime\": 180,\n  \"name\": \"Okta SCIM key\",\n  \"type\": \"scim-key\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby SCIM Key
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lifetime\": 180,\n  \"name\": \"Okta SCIM key\",\n  \"type\": \"scim-key\"\n}"

response = http.request(request)
puts response.read_body
```

```java SCIM Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/api-keys")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"lifetime\": 180,\n  \"name\": \"Okta SCIM key\",\n  \"type\": \"scim-key\"\n}")
  .asString();
```

```php SCIM Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/api-keys', [
  'body' => '{
  "lifetime": 180,
  "name": "Okta SCIM key",
  "type": "scim-key"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp SCIM Key
using RestSharp;

var client = new RestClient("https://api.postman.com/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lifetime\": 180,\n  \"name\": \"Okta SCIM key\",\n  \"type\": \"scim-key\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift SCIM Key
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "lifetime": 180,
  "name": "Okta SCIM key",
  "type": "scim-key"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Service Account Key

**Request**

```json
{
  "name": "Deploy bot key",
  "serviceAccountId": 23456789,
  "type": "service-account-key"
}
```

**Response**

```json
{
  "id": "e5f6a1b2c3d4e5f6a1b2c3d4",
  "name": "CI pipeline key",
  "type": "user-key",
  "version": "v2",
  "owner": {
    "id": 12345678
  },
  "createdBy": {
    "id": 12345678
  },
  "enabled": true,
  "revoked": false,
  "revocation": null,
  "createdAt": "2026-10-08T09:12:44.000Z",
  "accessedAt": null,
  "expiresAt": "2027-01-06T09:12:44.000Z",
  "key": "PMAK-XXXX-XXXX"
}
```

**SDK Code**

```python Service Account Key
import requests

url = "https://api.postman.com/api-keys"

payload = {
    "name": "Deploy bot key",
    "serviceAccountId": 23456789,
    "type": "service-account-key"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Service Account Key
const url = 'https://api.postman.com/api-keys';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Deploy bot key","serviceAccountId":23456789,"type":"service-account-key"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Service Account Key
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/api-keys"

	payload := strings.NewReader("{\n  \"name\": \"Deploy bot key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-key\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Service Account Key
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Deploy bot key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-key\"\n}"

response = http.request(request)
puts response.read_body
```

```java Service Account Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/api-keys")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Deploy bot key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-key\"\n}")
  .asString();
```

```php Service Account Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/api-keys', [
  'body' => '{
  "name": "Deploy bot key",
  "serviceAccountId": 23456789,
  "type": "service-account-key"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Service Account Key
using RestSharp;

var client = new RestClient("https://api.postman.com/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Deploy bot key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-key\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Service Account Key
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Deploy bot key",
  "serviceAccountId": 23456789,
  "type": "service-account-key"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Service Account SCIM Key

**Request**

```json
{
  "name": "Deploy bot SCIM key",
  "serviceAccountId": 23456789,
  "type": "service-account-scim-key"
}
```

**Response**

```json
{
  "id": "e5f6a1b2c3d4e5f6a1b2c3d4",
  "name": "CI pipeline key",
  "type": "user-key",
  "version": "v2",
  "owner": {
    "id": 12345678
  },
  "createdBy": {
    "id": 12345678
  },
  "enabled": true,
  "revoked": false,
  "revocation": null,
  "createdAt": "2026-10-08T09:12:44.000Z",
  "accessedAt": null,
  "expiresAt": "2027-01-06T09:12:44.000Z",
  "key": "PMAK-XXXX-XXXX"
}
```

**SDK Code**

```python Service Account SCIM Key
import requests

url = "https://api.postman.com/api-keys"

payload = {
    "name": "Deploy bot SCIM key",
    "serviceAccountId": 23456789,
    "type": "service-account-scim-key"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Service Account SCIM Key
const url = 'https://api.postman.com/api-keys';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Deploy bot SCIM key","serviceAccountId":23456789,"type":"service-account-scim-key"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Service Account SCIM Key
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/api-keys"

	payload := strings.NewReader("{\n  \"name\": \"Deploy bot SCIM key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-scim-key\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Service Account SCIM Key
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Deploy bot SCIM key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-scim-key\"\n}"

response = http.request(request)
puts response.read_body
```

```java Service Account SCIM Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/api-keys")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Deploy bot SCIM key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-scim-key\"\n}")
  .asString();
```

```php Service Account SCIM Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/api-keys', [
  'body' => '{
  "name": "Deploy bot SCIM key",
  "serviceAccountId": 23456789,
  "type": "service-account-scim-key"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Service Account SCIM Key
using RestSharp;

var client = new RestClient("https://api.postman.com/api-keys");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Deploy bot SCIM key\",\n  \"serviceAccountId\": 23456789,\n  \"type\": \"service-account-scim-key\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Service Account SCIM Key
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Deploy bot SCIM key",
  "serviceAccountId": 23456789,
  "type": "service-account-scim-key"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/api-keys")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```