---
title: "Allocate credits to an end-user"
method: POST
path: "/credits/end-users/{externalUserId}/allocate"
tags: ["End users"]
---

# Allocate credits to an end-user

`POST /credits/end-users/{externalUserId}/allocate`

## Request

- Base URL: `https://api.paywithlocus.com/api`
- URL: `https://api.paywithlocus.com/api/credits/end-users/{externalUserId}/allocate`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Atomic platform-pool → end-user transfer; both sides ledgered. Fails (402) if the pool cannot cover it — unfunded allocations are impossible. Amounts are exact decimal strings.

## Path parameters

- `externalUserId` string, required: Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.

## Headers

- `Idempotency-Key` string, required

## Request body

- object
  - `credits` string, required: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
  - `promo` boolean: Ledger as a promo/comp grant

## Response `200`

Allocation applied; returns both balances

- TransferResult
  - `success` unknown, required
  - `externalUserId` string, required: Case-sensitive immutable ID in the tenant namespace. Prefer an identity-provider subject, not an email address.
  - `usd` string, required: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
  - `credits` string, required: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
  - `poolBalanceUsd` string, required: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.
  - `endUserBalanceUsd` string, required: Non-negative exact decimal string with at most six fractional digits. Endpoint-specific positivity and amount limits still apply.

## Other responses

- `402`: Platform pool balance insufficient

---

[API](https://skmtc.dev/paywithlocus/apis/locus-pro-api.md) - [All operations](https://skmtc.dev/paywithlocus/apis/locus-pro-api/llms.txt) - [OpenAPI document](https://skmtc.dev/paywithlocus/apis/locus-pro-api/revisions/aab8fa5d6cef?raw)
