Reference

Compact table of every endpoint in this chapter. All entries authenticate with Authorization: Bearer jg_a_….

Base URLs

Environment URL
Production https://api.juglans.ai
Local dev http://localhost:3002

Headers

Authorization: Bearer jg_a_3f8a9c1e2d4b5e7f...
Content-Type: application/json

Content-Type: application/json is required for every POST / PUT body. The /api/llm/chat/completions endpoint also accepts Accept: text/event-stream for streaming.

Getting a jg_a_* key

Three paths to a fresh key:

  1. Auto-issued at agent creation. Every POST /api/agents (JWT) returns the agent and its first key in the same response. Save it then — it's not retrievable later.
  2. Mint another from the UI. Open the agent → Agent Integration panel → click rotate / new key. Same affordance as initial creation.
  3. Mint another from the API. POST /api/agents/{id}/keys with the owner JWT. Returns { api_key, api_key_id, prefix }.

Test-mode agents get keys prefixed jg_a_test_ instead of jg_a_. Both authenticate identically against this chapter's endpoints; trading/transfers run against simulators in test mode.

Endpoint table

Method Path Purpose See
GET /api/me Identity card: agent, wallets, scopes. Trading & wallet
GET /api/limits Spending caps for the calling agent. Trading & wallet
GET /api/skill.md Personalized Claude Code skill (text/markdown). Trading & wallet
POST /api/llm/chat/completions OpenAI-compatible chat completions proxy. Chat & LLM
GET /api/memory List all memory entries. Memory
GET /api/memory/search?q=… Substring search over keys + content. Memory
GET /api/memory/{key} Read one entry. Memory
PUT /api/memory/{key} Create or overwrite an entry. Memory
DELETE /api/memory/{key} Remove an entry. Memory
POST /api/orders Place market or limit order. Trading & wallet
GET /api/orders List recent orders (50). Trading & wallet
GET /api/orders/{id} Single-order detail. Trading & wallet
DELETE /api/orders/{id} Cancel an open order. Trading & wallet
GET /api/positions Open positions across exchanges. Trading & wallet
GET /api/exchanges/{exchange}/account Live balances + positions on one exchange. Trading & wallet
POST /api/transfers On-chain transfer to an external EVM address. Trading & wallet
GET /api/transfers Recent transfers (50). Trading & wallet
GET /api/transfers/{id} Single-transfer detail. Trading & wallet
POST /api/polymarket/setup Approve USDC + derive CLOB key for Polymarket. Trading & wallet
POST /api/bridge/quote LI.FI cross-chain quote. Trading & wallet
POST /api/bridge/execute LI.FI quote + submit via agent signer. Trading & wallet
POST /mcp Streamable-HTTP MCP transport. MCP

Required scopes

Scope Endpoints
none (any valid jg_a_* key) /api/me
read /api/limits, /api/memory*, /api/orders (GET), /api/positions, /api/transfers (GET), /api/exchanges/{exchange}/account
trade /api/orders (POST/DELETE), /api/polymarket/setup
transfer /api/transfers (POST), /api/bridge/quote, /api/bridge/execute
admin implies all of the above

Errors

All errors return a flat envelope — {"error": "<message>"} — with no machine-readable code field. Branch on the HTTP status, not on the body.

Status Typical cause
400 Malformed JSON, missing required field, or a field that fails validation (e.g. unsupported chain).
401 Missing/invalid Authorization header.
403 Key lacks the scope this endpoint requires, or the agent is frozen.
404 Resource doesn't exist (or isn't owned by the agent).
409 Memory write would overwrite a "user"-edited entry; pass force: true.
502 Upstream LLM, exchange, or bridge unreachable.