API · 2.0.0
Keys
API keys minted for use from SDKs and external MCP clients.
2 operations. All requests need Authorization: Bearer sk_.... Responses use the standard envelope; see overview for shapes and error codes.
get
/keysList API keys for the active org
Responses
200— Keys (no secrets).400— Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.401— Missing or invalid auth. `error.code = AUTH_ERROR`.403— Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.404— Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.409— Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.429— Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.500— Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X GET https://switchy.build/api/keys \
-H 'Authorization: Bearer sk_live_...' \post
/keysMint an API key
Returns the raw key once. After this response it can only be rotated, not retrieved.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | |
scopes | string[] | yes |
Responses
201— Created. `secret` shown once.400— Validation failed. `error.code = VALIDATION_ERROR`. `error.details.errors` lists per-field issues from zod.401— Missing or invalid auth. `error.code = AUTH_ERROR`.403— Authenticated but not allowed (wrong role, not a member, or org scope mismatch). `error.code = FORBIDDEN`.404— Resource does not exist or is invisible to the caller. `error.code = NOT_FOUND`.409— Conflict — duplicate slug, race condition, or invalid state transition. `error.code = CONFLICT`.429— Rate limit exceeded. `error.code = RATE_LIMIT`. Retry after the window listed in `Retry-After`.500— Unexpected server error. `error.code = INTERNAL_ERROR`. Logged with the `requestId` echoed in metadata.
cURL example
curl -X POST https://switchy.build/api/keys \
-H 'Authorization: Bearer sk_live_...' \
-H 'Content-Type: application/json' \
-d '{ ... }'