REST API

HTTP API for agent integration. Works with any language.

🚀 Agent Quick Start

Every agent should follow this pattern:

  1. Set base URL: DCP_URL=http://127.0.0.1:8421
  2. Call capabilities: GET /v1/capabilities
  3. Use returned routes: Call operations like /v1/vault/read, /v1/vault/sign, etc.
curl http://127.0.0.1:8421/v1/capabilities

Setup Remote Agent (VPS/Cloud)

🌐 Running agents on VPS or remote servers?

Follow these steps to securely connect your remote agent to your local vault:

  1. Open DCP Desktop App on your local machine
  2. Connect to relay: Go to "Connect" section and connect to relay
  3. Go to "Run a remote agent (VPS)" section
  4. Add scopes your agent needs (e.g., identity.name, wallet.solana)
  5. Click "Generate pair token" - this creates a pairing command
  6. Copy the command - it looks like this:
    npx -y -p @dcprotocol/proxy dcp-proxy \
      --pair 'z8WlguCjJMDgg13E_0jpGGd6CwIwkc_BwYDt5-pBVuc' \
      --service-id 'my-vps-agent' \
      --vault 'vault_4d512c83-8193-4062-b05c-ff27c2711179' \
      --hpke-key 'BXbzDrnpdjSKIp9+k38P4alZVg8Xnt/XYm78Cqhxd3A=' \
      --relay 'wss://relay.dcp.1ly.store' \
      --port 8421
  7. SSH to your VPS and paste the command - proxy starts on port 8421
  8. Configure your agent:
    DCP_URL=http://127.0.0.1:8421
  9. Agent calls capabilities:
    curl http://127.0.0.1:8421/v1/capabilities

✅ That's it! Your agent is now securely connected.

Keys stay on your local machine. Agent on VPS only gets approved results through the relay.

Endpoints

⚡ Start Here: Discovery

IMPORTANT: Agents should ALWAYS start by calling this endpoint to discover available operations, routes, and example scopes.

GET /v1/capabilities

Discover what operations and scopes the vault/proxy supports.

This is the first call every agent should make to understand what it can do.

curl http://127.0.0.1:8421/v1/capabilities

Response:
{
  "name": "dcp-vault" or "dcp-proxy",
  "version": "0.2.0",
  "mode": "local" or "proxy",
  "local_url": "http://127.0.0.1:8421",
  "chains": ["solana", "base", "ethereum"],
  "routes": [
    {
      "method": "GET",
      "path": "/address/:chain",
      "operation": "get_address",
      "description": "Get wallet address"
    },
    {
      "method": "POST",
      "path": "/v1/vault/read",
      "operation": "vault_read",
      "description": "Read identity or API credentials"
    },
    {
      "method": "POST",
      "path": "/v1/vault/sign",
      "operation": "vault_sign_tx",
      "description": "Sign transaction"
    }
    // ... more routes
  ],
  "scope_examples": [
    "identity.email",
    "identity.name",
    "credentials.api.openai",
    "credentials.api.github",
    "address.shipping.primary"
  ],
  "notes": [
    "Read and write operations use POST with a scope string",
    "Sensitive operations may require desktop user approval"
  ]
}

GET /address/:chain

Get wallet address for chain.

curl http://127.0.0.1:8421/address/solana

Response:
{
  "address": "5Yz...",
  "chain": "solana"
}

POST /v1/vault/sign

Sign transaction.

curl -X POST http://127.0.0.1:8421/v1/vault/sign \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "solana",
    "agent_name": "my-trading-bot",
    "amount": 1.5,
    "currency": "SOL",
    "unsigned_tx": "..."
  }'

Response:
{
  "signed_tx": "...",
  "signature": "..."
}

POST /v1/vault/read

Read stored data.

curl -X POST http://127.0.0.1:8421/v1/vault/read \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "identity.email",
    "agent_name": "my-bot"
  }'

Response:
{
  "value": "you@example.com"
}

POST /v1/vault/unlock

Unlock vault with password.

curl -X POST http://127.0.0.1:8421/v1/vault/unlock \
  -H "Content-Type: application/json" \
  -d '{"password": "your-password"}'

GET /v1/vault/activity

Get audit log.

curl http://127.0.0.1:8421/v1/vault/activity

Response:
{
  "events": [
    {
      "timestamp": "2026-03-20T...",
      "agent": "TradingBot",
      "action": "SIGN",
      "amount": 1.5,
      "currency": "SOL",
      "status": "APPROVED"
    }
  ]
}

Python Example

import requests

# Get address
response = requests.get("http://127.0.0.1:8421/address/solana")
address = response.json()["address"]

# Sign transaction
response = requests.post("http://127.0.0.1:8421/v1/vault/sign", json={
    "chain": "solana",
    "agent_name": "my-bot",
    "amount": 1.5,
    "currency": "SOL",
    "unsigned_tx": "..."
})
signed_tx = response.json()["signed_tx"]

Note: Default proxy port is 8421. For direct vault access (local agents only), use port 8420.