Skip to main content

MCP Server Keys

Generate an MCP server API key​

POST /mcp-servers/{mcpServerId}/api-keys/generate

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys/generate \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Generates an API key for an MCP server. Mirrors POST /api-portal/api/v0.9/apis/{apiId}/api-keys/generate.

Payload

{
"id": "weather_prod_key",
"expiresAt": "2026-12-31T23:59:59Z"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:create`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyApiKeyRequesttrueAPI key payload. id must be lowercase and may contain numbers, underscores, and hyphens. displayName is an optional human-readable label that defaults to id when omitted. expiresAt can be an ISO-8601 datetime with timezone, epoch seconds, or epoch milliseconds. The parent resource (API or MCP server, depending on the path) is identified by the corresponding path parameter.
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

201 Response

{
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
"expiresAt": "2026-12-31T23:59:59Z",
"status": "ACTIVE"
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "Forbidden"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
201CreatedGenerated API key. The plaintext key is returned exactly once.ApiKeyResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
403ForbiddenRequest is forbidden. The caller lacks the required permission, or the current runtime mode disallows the operation (read-only mode). It is also returned when the request names an organization other than the single one this instance serves. A nonexistent organization is answered identically to one belonging to someone else, so the response cannot be used to discover what a shared database holds.ErrorResponse
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Response Headers​

StatusHeaderTypeFormatDescription
201LocationstringuriURL of the generated API key resource.

List MCP server API keys​

GET /mcp-servers/{mcpServerId}/api-keys

Code samples


curl -X GET https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Lists API keys for the given MCP server. Mirrors GET /api-portal/api/v0.9/apis/{apiId}/api-keys.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:read`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
appIdquerystringfalseOptional application ID used to filter API keys associated with that application.
limitqueryintegerfalseMaximum number of records to return.
offsetqueryintegerfalseNumber of records to skip before returning results.
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

200 Response

{
"list": [
{
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"apiId": "weather-api-v1",
"appId": "my-weather-app",
"appDisplayName": "My Mobile App",
"status": "ACTIVE",
"expiresAt": "2026-12-31T23:59:59Z",
"createdAt": "2019-08-24T14:15:22Z",
"revokedAt": "2019-08-24T14:15:22Z"
}
],
"count": 1,
"pagination": {
"total": 42,
"limit": 20,
"offset": 0
}
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKList of API key metadata records.Inline
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
» list[ApiKeyMetadataResponse]falsenone[API key metadata returned by list operations. Secret material is omitted.]
»» idstringfalsenonenone
»» displayNamestringfalsenonenone
»» apiIdstringfalsenoneAPI ID the key belongs to.
»» appIdstring¦nullfalsenoneID of the application this key is associated with, if any. Analytics attribution only.
»» appDisplayNamestring¦nullfalsenoneDisplay name of the associated application, if any.
»» statusstringfalsenonenone
»» expiresAtstring(date-time)¦nullfalsenonenone
»» createdAtstring(date-time)falsenonenone
»» revokedAtstring(date-time)¦nullfalsenonenone
» countintegerfalsenoneNumber of items returned in this page.
» paginationPaginationfalsenoneStandard pagination metadata returned with collection responses.
»» totalintegertruenoneTotal number of records matching the query.
»» limitintegertruenoneMaximum number of records returned in this response.
»» offsetintegertruenoneNumber of records skipped before this page.

Enumerated Values​

PropertyValue
statusACTIVE
statusREVOKED

Enumerated Values​

PropertyValue
statuserror

Regenerate an MCP server API key​

POST /mcp-servers/{mcpServerId}/api-keys/regenerate

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys/regenerate \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Regenerates the secret for an existing MCP server API key identified by keyId in the request body. Mirrors POST /api-portal/api/v0.9/apis/{apiId}/api-keys/regenerate.

Payload

{
"keyId": "weather_prod_key",
"expiresAt": "2027-01-01T00:00:00Z"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:update`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyobjecttrueIdentifies the API key to regenerate by its keyId. expiresAt is optional and, if provided, updates the key's expiry; the key's id/displayName cannot be changed by this operation.
» keyIdbodystringtrueThe key's handle — the id returned by generate or list.
» expiresAtbodyanyfalseNew expiry for the key. The value can be an ISO-8601 datetime with timezone, epoch seconds, or epoch milliseconds. Omit to leave the current expiry unchanged.
»» anonymousbodystring(date-time)falsenone
»» anonymousbodynumberfalsenone
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

200 Response

{
"id": "weather_prod_key",
"displayName": "Weather Prod Key",
"key": "ak_dGhpcyBpcyBub3QgYSByZWFsIGtleQ",
"expiresAt": "2026-12-31T23:59:59Z",
"status": "ACTIVE"
}

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "Forbidden"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "Cannot regenerate a revoked key"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKGenerated or regenerated API key. The plaintext key is returned exactly once.ApiKeyResponse
403ForbiddenRequest is forbidden. The caller lacks the required permission, or the current runtime mode disallows the operation (read-only mode). It is also returned when the request names an organization other than the single one this instance serves. A nonexistent organization is answered identically to one belonging to someone else, so the response cannot be used to discover what a shared database holds.ErrorResponse
404Not FoundResource not found.ErrorResponse
409ConflictThe key has already been revoked and cannot be regenerated.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Revoke an MCP server API key​

POST /mcp-servers/{mcpServerId}/api-keys/revoke

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys/revoke \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Revokes an existing MCP server API key identified by keyId in the request body. Mirrors POST /api-portal/api/v0.9/apis/{apiId}/api-keys/revoke.

Payload

{
"keyId": "weather_prod_key"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:revoke`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyobjecttrueIdentifies the API key to revoke by its keyId.
» keyIdbodystringtrueThe key's handle — the id returned by generate or list.
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "Forbidden"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "Key already revoked or not found"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
204No ContentAPI key revoked successfully.None
403ForbiddenRequest is forbidden. The caller lacks the required permission, or the current runtime mode disallows the operation (read-only mode). It is also returned when the request names an organization other than the single one this instance serves. A nonexistent organization is answered identically to one belonging to someone else, so the response cannot be used to discover what a shared database holds.ErrorResponse
404Not FoundResource not found.ErrorResponse
409ConflictThe key has already been revoked.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Associate an MCP server API key with an application​

POST /mcp-servers/{mcpServerId}/api-keys/associate

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys/associate \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Associates (or re-associates) an existing MCP server API key with an application, for analytics attribution only. Mirrors POST /api-portal/api/v0.9/apis/{apiId}/api-keys/associate.

Payload

{
"keyId": "weather_prod_key",
"appId": "my-weather-app"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:update`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyobjecttrueIdentifies the API key and the application to associate it with.
» keyIdbodystringtrueThe key's handle — the id returned by generate or list.
» appIdbodystringtrueAPI Portal application ID to associate the key with.
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

200 Response

{
"application": {
"id": "my-weather-app",
"displayName": "My Mobile App"
}
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "Forbidden"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "Cannot associate a revoked key"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKAssociation updated.ApiKeyApplicationResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
403ForbiddenRequest is forbidden. The caller lacks the required permission, or the current runtime mode disallows the operation (read-only mode). It is also returned when the request names an organization other than the single one this instance serves. A nonexistent organization is answered identically to one belonging to someone else, so the response cannot be used to discover what a shared database holds.ErrorResponse
404Not FoundResource not found.ErrorResponse
409ConflictThe key has already been revoked and cannot be associated with an application.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Remove an MCP server API key's application association​

POST /mcp-servers/{mcpServerId}/api-keys/dissociate

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/mcp-servers/{mcpServerId}/api-keys/dissociate \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Removes the application association from an MCP server API key identified by keyId in the request body, if any. Mirrors POST /api-portal/api/v0.9/apis/{apiId}/api-keys/dissociate.

Payload

{
"keyId": "weather_prod_key"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:mcp_server_key:update`, `dp:mcp_server_key:manage`

Parameters​

NameInTypeRequiredDescription
bodybodyobjecttrueIdentifies the API key to remove the application association from.
» keyIdbodystringtrueThe key's handle — the id returned by generate or list.
mcpServerIdpathstringtrueThe MCP server's handle (unique per org).

Example responses

403 Response

{
"status": "error",
"code": "FORBIDDEN",
"message": "Forbidden"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
204No ContentAssociation removed (or none existed).None
403ForbiddenRequest is forbidden. The caller lacks the required permission, or the current runtime mode disallows the operation (read-only mode). It is also returned when the request names an organization other than the single one this instance serves. A nonexistent organization is answered identically to one belonging to someone else, so the response cannot be used to discover what a shared database holds.ErrorResponse
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Was this page helpful?