Create API Key

August 3, 2026 ยท View on GitHub

Use case

Creates an API key for server-to-server access to protected Decision Engine routes.

Authentication

Dashboard protected. Send Authorization: Bearer <jwt_token>. In sandbox, also send x-feature: decision-engine.

For local development, start with:

export BASE_URL=http://localhost:8080
export AUTH_HEADER="Authorization: Bearer <jwt_token>"
# Sandbox only:
# export BASE_URL=https://sandbox.hyperswitch.io
# export FEATURE_HEADER="x-feature: decision-engine"

Request

  • Method and path: POST /api-key/create
  • Parameters: none.
  • Body: JSON body with merchant_id and an optional description.

Example

Create API key

curl --location "$BASE_URL/api-key/create" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{
  "merchant_id": "merchant_demo",
  "description": "backend integration key"
}'

Response

{
  "key_id": "018f2c1a-...",
  "api_key": "DE_...",
  "key_prefix": "DE_abcd1234",
  "merchant_id": "merchant_demo",
  "description": "backend integration key",
  "created_at": "2026-04-26 10:00:00.000000"
}

Notes

  • The raw API key is usually returned only once. Store it securely.
  • Use x-api-key: <api_key> as AUTH_HEADER for backend-to-backend examples.