Skip to main content
POST
https://api.bunship.com
/
api
/
v1
/
organizations
/
{orgId}
/
api-keys
Create API Key
curl --request POST \
  --url https://api.bunship.com/api/v1/organizations/{orgId}/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "scopes": [
    "<string>"
  ],
  "rateLimit": 123,
  "expiresAt": "<string>"
}
'
{
  "success": true,
  "data": {
    "id": "key_abc123",
    "name": "Production API",
    "key": "bsk_live_abc123def456ghi789jkl012mno345pqr678stu901",
    "prefix": "bsk_live_abc1",
    "scopes": ["members:read", "webhooks:read"],
    "rateLimit": 1000,
    "expiresAt": null,
    "createdAt": "2024-01-15T10:00:00Z"
  },
  "message": "API key created successfully. Save it now - you won't be able to see it again!"
}
Creates a new API key for the organization. The full key value is returned only once in this response. Store it securely — it cannot be retrieved again.

Auth

Requires a valid Bearer token. User must be a member of the organization.

Path Parameters

orgId
string
required
Organization identifier.

Request Body

name
string
required
Descriptive name for the API key. Between 1 and 100 characters.
scopes
string[]
Array of permission scopes to restrict what the key can access. If omitted or empty, the key has full access to all organization resources.
rateLimit
number
Maximum requests per minute for this key. Minimum value of 1.
expiresAt
string
ISO 8601 date-time for when the key should expire. If omitted, the key does not expire.

Response

success
boolean
Always true on success.
data
object
message
string
Reminder to save the key.
{
  "success": true,
  "data": {
    "id": "key_abc123",
    "name": "Production API",
    "key": "bsk_live_abc123def456ghi789jkl012mno345pqr678stu901",
    "prefix": "bsk_live_abc1",
    "scopes": ["members:read", "webhooks:read"],
    "rateLimit": 1000,
    "expiresAt": null,
    "createdAt": "2024-01-15T10:00:00Z"
  },
  "message": "API key created successfully. Save it now - you won't be able to see it again!"
}

Example

curl -X POST https://api.bunship.com/api/v1/organizations/org_cld2abc123def456/api-keys \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production API",
    "scopes": ["members:read", "webhooks:read"],
    "rateLimit": 1000
  }'