API Reference

Base URL: https://api.gatekey.dev

All endpoints require authentication via Bearer token.

POST/v1/query

Execute a query against any data provider.

Request Body

{
  "provider": "string",   // Required. Provider slug (e.g., "sec-edgar")
  "endpoint": "string",   // Required. Provider endpoint path
  "params": {             // Optional. Query parameters
    "key": "value"
  }
}

Response

{
  "data": { ... },        // Provider-specific response
  "meta": {
    "request_id": "string",
    "provider": "string",
    "endpoint": "string",
    "tokens_used": 1234,
    "latency_ms": 250
  }
}

Example

curl -X POST https://api.gatekey.dev/v1/query \
  -H "Authorization: Bearer gk_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "sec-edgar",
    "endpoint": "/search-index",
    "params": { "q": "tesla 10-K" }
  }'
GET/v1/providers

List all available data providers.

Response

{
  "data": [
    {
      "slug": "sec-edgar",
      "name": "SEC EDGAR",
      "description": "...",
      "category": "financial",
      "endpoints": [
        {
          "path": "/search-index",
          "method": "GET",
          "description": "Search SEC filings",
          "params_schema": { ... }
        }
      ]
    }
  ]
}

Example

curl https://api.gatekey.dev/v1/providers \
  -H "Authorization: Bearer gk_live_xxx"
GET/v1/usage

Get usage statistics for your account.

Query Parameters

ParameterTypeDescription
start_datestringStart date (YYYY-MM-DD)
end_datestringEnd date (YYYY-MM-DD)
group_bystringday, week, month, or provider

Response

{
  "data": {
    "period": {
      "start_date": "2024-01-01",
      "end_date": "2024-01-31"
    },
    "totals": {
      "tokens": 125000,
      "requests": 450,
      "cost_cents": 0
    },
    "current_month": {
      "tokens_used": 45000,
      "tokens_remaining": 55000,
      "monthly_limit": 100000
    },
    "breakdown": [
      { "date": "2024-01-15", "tokens": 5000, "requests": 20 }
    ]
  }
}
GET/v1/usage/current

Get current billing period usage summary.

Response

{
  "data": {
    "period": "2024-01",
    "total_tokens": 45000,
    "monthly_token_limit": 100000,
    "tokens_remaining": 55000,
    "current_rpm": 12,
    "rpm_limit": 60
  }
}
GET/v1/health

Check API health status. No authentication required.

Response

{
  "status": "healthy",
  "version": "0.1.0",
  "timestamp": "2024-01-15T12:00:00Z"
}

HTTP Status Codes

StatusDescription
200Success
400Bad request (invalid parameters)
401Unauthorized (invalid or missing API key)
404Not found (provider or endpoint doesn't exist)
422Validation failed (invalid params for endpoint)
429Rate limit exceeded
502Bad gateway (provider error)
503Service unavailable (circuit breaker open)
504Gateway timeout (provider took too long)