BrowserStack AI Evals

Ingestion API

Batch event ingestion endpoint for traces, spans, generations, scores, and more.

Ingestion API

The ingestion endpoint accepts batches of events for asynchronous processing. This is the primary endpoint used by the SDKs to send traces, spans, generations, scores, and other events.

Batch Ingestion

POST /api/public/ingestion

Authentication: Basic auth (public+secret) or Bearer write-only key.

Content-Type: application/json

Body size limit: 5 MB per request.

Request Body

{
  "batch": [
    {
      "id": "evt-uuid-1",
      "type": "trace-create",
      "timestamp": "2026-04-03T10:00:00.000Z",
      "body": {
        "id": "trace-uuid-1",
        "name": "my-pipeline",
        "userId": "user-123",
        "sessionId": "session-abc",
        "input": { "query": "What is AI?" },
        "output": { "answer": "AI is..." },
        "metadata": { "env": "production" },
        "tags": ["production", "v2"],
        "version": "2.0.0",
        "release": "2026-04-01"
      }
    },
    {
      "id": "evt-uuid-2",
      "type": "generation-create",
      "timestamp": "2026-04-03T10:00:01.000Z",
      "body": {
        "id": "gen-uuid-1",
        "traceId": "trace-uuid-1",
        "name": "llm-call",
        "model": "gpt-4o",
        "input": [{ "role": "user", "content": "What is AI?" }],
        "output": { "role": "assistant", "content": "AI is..." },
        "usage": { "input": 10, "output": 30, "total": 40 },
        "startTime": "2026-04-03T10:00:00.100Z",
        "endTime": "2026-04-03T10:00:01.000Z"
      }
    }
  ]
}

Event Types

typeDescription
trace-createCreate or update a trace
span-createCreate a span observation
generation-createCreate a generation observation (LLM call)
event-createCreate a point-in-time event observation
score-createCreate an evaluation score
observation-updateUpdate an existing observation
sdk-logInternal SDK log event

Trace Event Body Fields

FieldTypeRequiredDescription
idstringNoTrace ID (auto-generated if omitted)
namestringNoTrace name
userIdstringNoUser identifier
sessionIdstringNoSession identifier
inputanyNoTrace input data
outputanyNoTrace output data
metadataobjectNoArbitrary metadata
tagsstring[]NoString tags
versionstringNoApplication version
releasestringNoRelease identifier
publicbooleanNoWhether trace is public
environmentstringNoEnvironment name (default: "default")

Generation Event Body Fields

FieldTypeRequiredDescription
idstringNoGeneration ID (auto-generated if omitted)
traceIdstringNoParent trace ID
parentObservationIdstringNoParent observation ID
namestringNoGeneration name
modelstringNoModel name (e.g., "gpt-4o")
modelParametersobjectNoModel parameters (temperature, max_tokens, etc.)
inputanyNoPrompt / messages
outputanyNoGenerated response
usageobjectNoToken counts: {input, output, total}
startTimeISO 8601NoStart timestamp
endTimeISO 8601NoEnd timestamp
metadataobjectNoArbitrary metadata
levelstringNoDEFAULT, DEBUG, WARNING, ERROR
versionstringNoVersion string

Response

{
  "successes": [
    { "id": "evt-uuid-1", "status": 201 },
    { "id": "evt-uuid-2", "status": 201 }
  ],
  "errors": []
}

cURL Example

curl -X POST https://evals-api.browserstack.com/api/public/ingestion \
  -u "pk-lf-...:sk-lf-..." \
  -H "Content-Type: application/json" \
  -d '{
    "batch": [
      {
        "id": "evt-001",
        "type": "trace-create",
        "timestamp": "2026-04-03T10:00:00.000Z",
        "body": {
          "id": "trace-001",
          "name": "chat-request",
          "userId": "user-123",
          "input": { "message": "Hello" }
        }
      }
    ]
  }'

OpenTelemetry Ingestion

The platform accepts OTLP (OpenTelemetry Protocol) traces over HTTP:

POST /api/public/otel/v1/traces

Content-Type: application/x-protobuf

Authentication: Same Basic auth or Bearer write-only key.

# Using the OTel Collector or SDK with OTLP HTTP exporter:
# OTEL_EXPORTER_OTLP_ENDPOINT=https://evals-api.browserstack.com/api/public/otel
# OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <base64>"

The platform maps OTLP spans to its trace/observation model automatically.


Legacy Single-Event Endpoints

These endpoints create a single event per request (used by older SDK versions):

MethodPathDescription
POST/api/public/tracesCreate a single trace
POST/api/public/scoresCreate a single score
POST/api/public/generationsCreate a generation observation
POST/api/public/spansCreate a span observation
POST/api/public/eventsCreate an event observation

These accept the same body fields as the corresponding batch event bodies. All accept write-only keys.