APG PayAPG Paydocs

Identity

Create API keys

POST/api-keys

Issue a token. The secret is on the response and nowhere else, ever.

Permissions

Required permission
serviceTokens:create

Requires the `create` action on `serviceTokens` for the supplied runtime context

Request body

This body is a tagged shape: type is always "ApiKeyCmdCreate". Send it; more variants can be added, and a caller that switches on it keeps working when they are.

Discriminated by type
type = "ApiKeyCmdCreate"
descriptionstringrequired

What the token is for. This is the only way to tell two secrets apart later, so make it specific.

expiresAtstring (date-time)

When it stops working. Omit for a token that does not expire.

Example 2026-08-19T04:21:07Z

curl -X POST https://api.tst.au.apgpay.dev/api-keys \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "ApiKeyCmdCreate",
  "description": "string",
  "scope": {
    "type": "ApiKeyScopeEnterprise",
    "enterpriseId": "ent_9f2Kd8QpLzXw"
  },
  "permissions": {
    "type": "ApiKeyPermissionsExplicit",
    "grants": [
      {
        "type": "ApiKeyGrantAttributes",
        "resource": "BlockedCard",
        "actions": [
          "Query"
        ]
      }
    ]
  },
  "expiresAt": "2026-08-19T04:21:07Z"
}'

Responses

The response is a tagged shape: type is always "ApiKeyCreateRspIssued". Switch on it; subtypes can be added, and a client that already reads it will not break.

Discriminated by type
type = "ApiKeyCreateRspIssued"

The token as it will read from now on.

secretstringrequired

The secret. Returned once, here, and never retrievable again, store it now.

Example
{
  "type": "ApiKeyCreateRspIssued",
  "created": {
    "type": "ApiKeyViewAttributes",
    "apiKeyId": "key_9f2Kd8QpLzXw",
    "description": "string",
    "scope": {
      "type": "ApiKeyScopeEnterprise",
      "enterpriseId": "ent_9f2Kd8QpLzXw"
    },
    "permissions": {
      "type": "ApiKeyPermissionsExplicit",
      "grants": [
        {
          "type": "ApiKeyGrantAttributes",
          "resource": "BlockedCard",
          "actions": [
            "Query"
          ]
        }
      ]
    },
    "status": "Enabled",
    "value": "string",
    "expiresAt": "2026-08-19T04:21:07Z",
    "createdBy": "string",
    "createdAt": "2026-08-19T04:21:07Z",
    "updatedAt": "2026-08-19T04:21:07Z"
  },
  "secret": "string"
}

Error responses