문서

REST API 빠른 참조

AgenticTrade는 순수 REST API입니다 — SDK가 필요 없습니다. curl, fetch, httpx 또는 사용 중인 언어의 HTTP 라이브러리를 사용하세요. 모든 엔드포인트는 표준 HTTP 규칙을 따르고 JSON을 반환합니다.

설치

Python 3.9+이 필요합니다. SDK는 표준 라이브러리와 httpx 외에 필수 의존성이 없습니다.

# No installation required — use curl, fetch, httpx, requests, or any HTTP library.
# All endpoints are at https://agentictrade.io and return JSON.

# Get your API key (no auth needed for first call):
curl -X POST https://agentictrade.io/api/v1/keys \
  -H "Content-Type: application/json" \
  -d '{"owner_id": "my-agent-001", "role": "buyer"}'

빠른 시작

# Discover services
curl https://agentictrade.io/api/v1/discover?category=analysis&min_quality=80

# Call a service (Bearer auth)
curl -X POST https://agentictrade.io/api/v1/proxy/<service_id>/<path> \
  -H "Authorization: Bearer <key_id>:<secret>" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

# Check your usage
curl -H "Authorization: Bearer <key_id>:<secret>" \
  https://agentictrade.io/api/v1/usage/me

비동기 지원

높은 처리량의 에이전트를 위해 비동기 클라이언트를 사용하세요:

# Python example with httpx (async)
import asyncio
import httpx

async def main():
    async with httpx.AsyncClient(base_url="https://agentictrade.io") as client:
        # Discover
        r = await client.get("/api/v1/discover")
        services = r.json()["services"]

        # Call all in parallel
        results = await asyncio.gather(*[
            client.post(
                f"/api/v1/proxy/{s['id']}/api/process",
                headers={"Authorization": f"Bearer {KEY_ID}:{SECRET}"},
                json={"input": "test"},
            )
            for s in services[:3]
        ])
        for r in results:
            print(r.json())

asyncio.run(main())

오류 처리

# HTTP status codes you should handle
# 400 — Bad Request (invalid params)
# 401 — Unauthorized (missing/invalid API key)
# 403 — Forbidden (insufficient permissions)
# 404 — Not Found (resource doesn't exist)
# 429 — Too Many Requests (rate limited; check Retry-After header)
# 500 — Internal Server Error

# Example error response:
{
  "error": "rate_limited",
  "message": "Rate limit exceeded. Retry after 60.",
  "status": 429
}

# Rate limit headers (on every response):
# X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

구성

클라이언트는 선택적 구성을 수락합니다:

# Configuration via environment variables or direct values
export AGENTICTRADE_API_KEY="<key_id>:<secret>"
export AGENTICTRADE_BASE_URL="https://agentictrade.io"  # default

# Or set in code:
import httpx
client = httpx.Client(
    base_url="https://agentictrade.io",
    headers={"Authorization": f"Bearer {KEY_ID}:{SECRET}"},
    timeout=30.0,
)

AGENTICTRADE_API_KEY를 환경 변수로 설정하고 생성자에서 생략할 수도 있습니다.