HSRCPAY Dökümantasyon
API v1

Create API key

Issues a new secret key for `account_id`. The plaintext `key` is only in this response - store it in a secret manager. Requires `account:api:key:create`. May return **200** or **201**.

POST
/api-keys/

Authorization

bearerAuth
AuthorizationBearer <token>

Use Authorization: Bearer <token>. The same header supports: (1) JWT access token from the configured auth provider; (2) secret API key whose value contains sk_ within the first 32 characters (e.g. sk_live_…, sk_test_…); (3) publishable key containing pk_. Sandbox keys typically include _test_ in the string; the server resolves repositories from that.

In: header

Query Parameters

account_id*Account ID

Account that will own the new API key.

Request Body

Defines display name, permission map, optional expiry, and metadata. The raw secret is returned once in the response.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.hsrcpay.com/v1/api-keys/?account_id=string" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "permissions": {      "property1": [        "string"      ],      "property2": [        "string"      ]    }  }'
{
  "message": "success",
  "success": true,
  "data": {
    "object": "api_key",
    "id": "string",
    "account_id": "string",
    "name": "string",
    "type": "SECRET",
    "key": "string",
    "last_used_ip": "string",
    "metadata": {
      "property1": null,
      "property2": null
    },
    "permissions": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "status": "ACTIVE",
    "last_used_at": null,
    "expires_at": null,
    "managed": true,
    "deleted": true,
    "created_at": null,
    "updated_at": null,
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "success",
  "success": true,
  "data": {
    "object": "api_key",
    "id": "string",
    "account_id": "string",
    "name": "string",
    "type": "SECRET",
    "key": "string",
    "last_used_ip": "string",
    "metadata": {
      "property1": null,
      "property2": null
    },
    "permissions": {
      "property1": [
        "string"
      ],
      "property2": [
        "string"
      ]
    },
    "status": "ACTIVE",
    "last_used_at": null,
    "expires_at": null,
    "managed": true,
    "deleted": true,
    "created_at": null,
    "updated_at": null,
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}
{
  "message": "string",
  "success": false,
  "error": {
    "code": 0,
    "message": "string",
    "details": {
      "property1": null,
      "property2": null
    },
    "property1": null,
    "property2": null
  },
  "property1": null,
  "property2": null
}