BUILT WITH THE TWITTERAPI.IO TEAM
Engineering Reference · https://api.agentapigate.ai

AgentAPIGate Developer Documentation

Everything required to integrate our 70 normalized real-time endpoints into autonomous LLM agents, RAG pipelines, MCP clients, and x402 workflows.

1. Triple Authentication Rail

Pass your master key (aag_live_*) or scoped agent sub-key (aag_agent_*) via Authorization: Bearer aag_live_... or X-API-Key: aag_live_.... Unauthenticated requests to read-only endpoints automatically return an HTTP 402 Payment Required challenge for Coinbase x402 v2 Base Mainnet USDC (0x4E55506145578bE737a8Edb7b983D2014bfb617c).

curl -s "https://api.agentapigate.ai/v1/youtube/video/transcript?video_id=aircAruvnKk&format=md" \
  -H "Authorization: Bearer aag_live_YOUR_KEY"

2. Dual-Bucket USD Ledger (paid_usd vs bonus_usd)

  • paid_usd (Never Expires): Credited via crypto deposit (USDC, USDT, SOL, ETH, BTC), POST /v1/x402/buy-credits, or card. Works across all 8 canonical packs (including Pack 1 x.*).
  • bonus_usd (Promotional & Partner Bucket): Covers our 7 non-X canonical packs (search, social, commerce, b2b, finance, local, intel). Spent automatically first on eligible calls before touching paid_usd.
  • $0.00 on Failure or Empty Data: Atomic Redis Lua holds are immediately released if an upstream returns 4xx/5xx, times out, or returns zero items.

3. Token Economy (?format=json|compact|md) & Money Headers

Append ?format=compact (projected JSON without nulls), ?format=md (LLM-ready Markdown saving 80–88% context tokens), ?fields=id,title,url, or ?max_tokens=1500 to any endpoint.

# Pre-flight $0 price & schema quote:
curl -s "https://api.agentapigate.ai/v1/sec/company/filings?ticker=NVDA&dry_run=1"

# Enforce per-call max spend ceiling & anti-double-billing Idempotency-Key:
curl -s "https://api.agentapigate.ai/v1/search/google/web?q=MCP+protocol&format=compact" \
  -H "Authorization: Bearer $AAG_API_KEY" \
  -H "X-AAG-Max-Cost: 0.0050" \
  -H "Idempotency-Key: run_9f82a10c"

4. Receipt Envelope & Prompt-Injection Provenance

{
  "ok": true,
  "meta": {
    "request_id": "req_7f81d29a4b10",
    "endpoint": "youtube.video.transcript",
    "format": "md",
    "cost_usd": 0.001,
    "balance_usd": 24.999,
    "tokens_est": 612,
    "raw_tokens_est": 4812,
    "tokens_saved_pct": 87,
    "latency_ms": 238,
    "cached": false,
    "fetched_at": "2026-11-20T05:30:00.000Z",
    "content_trust": "external_untrusted"
  },
  "data": "# YouTube Video Full Transcript..."
}