Documentation

API reference and developer guides for interacting with ZECPilot.

Getting Started

To run the developer server locally, ensure you have your environment variables set correctly:

DATABASE_URL=postgres://...
ZINGO_WALLET_SEED="..."
RPC_PROVIDER_URL="..."

Then run database migrations and start the server:

npm run db:push
npm run dev

Owner API

Endpoints used by the owner to manage agents, policies, and funding.

POST/api/v1/agents
Create a new agent.
GET/api/v1/agents
List all agents.
GET/api/v1/agents/:id
Get specific agent details.
PATCH/api/v1/agents/:id
Update agent status (pause/revoke).
POST/api/v1/agents/:id/credentials
Rotate or generate new API credentials.
GET/api/v1/agents/:id/policy
Retrieve the agent's spending policy.
PUT/api/v1/agents/:id/policy
Update the agent's spending policy.
POST/api/v1/funding/intents
Create a new ZEC funding intent.
GET/api/v1/funding/intents/:id
Check status of a funding intent.
POST/api/v1/requests/:id/approve
Approve a pending human-in-the-loop request.
POST/api/v1/requests/:id/reject
Reject a pending request.
GET/api/v1/activity
List system-wide activity and logs.

Agent API

Endpoints used by the autonomous agents to execute actions.

POST/api/v1/agent/spend
Request a transaction. Requires Agent API Key.
GET/api/v1/agent/spend/:id
Check the status of a requested transaction.

TypeScript Client Example

const response = await fetch('https://zecpilot.app/api/v1/agent/spend', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ag_live_...',
  },
  body: JSON.stringify({
    destination: '0x...',
    amount: '1000000', // in lowest denomination
    data: '0x...'
  })
});
const result = await response.json();

Webhooks

ZECPilot uses HMAC SHA-256 signatures for webhook verification. When receiving a webhook, compute the hash of the raw request body using your webhook secret and compare it against the x-zecpilot-signature header.