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

Authorizations

Api-Key
string
header
required

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

Body

application/json
userId
string
required

ID of the user who owns this agent

name
string
required

Agent 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
metadata
object

Custom metadata

Response

Agent created

id
string
required
userId
string
required
name
string
required
status
enum<string>
required
Available options:
active,
suspended
createdAt
integer
required
description
string
spendingLimit
integer
spendingLimitFrequency
enum<string>
Available options:
perTransaction,
per24HourPeriod,
perWeek,
perMonth,
perYear,
allTime
currentSpend
integer

Current spend in the period

onLimitExceeded
enum<string>
Available options:
suspend,
notify,
none
maxCards
integer
cardCount
integer
metadata
object