Agent Integration

How AI agents authenticate, discover, and call wrapped APIs through AlgoPay.

Authentication

All wrapped API requests require an AlgoPay API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

API keys are created in the AlgoPay dashboard under Settings. The key identifies which agent is making the call and which wallet to charge.

Discover Available APIs

# Fetch the catalog index
curl -s https://algopay-sdk-pay-b17a.vercel.app/api/wrapped/md \
  -H "Authorization: Bearer YOUR_API_KEY"

# Fetch details for a specific provider
curl -s "https://algopay-sdk-pay-b17a.vercel.app/api/wrapped/md?provider=firecrawl" \
  -H "Authorization: Bearer YOUR_API_KEY"

Make a Call

curl -X POST https://algopay-sdk-pay-b17a.vercel.app/api/wrapped/firecrawl/scrape \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "formats": ["markdown"]}'

Approval Flow

If a call's cost exceeds your agent's approval threshold, the response is 202:

{
  "success": true,
  "data": {
    "pending_approval_id": "uuid",
    "approval_url": "https://algopay-sdk-pay-b17a.vercel.app/dashboard/approvals",
    "status": "PENDING_APPROVAL",
    "estimated_cost_usdc": 0.50
  }
}

Error Handling

StatusMeaning
200Success. Data contains upstream response.
202Pending approval. Send the approval_url to your human.
403Policy check failed, endpoint disabled, or allowance exceeded.
502Upstream API call failed. You are not charged.