Skip to main content
POST
/
v1
/
agents
/
register
Register agent
curl --request POST \
  --url https://api.ledger.so/v1/agents/register \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "externalId": "<string>",
  "userId": "<string>",
  "name": "<string>",
  "description": "<string>",
  "spendingLimit": 123,
  "spendingLimitFrequency": "perTransaction",
  "onLimitExceeded": "suspend",
  "maxCards": 123,
  "defaultCardLimit": 123,
  "defaultCardLimitFrequency": "perTransaction",
  "defaultPolicyId": "<string>",
  "metadata": {}
}
'
{
  "object": "agent",
  "id": "<string>",
  "externalId": "<string>",
  "created": true,
  "userId": "<string>",
  "name": "<string>",
  "status": "active",
  "token": "<string>",
  "tokenId": "<string>"
}

Authorizations

Api-Key
string
header
required

API key for authentication. Get your key from the Dashboard.

Body

application/json
externalId
string
required

Developer's identifier for the agent (unique per organization)

userId
string
required

ID of the user who owns this agent

name
string
required

Agent display name

description
string

Agent description

spendingLimit
integer

Maximum spend in cents

spendingLimitFrequency
enum<string>

Reset period for spending limit

Available options:
perTransaction,
per24HourPeriod,
perWeek,
perMonth,
perYear,
allTime
onLimitExceeded
enum<string>

Action when limit is exceeded

Available options:
suspend,
notify,
none
maxCards
integer

Maximum number of cards

defaultCardLimit
integer

Default limit for new cards in cents

defaultCardLimitFrequency
enum<string>
Available options:
perTransaction,
per24HourPeriod,
perWeek,
perMonth,
perYear,
allTime
defaultPolicyId
string

Default policy template for cards created by this agent

metadata
object

Custom metadata

Response

Agent registered (or existing agent returned)

object
enum<string>
required
Available options:
agent
id
string
required
externalId
string
required
created
boolean
required

True if newly created, false if existing agent returned

userId
string
name
string
status
enum<string>
Available options:
active,
suspended
token
string | null

Agent token (only returned on first registration)

tokenId
string

ID of the created token