Outpost logoOutpost Docs

Create an API key for a project

POST
/v1/projects/{projectId}/api-keys

Creates a project-scoped API key. The plaintext key is returned exactly once, in this response — only its hash is stored, so it cannot be retrieved again.

x-api-key<token>

Project-scoped API key. Keys carry either the ADMIN or TENANT role; a route additionally requires that the key's role is listed in its x-required-roles. Machine-to-machine callers should use this.

In: header

Path Parameters

projectId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/api-keys" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "keyId": "string",  "tenantId": "string",  "projectId": "string",  "keySuffix": "string",  "name": "string",  "description": "string",  "isActive": true,  "tenantIsActive": true,  "projectIsActive": true,  "isAdmin": true,  "role": "ADMIN",  "lastUsedAt": 0,  "expiresAt": 0,  "createdAt": 0,  "updatedAt": 0,  "plainApiKey": "string"}