Skip to main content
POST
/
manage
/
spend_keys
Create a spend key
curl --request POST \
  --url https://api.lava.so/v1/manage/spend_keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "wallet_id": "<string>",
  "connection_id": "<string>",
  "status": "active",
  "allowed_models": [
    "<string>"
  ],
  "allowed_providers": [
    "<string>"
  ],
  "spend_limit": {
    "amount": "<string>",
    "cycle": "daily"
  },
  "request_limit": {
    "count": 2,
    "cycle": "daily"
  },
  "rate_limit": {
    "rpm": 2,
    "burst": 2
  },
  "expires_at": "2023-11-07T05:31:56Z"
}
'
{
  "spend_key_id": "<string>",
  "key_preview": "<string>",
  "name": "<string>",
  "status": "active",
  "wallet_id": "<string>",
  "current_spend": "<string>",
  "current_requests": 1,
  "created_at": "2023-11-07T05:31:56Z",
  "key": "<string>",
  "allowed_models": [
    "<string>"
  ],
  "allowed_providers": [
    "<string>"
  ],
  "spend_limit": {
    "amount": "<string>",
    "cycle": "daily"
  },
  "request_limit": {
    "count": 2,
    "cycle": "daily"
  },
  "rate_limit": {
    "rpm": 2,
    "burst": 2
  },
  "expires_at": "2023-11-07T05:31:56Z",
  "last_used_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer token authentication used for standard API calls. Format: 'Bearer YOUR_API_KEY'

Body

application/json
name
string
required
Maximum string length: 255
wallet_id
string
connection_id
string
status
enum<string>
Available options:
active,
paused
allowed_models
string[] | null
allowed_providers
string[] | null
spend_limit
object
request_limit
object
rate_limit
object
expires_at
string<date-time> | null

Response

201 - application/json

Spend key created

spend_key_id
string
required
key_preview
string
required

Masked key preview (e.g., lava_sk_a1b2c3d4****)

name
string
required
status
enum<string>
required
Available options:
active,
paused
wallet_id
string
required
current_spend
string
required

Current spend in this cycle (decimal string)

current_requests
integer
required

Current request count in this cycle

Required range: x >= 0
created_at
string<date-time>
required
key
string
required

The raw spend key (shown once)

allowed_models
string[] | null
allowed_providers
string[] | null
spend_limit
object
request_limit
object
rate_limit
object
expires_at
string<date-time> | null
last_used_at
string<date-time> | null