POST /v1/api_keys

Create an API key

Creates a new API key and returns the raw key.

Creates a new API key with the specified name and environment. The response includes a raw_key field containing the full API key — copy it immediately, as it cannot be retrieved again.

The key is generated with a prefix (sk_live_ or sk_test_) followed by 32 random bytes encoded in base64url.

Body parameters

resellerStoreId string REQUIRED

Reseller store this key is bound to

name string REQUIRED

Human-readable name for the key

environment string OPTIONAL

Possible enum values:

  • live
  • test

Responses

201

Request

curl -X POST https://api.example.com/v1/api_keys \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "resellerStoreId": "example_resellerStoreId",
  "name": "example_name"
}'

Response

201 201 Created
{
  "id": "example_id",
  "ownerId": "example_ownerId",
  "resellerStoreId": "example_resellerStoreId",
  "prefix": "example_prefix",
  "name": "example_name",
  "lastUsedAt": "example_lastUsedAt",
  "createdAt": "example_createdAt",
  "revokedAt": "example_revokedAt",
  "raw_key": "example_raw_key",
  "request_id": "example_request_id"
}