API Reference

Complete reference for all Observe and Guard Gateway endpoints.

Authentication

All API requests require a Bearer token in the Authorization header:

Authorization: Bearer as_live_your_api_key_here

API keys start with as_live_ followed by 32 random characters. Get yours from the Setup tab in your agent's Observe dashboard.

Keys are hashed at rest (SHA-256) and encrypted (AES-256-GCM). They cannot be recovered — regenerate if lost.

POST /api/observe/traces/batch

Send up to 100 traces in a single batch request. This is the primary ingestion endpoint.

Request

cURL
curl -X POST https://agentscrimmage.com/api/observe/traces/batch \
  -H "Authorization: Bearer as_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "traces": [
      {
        "traceId": "unique-id",
        "sessionId": "conversation-id",
        "userId": "end-user-id",
        "timestamp": "2026-07-08T12:00:00Z",
        "type": "llm_call",
        "llm": {
          "provider": "anthropic",
          "model": "claude-sonnet-4",
          "inputMessages": [
            {"role": "user", "content": "What is my order status?"}
          ],
          "outputMessage": "Your order #1234 shipped on July 5th.",
          "inputTokens": 32,
          "outputTokens": 15,
          "latencyMs": 650
        }
      }
    ]
  }'

Required fields

FieldTypeDescription
traceIdstringUnique identifier for this trace
sessionIdstringGroups traces into conversations
typestringllm_call | tool_call | user_message | agent_response | error

Optional fields

FieldTypeDescription
userIdstringEnd-user identifier for per-user analytics
timestampstringISO 8601 timestamp. Defaults to server time if omitted.
llmobjectLLM call details: provider, model, outputMessage (required), inputMessages, inputTokens, outputTokens, latencyMs, temperature
toolobjectTool execution: name (required), arguments, result, latencyMs, success
responseobjectResponse text: text (required), latencyMs
metadataobjectArbitrary key-value pairs for custom data
retrievedContextobjectRAG grounding: documents [{content, source?, score?}], query?
availableToolsarrayAgent tools: [{name, description?, parameters?}]

Response

202 Accepted
{
  "ingested": 1,
  "flagged": 0
}

ingested — number of traces stored. flagged — number that triggered Tier 1 flags.

Limits

  • Maximum 100 traces per batch request
  • Monthly trace limit depends on your tier (5K / 25K / 100K / unlimited)
  • Returns 429 when monthly limit is reached

POST /api/observe/traces/otel

Accepts traces in OpenTelemetry OTLP JSON format. Use this if your stack already exports OTel spans (Datadog, Grafana, etc.).

Same authentication, same rate limits, same response shape as the batch endpoint. Traces are automatically converted from OTLP spans to Observe's internal format.

cURL
curl -X POST https://agentscrimmage.com/api/observe/traces/otel \
  -H "Authorization: Bearer as_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceSpans": [
      {
        "resource": {
          "attributes": [
            {"key": "session.id", "value": {"stringValue": "conv-1024"}}
          ]
        },
        "scopeSpans": [
          {
            "spans": [
              {
                "traceId": "abc123",
                "name": "llm.completion",
                "attributes": [
                  {"key": "gen_ai.system", "value": {"stringValue": "anthropic"}},
                  {"key": "gen_ai.response.model", "value": {"stringValue": "claude-sonnet-4"}},
                  {"key": "gen_ai.completion", "value": {"stringValue": "Your order shipped."}},
                  {"key": "gen_ai.usage.prompt_tokens", "value": {"intValue": "32"}},
                  {"key": "gen_ai.usage.completion_tokens", "value": {"intValue": "15"}}
                ]
              }
            ]
          }
        ]
      }
    ]
  }'

POST /api/gateway/v1/messages

The Guard Gateway intercepts LLM calls in real time. It runs Tier 1 guardrail checks before and after the LLM call, blocking or masking content that violates your PII config.

Accepts both Anthropic Messages and OpenAI Chat Completions format. Auto-detected — no configuration needed.

Anthropic format

Request
curl -X POST https://agentscrimmage.com/api/gateway/v1/messages \
  -H "Authorization: Bearer as_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "system": "You are a helpful assistant.",
    "messages": [
      {"role": "user", "content": "What is my account balance?"}
    ],
    "max_tokens": 1024
  }'

OpenAI format

Request
curl -X POST https://agentscrimmage.com/api/gateway/v1/messages \
  -H "Authorization: Bearer as_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is my account balance?"}
    ],
    "max_completion_tokens": 1024
  }'

Response headers

HeaderValues
X-Guard-Decisionallowed | blocked | mask | redact
X-Guard-FlagThe issue type that triggered the action (e.g. ssn_exposed)
X-Gateway-Generation-IdLLM provider's response ID (when available)

Decision outcomes

  • allowed — response passed all checks, returned unchanged
  • blocked — CRITICAL behavioral issue detected, response replaced with fallback message
  • mask — PII partially masked (e.g. SSN → ***-**-6789, last 4 preserved)
  • redact — PII fully removed and replaced with [REDACTED]

Custom endpoints

Connect any OpenAI-compatible provider by setting a custom endpoint URL in the Gateway tab:

ProviderEndpoint
AnthropicLeave empty (default)
OpenAILeave empty (default)
DeepSeekhttps://api.deepseek.com
Grok / xAIhttps://api.x.ai
Ollama (local)http://localhost:11434
Groqhttps://api.groq.com/openai
Together AIhttps://api.together.xyz
Mistralhttps://api.mistral.ai
vLLMYour server URL

Error Codes

CodeMeaning
202Traces accepted and queued for processing
200Gateway response returned (check X-Guard-Decision header)
400Invalid JSON, missing required fields, or batch too large (max 100)
401Missing Authorization header
403Invalid API key, disabled agent, or BYOK key exceeded failure limit
429Monthly trace or gateway limit reached — upgrade or wait for reset
502Failed to reach LLM provider (Gateway only)

Error response shape

{
  "error": "TRACE_LIMIT_REACHED",
  "message": "Monthly trace limit reached (5000/5000). Upgrade your Observe plan to continue.",
  "tier": "Free"
}

The error field is always present. message and tier are included when relevant.