Skip to main content
POST
/
api
/
v1
/
agents
/
charges
Create a Charge
curl --request POST \
  --url https://pulsarpay.io/api/v1/agents/charges \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: <idempotency-key>' \
  --header 'x-agent-key: <x-agent-key>' \
  --header 'x-user-key: <x-user-key>' \
  --data '
{
  "amount": 0.1,
  "currency": "USDC",
  "description": "AI Model Inference - 500 tokens"
}
'
{ "success": true, "chargeId": "cmnnfoagf0003jk04suqxf3k9", "reused": true }

Headers

x-user-key
string
required

The user's authorization token. This allows the agent to execute charges against the user's credits.

x-agent-key
string
required

The unique API key of the agent executing the charge.

Idempotency-Key
string
required

A unique, client-generated string to prevent duplicate charges in case of network retries. Recommended to use UUID v4.

Body

application/json
amount
number<float>
required

The amount to be charged to the user's balance. Represented in decimal units of the specified currency (e.g., 1.50 for $1.50 USD or 1.50 USDC).

Example:

0.1

currency
enum<string>
required

The currency for the charge. Each currency has an independent balance — the user must have sufficient funds in the specified currency. Use USDC for Solana-based payments or USD for fiat.

Available options:
USDC,
USD
Example:

"USDC"

description
string
required

A brief description of the service or product provided. This will be visible to the user in their transaction history.

Maximum string length: 255
Example:

"AI Model Inference - 500 tokens"

Response

Charge processed successfully

success
boolean
Example:

true

chargeId
string
Example:

"cmnnfoagf0003jk04suqxf3k9"

reused
boolean
Example:

true