Create an organization-scoped secret key (shown once)
POST /v1/organizations/{org}/api_keys: Create an organization-scoped secret key (shown once).
POST /
The new key is limited to this organization. Its scopes must be a subset of the calling key’s scopes (a key without * cannot grant *).
- Scope
api_keys:write- Auth
- Secret key (
sk_…) - Since
- 1.0
Path parameters
Section titled “Path parameters”orgstring Required
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Honoured for 24 h; a replay returns the original response.Idempotency-Keystringmin length 1 · max length 255
Request body
Section titled “Request body”namestring Requiredmin length 1 · max length 200
scopesarray of string Requiredmin items 1
CIDR blocks the key may be used from (Business plan and above).ip_allow_listarray of string
RFC 3339, UTC.expires_atstring (date-time)
Responses
Section titled “Responses”- 201 OK ApiKeySecret
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 404 Code: resource_not_found (also returned for other tenants’ IDs); a path no endpoint serves answers route_not_found. A browser GET or HEAD of an unknown path whose Accept ranks text/html above JSON gets an HTML 404 page instead, with the same status; every other client gets this JSON body. Error
- 409 Codes: idempotency_key_reused and resource-specific conflicts. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
Errors share one shape; see the error code catalogue.
curl -X POST \ "https://api.ohauthcat.com/v1/organizations/org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/api_keys" \ -H "Authorization: Bearer $OHAUTHCAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Acme Corp", "scopes": [ "organizations:read" ]}'const response = await fetch("https://api.ohauthcat.com/v1/organizations/org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/api_keys", { method: "POST", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "name": "Acme Corp", "scopes": [ "organizations:read" ] }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/v1/organizations/org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5/api_keys", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "name": "Acme Corp", "scopes": [ "organizations:read", ], },)data = response.json(){ "api_key": { "id": "key_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "object": "api_key", "name": "Acme Corp", "type": "secret", "prefix": "sk_test", "publishable_key": "pk_01J9ZQ4M7K2X8V3N5B6C1D0E9F", "revoked_at": "2026-01-15T09:30:00Z", "environment": "env_01J9Z3K5V7W8X9Y0Z1A2B3C4D5", "scopes": [ "organizations:read" ], "ip_allow_list": [ "example_ip_allow_list" ], "expires_at": "2026-01-15T09:30:00Z", "last_used_at": "2026-01-15T09:30:00Z", "created_at": "2026-01-15T09:30:00Z", "organization": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5" }, "secret": "sk_test_example", "previous_key_expires_at": "2026-01-15T09:30:00Z"}