Management API

Accounts and Authorization

View as Markdown


Create an API key

/auth/teams/{teamId}/api-keys

API keys are used to access the xAI API (https://api.x.ai). They are included on requests as a HTTP Bearer token. API keys are bound to teams and are associated with the user who created them.

Path Parameters

teamIdstring

ID of the team this API key belongs to. The team ID can be copied here: https://console.x.ai/team/default/settings/team.

Request Body

namestring

Human-readable name for the API key. Should not be empty.

Response Body

redactedApiKeystring

A redacted API key. We don't expose the full key after it has been created.

apiKeystring

Only set when the API key is created.

userIdstring

ID of the User who created this API key.

namestring

Human-readable name for the API key.

createTimestring

Timestamp when the API key was created.

modifyTimestring

Timestamp when the API key was modified.

teamIdstring

ID of the team this API key belongs to.

apiKeyIdstring

The ID of the API key.

disabledboolean

If API is disabled (by the user) or not. Users can disable API keys to prevent them from making API calls.

expireTimestring

Expiration time for the API key. If set and in the past, the key is rejected.

qpsinteger

If set, this API key can only perform the stated number of requests per second.

qpminteger

If set, this API key can only perform the stated number of requests per minute.

tpmstring

If set, the API key is limited to producing/consuming the set number of tokens per minute. The limiter engages when the limit is strictly exceeded. In-flight requests that cause the limit to get exceeded will not be aborted.

aclStringsarray<string>

The permissions the API key has. By default, API keys don't have any permissions, which means all requests fail if this field is empty. There are two kind of permissions users can grant: (1) endpoints and (2) models via the `api-key:endpoint:[endpoint name]` and `api-key:model:[model name]` ACLs.

Exampletext

text

{
  "name": "My API key",
  "acls": [
    "api-key:endpoint:*",
    "api-key:model:*"
  ]
}
Exampletext

text

{
  "redactedApiKey": "xai-...oYZ4",
  "apiKey": "xai-2xr2bnFV7lAbcdelZbqSxLd77pjlU6gcFmt3tPLSK3d7z7302htoH6mc4LlKlTY7nJtlU0lRXXQjoYZ4",
  "userId": "6ad994df-7963-45e0-96c8-96b1ba849d9b",
  "name": "My API key",
  "createTime": "2025-11-13T16:14:38.164829Z",
  "modifyTime": "2025-11-13T16:38:07.059039Z",
  "teamId": "c9a0c990-53e6-491e-8df7-b9f18e6983ac",
  "apiKeyId": "fe15b799-32e1-4d02-9e65-80236f9995f7",
  "disabled": false,
  "aclStrings": [
    "api-key:endpoint:*",
    "api-key:model:*"
  ]
}

List API keys

/auth/teams/{teamId}/api-keys

Lists API keys belonging to a user within a team. If the caller user is an admin, returns all team API keys. If the caller user is a member, returns that user's API keys.

Path Parameters

teamIdstring

ID of the team whose API keys shall be listed.

Query Parameters

pageSizeinteger

Control page size for result. It None, result is returned as one page.

paginationTokenstring

Pagination token received from a previous call when using pagination. Set to `undefined` to retrieve the first page.

aclFiltersarray<string>

Optional filter to only return API keys that match the given ACLs.

activeOnlyboolean

If true, only return non-expired API keys. Defaults to false (return all keys).

Response Body

apiKeysarray<object>

API keys belonging to the team.

paginationTokenstring

Include this token on a follow-up request to retrieve the next page. If `undefined`, this is the last page.

Exampletext

text

No parameters.
Exampletext

text

{
  "apiKeys": [
    {
      "redactedApiKey": "xai-a**b",
      "userId": "12106c22-fa54-4255-9887-6eb73c55787f",
      "apiKeyId": "faf5f6c2-5322-4793-9b74-23129addca0c",
      "teamId": "fef05426-f6a4-4242-b9a6-b1a0ea5dc5fd",
      "disabled": "false",
      "tpm": "100000",
      "acl_strings": [
        "api-key:endpoint:*",
        "api-key:model:*"
      ]
    }
  ]
}

Update an API key

/auth/api-keys/{api_key_id}

Selectively updates a subset of fields on an API key.

Path Parameters

api_key_idstring

The ID of the API key.

Request Body

Response Body

redactedApiKeystring

A redacted API key. We don't expose the full key after it has been created.

apiKeystring

Only set when the API key is created.

userIdstring

ID of the User who created this API key.

namestring

Human-readable name for the API key.

createTimestring

Timestamp when the API key was created.

modifyTimestring

Timestamp when the API key was modified.

teamIdstring

ID of the team this API key belongs to.

apiKeyIdstring

The ID of the API key.

disabledboolean

If API is disabled (by the user) or not. Users can disable API keys to prevent them from making API calls.

expireTimestring

Expiration time for the API key. If set and in the past, the key is rejected.

qpsinteger

If set, this API key can only perform the stated number of requests per second.

qpminteger

If set, this API key can only perform the stated number of requests per minute.

tpmstring

If set, the API key is limited to producing/consuming the set number of tokens per minute. The limiter engages when the limit is strictly exceeded. In-flight requests that cause the limit to get exceeded will not be aborted.

aclStringsarray<string>

The permissions the API key has. By default, API keys don't have any permissions, which means all requests fail if this field is empty. There are two kind of permissions users can grant: (1) endpoints and (2) models via the `api-key:endpoint:[endpoint name]` and `api-key:model:[model name]` ACLs.

Exampletext

text

{
  "apiKey": {
    "tpm": "42"
  },
  "fieldMask": "tpm"
}
Exampletext

text

{
  "redactedApiKey": "xai-...oYZ4",
  "apiKey": "xai-2xr2bnFV7lAbcdelZbqSxLd77pjlU6gcFmt3tPLSK3d7z7302htoH6mc4LlKlTY7nJtlU0lRXXQjoYZ4",
  "userId": "6ad994df-7963-45e0-96c8-96b1ba849d9b",
  "name": "My API key",
  "createTime": "2025-11-13T16:14:38.164829Z",
  "modifyTime": "2025-11-13T16:38:07.059039Z",
  "teamId": "c9a0c990-53e6-491e-8df7-b9f18e6983ac",
  "apiKeyId": "fe15b799-32e1-4d02-9e65-80236f9995f7",
  "disabled": false,
  "aclStrings": [
    "api-key:endpoint:*",
    "api-key:model:*"
  ]
}

Rotate an API key

/auth/api-keys/{apiKeyId}/rotate

!!CAUTION!! Rotates the secret of an existing API key, permanently invalidating the old one.

Path Parameters

apiKeyIdstring

ID of the API key whose secret should be rotated.

Request Body

Response Body

redactedApiKeystring

A redacted API key. We don't expose the full key after it has been created.

apiKeystring

Only set when the API key is created.

userIdstring

ID of the User who created this API key.

namestring

Human-readable name for the API key.

createTimestring

Timestamp when the API key was created.

modifyTimestring

Timestamp when the API key was modified.

teamIdstring

ID of the team this API key belongs to.

apiKeyIdstring

The ID of the API key.

disabledboolean

If API is disabled (by the user) or not. Users can disable API keys to prevent them from making API calls.

expireTimestring

Expiration time for the API key. If set and in the past, the key is rejected.

qpsinteger

If set, this API key can only perform the stated number of requests per second.

qpminteger

If set, this API key can only perform the stated number of requests per minute.

tpmstring

If set, the API key is limited to producing/consuming the set number of tokens per minute. The limiter engages when the limit is strictly exceeded. In-flight requests that cause the limit to get exceeded will not be aborted.

aclStringsarray<string>

The permissions the API key has. By default, API keys don't have any permissions, which means all requests fail if this field is empty. There are two kind of permissions users can grant: (1) endpoints and (2) models via the `api-key:endpoint:[endpoint name]` and `api-key:model:[model name]` ACLs.

Exampletext

text

No parameters.
Exampletext

text

{
  "redactedApiKey": "xai-...oYZ4",
  "apiKey": "xai-2xr2bnFV7lAbcdelZbqSxLd77pjlU6gcFmt3tPLSK3d7z7302htoH6mc4LlKlTY7nJtlU0lRXXQjoYZ4",
  "userId": "6ad994df-7963-45e0-96c8-96b1ba849d9b",
  "name": "My API key",
  "createTime": "2025-11-13T16:14:38.164829Z",
  "modifyTime": "2025-11-13T16:38:07.059039Z",
  "teamId": "c9a0c990-53e6-491e-8df7-b9f18e6983ac",
  "apiKeyId": "fe15b799-32e1-4d02-9e65-80236f9995f7",
  "disabled": false,
  "aclStrings": [
    "api-key:endpoint:*",
    "api-key:model:*"
  ]
}

Delete an API key

/auth/api-keys/{apiKeyId}

!!CAUTION!! Permanently and irrevocably deletes an API key.

Path Parameters

apiKeyIdstring

ID of the API key to delete.

Exampletext

text

No parameters.
Exampletext

text

{}

Check API key propagation

/auth/api-keys/{apiKeyId}/propagation

Checks if an API key has successfully been propagated.

Path Parameters

apiKeyIdstring

ID of the API whose propagation status shall be checked.

Response Body

icPropagationobject

Map from the Inference Cluster address to a flag indicating if the API key has propagated.

Exampletext

text

No parameters.
Exampletext

text

{
  "icPropagation": {
    "cloud9.api.x.ai": true,
    "us-east-1.api.x.ai": true
  }
}

List models

/auth/teams/{teamId}/models

Lists all models that are accessible by a team.

Path Parameters

teamIdstring

ID of the team whose models shall be retrieved.

Response Body

clusterConfigsarray<object>

Contains the models accessible via the individual inference clusters.

Exampletext

text

No parameters.
Exampletext

text

{
  "clusterConfigs": [
    {
      "languageModels": [
        {
          "name": "grok-2-vision-1212",
          "version": "1.0",
          "inputModalities": [
            "TEXT",
            "IMAGE"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "20000",
          "promptImageTokenPrice": "20000",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "0",
          "completionTextTokenPrice": "100000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "0",
          "rps": "10",
          "rpm": "600",
          "tpm": "0",
          "cluster": "us-east-1",
          "maxPromptLength": 32768,
          "aliases": [
            "grok-2-vision",
            "grok-2-vision-latest"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": false
          },
          "algorithm": "MultimodalV1"
        },
        {
          "name": "grok-code-fast-1",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "2000",
          "promptImageTokenPrice": "0",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "200",
          "completionTextTokenPrice": "15000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "0",
          "rps": "8",
          "rpm": "480",
          "tpm": "2000000",
          "cluster": "us-east-1",
          "maxPromptLength": 256000,
          "aliases": [
            "grok-code-fast",
            "grok-code-fast-1-0825"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": true
          },
          "algorithm": "grok4Code"
        },
        {
          "name": "grok-2-1212",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "20000",
          "promptImageTokenPrice": "0",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "0",
          "completionTextTokenPrice": "100000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "0",
          "rps": "15",
          "rpm": "900",
          "tpm": "0",
          "cluster": "us-east-1",
          "maxPromptLength": 131072,
          "aliases": [
            "grok-2",
            "grok-2-latest"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": false
          },
          "algorithm": "MultimodalV1"
        },
        {
          "name": "grok-3-mini",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "3000",
          "promptImageTokenPrice": "0",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "750",
          "completionTextTokenPrice": "5000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "2500",
          "rps": "8",
          "rpm": "480",
          "tpm": "0",
          "cluster": "us-east-1",
          "maxPromptLength": 131072,
          "aliases": [
            "grok-3-mini-latest",
            "grok-3-mini-beta",
            "grok-3-mini-fast",
            "grok-3-mini-fast-latest",
            "grok-3-mini-fast-beta"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": true
          },
          "algorithm": "grok3Reasoning"
        },
        {
          "name": "grok-4-0709",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "30000",
          "promptImageTokenPrice": "30000",
          "promptTextTokenPriceLongContext": "60000",
          "cachedPromptTokenPrice": "7500",
          "completionTextTokenPrice": "150000",
          "completionTokenPriceLongContext": "300000",
          "searchPrice": "2500",
          "rps": "8",
          "rpm": "480",
          "tpm": "2000000",
          "cluster": "us-east-1",
          "maxPromptLength": 256000,
          "aliases": [
            "grok-4",
            "grok-4-latest"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": true
          },
          "algorithm": "grok4",
          "longContextThreshold": "128000"
        },
        {
          "name": "grok-3",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "30000",
          "promptImageTokenPrice": "0",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "7500",
          "completionTextTokenPrice": "150000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "2500",
          "rps": "10",
          "rpm": "600",
          "tpm": "0",
          "cluster": "us-east-1",
          "maxPromptLength": 131072,
          "aliases": [
            "grok-3-latest",
            "grok-3-beta",
            "grok-3-fast",
            "grok-3-fast-latest",
            "grok-3-fast-beta"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": false
          },
          "algorithm": "grok3"
        }
      ],
      "embeddingModels": [],
      "imageGenerationModels": [
        {
          "name": "grok-2-image-1212",
          "version": "1.0",
          "inputModalities": [
            "TEXT",
            "IMAGE"
          ],
          "outputModalities": [
            "IMAGE"
          ],
          "imagePrice": "700000000",
          "rps": "5",
          "rpm": "300",
          "tpm": "0",
          "cluster": "us-east-1",
          "aliases": [
            "grok-2-image",
            "grok-2-image-latest"
          ]
        }
      ],
      "audioModels": [],
      "clusterName": "us-east-1"
    },
    {
      "languageModels": [
        {
          "name": "grok-2-1212",
          "version": "1.0",
          "inputModalities": [
            "TEXT"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "20000",
          "promptImageTokenPrice": "0",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "0",
          "completionTextTokenPrice": "100000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "0",
          "rps": "50",
          "tpm": "0",
          "cluster": "eu-west-1",
          "maxPromptLength": 131072,
          "aliases": [
            "grok-2",
            "grok-2-latest"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": false
          },
          "algorithm": "MultimodalV1"
        },
        {
          "name": "grok-2-vision-1212",
          "version": "1.0",
          "inputModalities": [
            "TEXT",
            "IMAGE"
          ],
          "outputModalities": [
            "TEXT"
          ],
          "promptTextTokenPrice": "20000",
          "promptImageTokenPrice": "20000",
          "promptTextTokenPriceLongContext": "0",
          "cachedPromptTokenPrice": "0",
          "completionTextTokenPrice": "100000",
          "completionTokenPriceLongContext": "0",
          "searchPrice": "0",
          "rps": "50",
          "tpm": "0",
          "cluster": "eu-west-1",
          "maxPromptLength": 32768,
          "aliases": [
            "grok-2-vision",
            "grok-2-vision-latest"
          ],
          "features": {
            "functionCalling": true,
            "structuredOutputs": true,
            "reasoning": false
          },
          "algorithm": "MultimodalV1"
        }
      ],
      "embeddingModels": [],
      "imageGenerationModels": [],
      "audioModels": [],
      "clusterName": "eu-west-1"
    }
  ]
}

List possible endpoint ACL values

/auth/teams/{teamId}/endpoints

Lists all the endpoint ACLs that can be used on API keys.

Path Parameters

teamIdstring

ID of the team whose accessible endpoints shall be received.

Response Body

aclsarray<object>

List of ACLs that can be assigned to an API key.

Exampletext

text

No parameters.
Exampletext

text

{
  "acls": [
    {
      "acl": "api-key:endpoint:chat",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "chat"
    },
    {
      "acl": "api-key:endpoint:embed",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "embed"
    },
    {
      "acl": "api-key:endpoint:image",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "image"
    },
    {
      "acl": "api-key:endpoint:models",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "models"
    },
    {
      "acl": "api-key:endpoint:sample",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "sample"
    },
    {
      "acl": "api-key:endpoint:tokenize",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "tokenize"
    },
    {
      "acl": "api-key:endpoint:documents",
      "description": "Grants access to use a specific endpoint with an API Key.",
      "namespace": "api-key",
      "key": "endpoint",
      "value": "documents"
    }
  ]
}

Validate management key

/auth/management-keys/validation

API endpoint for GET requests to /auth/management-keys/validation.

Response Body

apiKeyIdstring

ID of this key.

teamIdstring

[DEPRECATED] Use scope and scope_id instead. ID of the team on whose behalf the key can act.

scope"SCOPE_UNSPECIFIED" | "SCOPE_TEAM" | "SCOPE_ORGANIZATION"

Scope the key is associated with.

scopeIdstring

ID of the scope the key is associated with.

ownerUserIdstring

ID of the user who owns this key.

createTimestring

Time when the key was created.

modifyTimestring

Time when the key was last modified.

namestring

Name of this key (Just for humans).

aclsarray<string>

ACLs of this key (controls what APIs can be accessed using the key).

apiKeystring

Only set when the key is created.

redactedApiKeystring

A shorted version of the actual key.

ipRangesobject

Exampletext

text

No parameters.
Exampletext

text

{
  "apiKeyId": "b86ba29d-9f47-4b3a-a6ae-e69432d5f0dc",
  "teamId": "65c1e471-205f-4566-9c5a-07198badf4ce",
  "scope": "SCOPE_TEAM",
  "scopeId": "65c1e471-205f-4566-9c5a-07198badf4ce",
  "ownerUserId": "4d52c406-6ec6-4361-9b7c-40dc7e8ff284",
  "createTime": "2025-12-10T23:17:49.460374Z",
  "modifyTime": "2025-12-10T23:17:49.460374Z",
  "name": "test key",
  "acls": [
    "team-token:endpoint:ListApiKeys",
    "team-token:endpoint:CheckApiKeyPropagation",
    "team-token:endpoint:ListPossibleEndpointAcls"
  ],
  "reactedApiKey": "xai-...r42q",
  "ipRanges": null
}

Last updated:February 13, 2026