# Add credits to a pool

`POST /api/v1/customers/by-external-id/{externalId}/credits/grant`

Needs the `customers:write` scope, or a full-access key.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `externalId` | string | required |  |

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 `idempotency_key_reused`; a key whose first request is still running answers 409 `idempotency_in_progress`. |

## Request body

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Your idempotency id."
    },
    "pool": {
      "type": "string"
    },
    "amount": {
      "type": "integer",
      "exclusiveMinimum": 0
    },
    "source": {
      "type": "string",
      "maxLength": 200
    },
    "reason": {
      "type": "string",
      "enum": [
        "purchase",
        "grant",
        "adjust"
      ]
    }
  },
  "required": [
    "id",
    "pool",
    "amount"
  ]
}
```

## Responses

### 201

The pool balance (scope `customers:write`). Emits `entitlements.updated`.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "pool": {
          "type": "string"
        },
        "duplicate": {
          "type": "boolean"
        },
        "balance": {
          "type": "object",
          "properties": {
            "granted": {
              "type": "integer"
            },
            "used": {
              "type": "integer"
            },
            "remaining": {
              "type": "integer"
            }
          },
          "required": [
            "granted",
            "used",
            "remaining"
          ]
        }
      },
      "required": [
        "pool",
        "duplicate",
        "balance"
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```
