Ir al contenido

Quickstart: JSON API

Esta página aún no está disponible en tu idioma.

If your stack has no OpenTelemetry exporter, post the trace yourself. You build one JSON body with every span of a run and send it in a single request. This page sends a sample trace with curl and tests its tool call. The Your API guide is the full reference.

If your stack already emits OpenTelemetry, use OTLP instead.

  • A Mibo account with a verified email. Open the verification link in the browser you signed up with.
  • curl. The example makes no calls to a model provider.

If you own the workspace, create an API key in Settings and copy it. Mibo shows the key only once. If you’re a workspace member, ask the owner for a key.

Terminal window
export MIBO_API_KEY='<YOUR_MIBO_API_KEY>'

The body has spans at the top level. serviceName names the Agent, like service.name in OTLP. With a workspace key, Mibo creates the Agent on the first trace if your plan has a free slot. x-request-id is the trace’s identity.

Terminal window
curl -i -X POST https://api.mibo-ai.com/public/traces \
-H "Content-Type: application/json" \
-H "x-api-key: $MIBO_API_KEY" \
-H "x-request-id: order-1042-run-1" \
-d '{
"serviceName": "json-support",
"spans": [
{
"span_id": "agent-1",
"parent_span_id": null,
"name": "Support agent",
"start_time_unix_nano": "1717689600000000000",
"end_time_unix_nano": "1717689602450000000",
"attributes": {
"gen_ai.operation.name": "chat",
"gen_ai.request.model": "gpt-4o-mini",
"gen_ai.input.messages": "[{\"role\":\"user\",\"parts\":[{\"type\":\"text\",\"content\":\"What is the status of order A-1042?\"}]}]",
"gen_ai.response.text": "Order A-1042: shipped.",
"gen_ai.usage.input_tokens": 120,
"gen_ai.usage.output_tokens": 18
},
"status": { "code": 1 }
},
{
"span_id": "tool-1",
"parent_span_id": "agent-1",
"name": "lookup_order",
"attributes": {
"gen_ai.tool.name": "lookup_order",
"gen_ai.tool.call.arguments": "{\"order_id\":\"A-1042\"}"
},
"status": { "code": 1 }
}
]
}'

Set gen_ai.operation.name and gen_ai.request.model on the span that makes the model call. Without them, Mibo records no model for the trace, and Pass rate by model lists it under Model not reported.

A new trace returns 201 Created with an empty {} body and an X-Mibo-Trace-Id header.

HTTP/2 201
x-mibo-trace-id: <trace id>
{}

Open Traces, select the Agent, and find lookup_order under What the agent did.

Send the same x-request-id again and Mibo replaces the trace and answers 200 OK. Without the header, every request creates a new trace, so a retry after a timeout makes a duplicate.

  1. Click Create test from this trace.
  2. Set Name to Looks up the order and clear Checks a trace when so the test checks each new trace for this Agent.
  3. Keep the Tool call check, with Tool name lookup_order and Must call. Remove the other checks and click Save test.
  4. Send the request again with a new x-request-id. The new trace shows the result under Test results.
Item Value
Endpoint POST https://api.mibo-ai.com/public/traces
Authentication x-api-key header
Content type application/json
Identity x-request-id header. Body fields never carry identity.
Compression Content-Encoding of gzip, deflate, br or zstd is accepted.
Size limit 10 MB per request after decompression. A single trace is capped at 32 MiB.
Required span fields span_id and name. name is the label you use in node_call checks.
Optional span fields parent_span_id, attributes, start_time_unix_nano and end_time_unix_nano as strings, status and events
Span status code 1 is OK. Code 2 marks the whole trace failed.
Body fields spans, plus optional serviceName, metadata and platformId

Mibo reads the same GenAI attributes as OTLP, such as gen_ai.input.messages, gen_ai.output.messages, gen_ai.response.text, gen_ai.tool.name, gen_ai.tool.call.arguments and gen_ai.usage.*. It also recognizes the attribute names of Vercel AI SDK, OpenLLMetry, OpenInference and LangSmith spans. See Attributes Mibo reads.

This path sends one request per trace. It does not merge partial batches by span_id the way OTLP does. Build the complete trace, then post it once.

Problem Likely cause Solution
401 UNAUTHORIZED Missing, unknown, or revoked key Send a key in x-api-key. Ask the workspace owner to check that it is active.
401 API_KEY_EXPIRED The key has expired Ask the workspace owner for a new key.
400 VALIDATION_ERROR The body is not { "spans": [...] }, or a span lacks span_id or name Check the body against the example. Keep spans at the top level.
400 SERVICE_NAME_REQUIRED A workspace key named no Agent and the workspace does not have exactly one active Agent Add serviceName.
400 CUSTOM_API_PLATFORM_NOT_FOUND A restricted key cannot reach the named Agent Check serviceName and the key’s scope.
400 INVALID_JSON The decompressed body is not a JSON object Send valid JSON.
400 TRACE_TOO_DEEP Attributes nest more than 100 levels deep, counting JSON inside strings Flatten the data. Mibo stores nothing.
402 SUBSCRIPTION_REQUIRED The workspace is read-only or has no usable subscription Restore the subscription. Mibo stores nothing.
403 AGENT_LIMIT_REACHED serviceName is new and your plan’s Agent limit is reached See Agent limit reached.
403 UNVERIFIED_TRACE_LIMIT_REACHED The owner’s email is not verified and the workspace stores 1,000 traces Verify the email, then resend with the same x-request-id.
413 PAYLOAD_TOO_LARGE The body exceeds 10 MB after decompression Remove verbose attributes or split large outputs out of the trace.
413 TRACE_TOO_LARGE A single trace exceeds 32 MiB Remove verbose attributes or split large outputs out of the trace.
422 TRACE_TOO_COMPLEX The trace is too complex to accept Send a simpler trace. Retrying the same body fails again.
429 TRACE_LIMIT_REACHED or RATE_LIMIT_EXCEEDED The monthly trace quota is used, or the key is sending too fast For the monthly quota, Retry-After is the number of seconds until the period renews, so wait or upgrade. For RATE_LIMIT_EXCEEDED, back off and retry.
503 TRACE_INGEST_BUSY or TRACE_STORE_BUSY Mibo is temporarily busy Retry with backoff and the same x-request-id.