Create an API key

Create a new API key.

Request

POST https://superinterface.ai/api/cloud/api-keys

Authentication

Use one of these authentication methods:
Private API key — creates a public API key in the authenticated workspace
Authorization: Bearer YOUR_PRIVATE_API_KEY
Organization API key — creates a key for any workspace
Authorization: Bearer YOUR_ORGANIZATION_API_KEY

Request Body

ParameterTypeRequiredDescription
namestringNoName of the API key
typeApiKeyTypeYes*PUBLIC or PRIVATE (organization API key only)
workspaceIdstringYes*Workspace to create the key for (organization API key only)
Note: type and workspaceId are required only when using an organization API key.

Example request with private API key

curl -X POST "https://superinterface.ai/api/cloud/api-keys" \ -H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Production website API key" }'

Example request with organization API key

curl -X POST "https://superinterface.ai/api/cloud/api-keys" \ -H "Authorization: Bearer YOUR_ORGANIZATION_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Staging key", "type": "PUBLIC", "workspaceId": "60cfe680-fee5-49b9-b386-6a7097eb8497" }'

Response

ParameterTypeDescription
apiKeyAPI keyNew API key

Example response

{ "apiKey": { "id": "40cfe680-fee5-49b9-b386-6a7097eb8497", "type": "PUBLIC", "name": "Production website API key", "value": "77afd9c6-519f-4336-a39e-e739143f0a5c", "createdAt": "2024-01-15T10:30:00Z", "updatedAt": "2024-01-15T10:30:00Z" } }

Errors

The endpoint may return the following errors:

401 Unauthorized

This error occurs if the API key is invalid or missing.
{ "error": "Unauthorized", "message": "Invalid or missing API key" }