Skip to main content
GET
/
api
/
onchain
/
permits
List Permits
curl --request GET \
  --url https://api.example.com/api/onchain/permits
{
  "permits": [
    {
      "id": 1,
      "chain_id": 8453,
      "target": "0x1111111111111111111111111111111111111111",
      "value": "1000000000000000000",
      "status": "approved",
      "reason": null,
      "permit_hash": "0xabc123...",
      "cost_usd": 100.0,
      "timestamp": 1700000000
    },
    {
      "id": 2,
      "chain_id": 1,
      "target": "0x2222222222222222222222222222222222222222",
      "value": "5000000000000000000",
      "status": "denied",
      "reason": "tx value 5000.0 exceeds max_tx_value_usd 1000.0",
      "permit_hash": null,
      "cost_usd": 0.0,
      "timestamp": 1700001000
    }
  ]
}
Retrieves a list of recent permit requests (both approved and denied).

Authentication

Requires a valid session token in the Authorization header:
Authorization: Bearer <session_token>

Query Parameters

days
integer
default:"30"
Number of days of history to retrieve (default: 30)
status
string
Filter by permit status: approved or denied. Omit to return all permits

Response

permits
array
Array of permit records
{
  "permits": [
    {
      "id": 1,
      "chain_id": 8453,
      "target": "0x1111111111111111111111111111111111111111",
      "value": "1000000000000000000",
      "status": "approved",
      "reason": null,
      "permit_hash": "0xabc123...",
      "cost_usd": 100.0,
      "timestamp": 1700000000
    },
    {
      "id": 2,
      "chain_id": 1,
      "target": "0x2222222222222222222222222222222222222222",
      "value": "5000000000000000000",
      "status": "denied",
      "reason": "tx value 5000.0 exceeds max_tx_value_usd 1000.0",
      "permit_hash": null,
      "cost_usd": 0.0,
      "timestamp": 1700001000
    }
  ]
}

Error Responses

error
string
Error message

Status Codes

  • 200 - Success
  • 401 - Unauthorized (missing or invalid session token)
  • 500 - Database error

Examples

# Get all permits from last 7 days
curl "https://localhost:3978/api/onchain/permits?days=7" \
  -H "Authorization: Bearer fn_sess_abc123..."

# Get only denied permits
curl "https://localhost:3978/api/onchain/permits?status=denied" \
  -H "Authorization: Bearer fn_sess_abc123..."

Use Cases

  • Monitor recent onchain activity
  • Debug why specific permits were denied
  • Audit transaction history
  • Track spending patterns by chain or contract

Build docs developers (and LLMs) love