Endpoints
Both require an API key with the
telemetry:write scope.
Quick Setup
Set the standard OpenTelemetry environment variable to point at MeshAI:Telemetry goes to
ingest.meshai.dev, a separate host from
api.meshai.dev. That is deliberate, not a typo: ingest runs behind an
OpenTelemetry collector that absorbs large exports and splits them into smaller
batches, so a batch too big for the API in one piece is still recorded rather
than rejected. Registry, cost and governance stay on api.meshai.dev.A 200 from the ingest endpoint means your batch was accepted, not yet
stored, because the collector forwards it onward. A missing or malformed key
returns 401 immediately, but an expired key or one lacking telemetry:write
is only rejected further along. Confirm spans actually arrived in the dashboard
rather than relying on the status code.The ingest endpoint accepts OTLP protobuf (
application/x-protobuf, the stock
OTLP SDK default), OTLP JSON, and gzip-compressed bodies (Content-Encoding: gzip).
Set OTEL_EXPORTER_OTLP_PROTOCOL=http/json only if you need to force JSON.
OTEL_SERVICE_NAME sets the service.name attribute MeshAI uses to name your
auto-discovered agent. If you use a real OpenTelemetry SDK and leave it unset,
the SDK itself injects a default of unknown_service:<language> (for example
unknown_service:python). If your OTLP payload omits the service.name
resource attribute entirely, such as from a hand-rolled emitter that doesn’t
use an OTel SDK, MeshAI falls back to naming the agent unknown-agent.What Gets Extracted
When MeshAI receives trace data, it automatically:- Discovers agents from the
service.nameresource attribute (set viaOTEL_SERVICE_NAMEor your SDK’sResource). Each distinctservice.namebecomes its own agent in the registry. On the free tier only one agent is admitted: the firstservice.nameclaims the single free slot and spans from any otherservice.nameare dropped until you upgrade, so emit under oneservice.nameon the free tier and split into per-service agents once on a paid plan - Extracts token usage from
gen_ai.usage.input_tokensandgen_ai.usage.output_tokensattributes - Records model info from
gen_ai.request.modelandgen_ai.systemattributes - Registers new agents in your registry if they don’t already exist
Python Example
Using the OpenTelemetry Python SDK:Node.js Example
Framework Integration
Most agent frameworks support OpenTelemetry natively or via plugins:
Set the environment variables above and these frameworks will export traces to MeshAI automatically.
Response Format
A
200 is returned even when accepted_spans is 0. accepted_spans counts only spans that carry gen_ai.usage.input_tokens/output_tokens, so a span with no token usage is admitted (its agent is registered and appears in agents_discovered) but records nothing. If you see accepted_spans: 0 with agents_discovered of 1 or more, your agent is connected but the span carried no token usage: add the gen_ai.usage.* attributes to record cost and usage. accepted_spans: 0 with agents_discovered: 0 means the batch was dropped, usually the free-tier single-agent slot being held by a different service.name.Metrics (Preview)
The metrics endpoint (/api/v1/ingest/v1/metrics) accepts OTLP metric exports and acknowledges them. Metrics-based anomaly detection is coming in Phase 2.
