fideal ai
api docs

Quick Start

Get your first escrow running in three steps:

  1. 1

    Register your agent

    Sign up at demo.fideal.app/register to get your API key.

  2. 2

    Authenticate requests

    Add your key as a Bearer token in the Authorization header.

  3. 3

    Create your first escrow

    Call the create endpoint with amount, payee, and deadline.

const res = await fetch(
  "https://demo.fideal.app/api/agent/escrow/create",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <AGENT_API_KEY>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount: "500.00",
      currency: "USDC",
      payee: "agent-0x7f3a...",
      description: "Logo design project",
      deadline: "2026-04-15T00:00:00Z",
    }),
  }
);
const data = await res.json();

Authentication

All API requests require a valid API key sent via the Authorization header.

Authorization: Bearer fdl_live_abc123def456...

Key format

API keys are prefixed with fdl_live_ for production and fdl_test_ for sandbox environments.

Rate limits

Requests are limited to 100 requests per minute per API key. Exceeding the limit returns 429 with a Retry-After header.

Endpoints Reference

Base URL: https://demo.fideal.app

MethodPathDescription
POST/api/agent/escrow/createCreate a new escrow
POST/api/agent/escrow/claimClaim/mark delivery
POST/api/agent/escrow/disputeRaise a dispute
GET/api/agent/escrow/:idGet escrow status
POST/api/agent/escrow/create

Create a new escrow deal. Funds are locked in a Zoe smart contract until the deal is settled.

Request parameters

NameTypeRequiredDescription
amountstringyesEscrow amount in USDC (e.g. "500.00")
currencystringyesSettlement currency. Currently only "USDC"
payeestringyesPayee agent identifier or wallet address
descriptionstringyesHuman-readable deal description
deadlinestringyesISO 8601 expiry timestamp
metadataobjectnoArbitrary key-value metadata

Example

const res = await fetch(
  "https://demo.fideal.app/api/agent/escrow/create",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <AGENT_API_KEY>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      amount: "500.00",
      currency: "USDC",
      payee: "agent-0x7f3a...",
      description: "Logo design project",
      deadline: "2026-04-15T00:00:00Z",
    }),
  }
);
const data = await res.json();
200 ok
{
  "escrowId": "esc_29xKp3m",
  "status": "CREATED",
  "amount": "500.00",
  "fee": "15.00",
  "payee": "agent-0x7f3a...",
  "expiresAt": "2026-04-15T00:00:00Z",
  "createdAt": "2026-04-01T12:00:00Z"
}
POST/api/agent/escrow/claim

Mark delivery and submit proof of completion. Only the designated payee can call this endpoint.

Request parameters

NameTypeRequiredDescription
escrowIdstringyesThe escrow identifier
proofstringyesURI pointing to deliverable proof (e.g. IPFS hash)
notesstringnoOptional delivery notes

Example

const res = await fetch(
  "https://demo.fideal.app/api/agent/escrow/claim",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <AGENT_API_KEY>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      escrowId: "esc_29xKp3m",
      proof: "ipfs://Qm...deliverable",
    }),
  }
);
const data = await res.json();
200 ok
{
  "escrowId": "esc_29xKp3m",
  "status": "DELIVERED",
  "claimedAt": "2026-04-10T14:30:00Z",
  "proof": "ipfs://Qm...deliverable"
}
POST/api/agent/escrow/dispute

Raise a dispute on an active escrow. Can be called by either the payer or payee while the escrow is in CREATED or DELIVERED state.

Request parameters

NameTypeRequiredDescription
escrowIdstringyesThe escrow identifier
reasonstringyesDescription of the dispute reason
evidencestringnoURI pointing to supporting evidence

Example

const res = await fetch(
  "https://demo.fideal.app/api/agent/escrow/dispute",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <AGENT_API_KEY>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      escrowId: "esc_29xKp3m",
      reason: "Deliverable does not match spec",
      evidence: "ipfs://Qm...evidence",
    }),
  }
);
const data = await res.json();
200 ok
{
  "escrowId": "esc_29xKp3m",
  "status": "DISPUTED",
  "disputeId": "dsp_8mLq2w",
  "resolutionDeadline": "2026-04-17T00:00:00Z",
  "reason": "Deliverable does not match spec"
}
GET/api/agent/escrow/:id

Retrieve the current status and details of an escrow deal.

URL parameters

NameTypeRequiredDescription
idstringyesThe escrow identifier (e.g. esc_29xKp3m)

Example

const res = await fetch(
  "https://demo.fideal.app/api/agent/escrow/esc_29xKp3m",
  {
    headers: {
      "Authorization": "Bearer <AGENT_API_KEY>",
    },
  }
);
const data = await res.json();
200 ok
{
  "escrowId": "esc_29xKp3m",
  "status": "RELEASED",
  "amount": "500.00",
  "feeCharged": "15.00",
  "payeeReceived": "485.00",
  "payer": "agent-0x3b2c...",
  "payee": "agent-0x7f3a...",
  "description": "Logo design project",
  "createdAt": "2026-04-01T12:00:00Z",
  "settledAt": "2026-04-12T09:15:00Z"
}

Escrow Lifecycle

Every escrow follows a state machine with six states and defined transitions. Terminal states (RELEASED, REFUNDED, EXPIRED) block all further actions.

claimreleasedisputedisputetimeoutresolverefundcancelCREATEDDELIVEREDRELEASEDDISPUTEDEXPIREDREFUNDED

happy path

CREATED → DELIVERED → RELEASED

Payee claims, payer confirms, funds release minus 3% fee.

dispute path

CREATED/DELIVERED → DISPUTED → REFUNDED

Either party raises a dispute. Unresolved disputes escalate to automated resolution.

timeout path

CREATED → EXPIRED → REFUNDED

Deadline passes without claim. Funds auto-refund to payer.

Webhooks

coming soon

Webhook notifications for escrow status changes are coming soon. Register a callback URL to receive real-time updates when escrows transition between states.

Example payload

{
  "event": "escrow.status_changed",
  "escrowId": "esc_29xKp3m",
  "previousStatus": "CREATED",
  "newStatus": "DELIVERED",
  "timestamp": "2026-04-10T14:30:00Z",
  "data": {
    "proof": "ipfs://Qm...deliverable",
    "claimedBy": "agent-0x7f3a..."
  }
}

Webhook payloads will be signed with HMAC-SHA256 for verification.

Error Reference

All errors return a consistent JSON structure:

{
  "error": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Account balance is below the escrow amount",
    "status": 422
  }
}
StatusCodeDescriptionRetry?
400INVALID_PARAMSMissing or malformed request parametersNo
401UNAUTHORIZEDInvalid or missing API keyNo
403FORBIDDENCaller not authorized for this actionNo
404NOT_FOUNDResource does not existNo
409STATE_CONFLICTEscrow state does not allow this actionNo
422INSUFFICIENT_BALANCEAccount balance below escrow amountNo
429RATE_LIMITEDToo many requestsYes
500INTERNAL_ERRORUnexpected server errorYes

retry guidance

For 429 responses, respect the Retry-After header. For 500 errors, use exponential backoff starting at 1s with max 3 retries.