API Key - Create

Create an API Key for a merchant.

Request

POST https://sandbox.hyperswitch.io/api_keys/{merchant_id}

Headers:

  • Content-Type: application/json

  • api-key: (Admin API key required)

Path parameters:

  • merchant_id (string, required) — The unique identifier for the merchant account.

Example (cURL)

create-api-key.sh
curl --request POST \
  --url https://sandbox.hyperswitch.io/api_keys/{merchant_id} \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '
{
  "name": "Sandbox integration key",
  "expiration": "never",
  "description": "Key used by our developers to integrate with the sandbox environment"
}
'

Authorization

Header: api-key (string, required)

Admin API keys allow privileged actions such as creating a merchant account and Merchant Connector account.

Body

Content-Type: application/json

The request body for creating an API Key:

  • name (string, required) — A unique name for the API Key. Maximum length: 64. Example: "Sandbox integration key"

  • expiration (enum|string, required) — Available options: never

  • description (string|null, optional) — Description for context. Maximum length: 256. Example: "Key used by our developers to integrate with the sandbox environment"

Response

Status: 200 — application/json API Key created. Response body:

Response fields:

  • key_id (string, required) — Identifier for the API Key. Max length: 64. Example: "5hEEqkgJUyuxgSKGArHA4mWSnX"

  • merchant_id (string, required) — Identifier for the Merchant Account. Max length: 64. Example: "y3oqhf46pyzuxjbcn2giaqnb44"

  • name (string, required) — The unique name for the API Key. Max length: 64.

  • api_key (string, required) — The plaintext API Key used for server-side API access. Store securely; you will not be able to see it again. Max length: 128.

  • created (string, required) — Creation time. Example: "2022-09-10T10:11:12Z"

  • expiration (enum|string, required) — Available options: never

  • description (string|null) — Description for context. Max length: 256.

  • Platform - Create: https://api-reference.hyperswitch.io/v1/platform/platform--create

  • API Key - Retrieve: https://api-reference.hyperswitch.io/v1/api-key/api-key--retrieve

Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/api-key/api-key--create.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/api-key/api-key--create

Was this page helpful?

Yes / No

Assistant: Responses are generated using AI and may contain mistakes.