Ir al contenido

Your API

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

Your API is Mibo’s canonical trace shape, posted as plain JSON. It’s the path the n8n community node and the Flowise template use under the hood, and the right choice for any hand-rolled integration — curl, your own code, or a stack on a managed host with no OTel access.

If your stack already emits OpenTelemetry, use OTLP instead — fewer moving parts.

{
"spans": [
{
"span_id": "root-001",
"parent_span_id": null,
"name": "Restaurant Reservations Agentflow",
"start_time_unix_nano": "1717689600000000000",
"end_time_unix_nano": "1717689602450000000",
"attributes": {
"gen_ai.response.text": "Your table for 4 is booked at 8pm.",
"gen_ai.usage.input_tokens": 120,
"gen_ai.usage.output_tokens": 80,
"http.response.status_code": 200
},
"status": { "code": 1 }
}
],
"metadata": {
"environment": "production",
"version": "1.2.0"
}
}

Posted to POST /public/traces. The body has spans at the top level — there is no data wrapper.

Mibo redacts secrets in every trace before it stores it, and personal data when your workspace enables it. See Data handling.

POST https://api.mibo-ai.com/public/traces
Header Required Purpose
x-api-key Yes Your Mibo API key. See API Keys & Trace Routing.
Content-Type Yes application/json
x-request-id Recommended Trace’s external identifier — Mibo upserts by this. See Identity.
Content-Encoding No gzip for compressed bodies. Useful for large traces.
Field Required Description
spans Yes Array of canonical spans. See Span shape.
serviceName Recommended Names the Agent, like OTLP service.name. Mibo uses the Agent with this service name, or creates it. See Agent resolution.
metadata No Optional hints. Put assertion data in span attributes.
platformId No, advanced Explicit Agent UUID that overrides every other rule. Equivalent to metadata.mibo.platform_id or metadata.platformId.

Identity is header-only — externalId is read from x-request-id, never from the body.

interface CanonicalSpan {
span_id: string; // unique within the trace
parent_span_id?: string | null; // null/omit for root
name: string; // user-facing display label — see below
attributes?: Record<string, unknown>;
start_time_unix_nano?: string; // string-encoded uint64 nanoseconds
end_time_unix_nano?: string;
status?: { code?: number; message?: string }; // 1 = OK, 2 = ERROR
events?: unknown[]; // OTel-style span events; usually empty
}

span.name is the user-facing display label of the step — the label you and your end-users see in your tool (n8n workflow node display name, Flowise component label). Never the internal id, never the technical class name.

The node_call assertion does case-insensitive substring matching against span.name, so what your user sees in their tooling is what they write in their assertions.

Wire the parent graph from your tool’s execution graph. The root span has parent_span_id: null (or omit the field). Children point at their parent’s span_id. Mibo derives the trace’s start/end timing, http status, and aggregate token usage from the root span when available.

If a span is captured but its real parent was filtered out, point it at the nearest captured ancestor instead — don’t leave orphans.

  • 1 — span succeeded.
  • 2 — span errored. Mibo marks the whole trace failed if any span has status.code === 2.
  • Omitted / 0 — unset; treated as success.

These are the GenAI / HTTP semconv keys Mibo evaluates. Emit what you have; missing keys surface as missing instrumentation in the dashboard rather than silent pass/fail.

Attribute What it powers
gen_ai.output.messages Preferred response source — [{ role, parts: [{ type, content }] }]. The last assistant message’s text parts are concatenated.
gen_ai.response.text Fallback response source. Resolution: root → latest AI-orchestrator span → latest span overall.
gen_ai.input.messages User input for semantic evaluators. Latest user message wins; falls back to system, then concatenated parts. Read from the AI span.
gen_ai.prompt Fallback input source when input.messages is absent.
gen_ai.operation.name + gen_ai.request.model Set gen_ai.operation.name to chat (or generate_content, text_completion) and gen_ai.request.model to the model name on the span that calls the model. Mibo records the trace’s model from these spans. Without them the dashboard shows Model not reported.
gen_ai.system Marks the span as the AI orchestrator (biases response/input extraction toward it).
gen_ai.usage.input_tokens / gen_ai.usage.output_tokens / gen_ai.usage.reasoning.output_tokens token_limit. Read from the root, summed across descendants if absent.
gen_ai.tool.name + gen_ai.tool.call.arguments The span is attached to its parent’s tool_calls. Arguments may be JSON-stringified.
http.response.status_code http_status. Read from the root, falls back to any descendant.

You can also send your own attributes for organizational purposes (flowise.component.type, n8n.node.type, etc.). The dashboard renders them generically; assertions ignore them unless you reference them explicitly.

Mibo reads externalId from the x-request-id HTTP header:

  • Present → create-or-replace by that id. Posting again with the same x-request-id overwrites the previous trace.
  • Absent → server-generated UUID. Always creates a new trace; no idempotency.

The n8n community node uses the n8n execution id unless your workflow provides an x-request-id. The Flowise template sets it to the chatflow run id. Body fields never carry identity.

The trace is matched to a Mibo agent in this order:

  1. An explicit platformId (top level, or metadata.mibo.platform_id) always wins. This is an advanced override.
  2. If the API key is scoped to a single agent, that agent is used.
  3. Otherwise serviceName identifies the agent exactly like OTLP service.name. Mibo uses the Agent with that service name, or creates it within your plan’s Agent limit.
  4. With no identifier, a workspace key uses the workspace’s only active non-demo Agent. With no such Agent or several, the request returns 400 SERVICE_NAME_REQUIRED. A restricted key that names no allowed Agent returns 400 CUSTOM_API_PLATFORM_NOT_FOUND.

At your plan’s Agent limit, a new serviceName returns 403 AGENT_LIMIT_REACHED and Mibo stores the trace as pending, unless the pending limit is reached. A key limited to several agents matches serviceName only among those agents and never creates one.

OTLP uses the same name rule: service.name matches an agent’s Service name. It has no platformId override.

Unlike OTLP (where exporters batch partial spans across multiple POSTs), Your API ingestion is one POST carrying every span. Build the full payload synchronously, then post once. Resending with the same x-request-id replaces the previous trace — there is no merge-by-span_id on this path.

  • 201 Created — a new trace was accepted. See Passive Testing for evaluation eligibility.
  • 200 OK — an existing trace was replaced. Changed content is scheduled for evaluation again and runs shortly after the debounce period. An identical resend is not.
  • 400 VALIDATION_ERROR — your payload doesn’t match the Your API shape or is missing required fields (span_id, name, spans). Check the error details and retry with a corrected payload.
  • 400 SERVICE_NAME_REQUIRED — a workspace key named no agent and the workspace doesn’t have exactly one active non-demo agent. Mibo stores nothing. Add serviceName.
  • 400 CUSTOM_API_PLATFORM_NOT_FOUND — your API key doesn’t have access to the specified agent. Check your platformId, serviceName and API key scope.
  • 403 AGENT_LIMIT_REACHED — serviceName is new and your plan’s Agent limit is reached. The trace is held pending unless the pending limit is reached. To get the Agent, upgrade your plan or archive an Agent, then send another trace for it, then assign tests.
  • 400 TRACE_TOO_DEEP — span attributes nest more than 100 levels deep, counting JSON inside strings. Mibo does not store the trace. Flatten the nested data and retry.
  • 401 UNAUTHORIZED — API key is missing, invalid, revoked, or expired. Check your credentials.
  • 403 UNVERIFIED_TRACE_LIMIT_REACHED — the workspace owner’s email isn’t verified, and the workspace already stores 1,000 traces. Verify the owner’s email, then retry the request. If the original request included an x-request-id, reuse the same value. See Unverified workspaces.
  • 413 PAYLOAD_TOO_LARGE — your request exceeds 10 MB, compressed or decompressed. Filter verbose attributes or split large outputs out of the trace.
  • 422 TRACE_TOO_COMPLEX — the trace is too complex to accept. Simplify its structure, then retry.
  • 429 RATE_LIMIT_EXCEEDED — the API key is sending requests faster than its limit allows. Back off and retry.
  • 503 TRACE_STORE_BUSY and 503 TRACE_INGEST_BUSY — Mibo is temporarily busy. Retry with exponential backoff, as for other 500+ errors.
  • 500+ errors — transient server issue. Retry with exponential backoff (e.g., wait 1s, then 2s, then 4s). Do not treat these as validation errors; your payload may be correct.

Include the x-request-id header in all requests to make trace submission idempotent. If your network request times out or you’re unsure whether it succeeded:

  • Resend with the same x-request-id — Mibo will update the existing trace instead of creating a duplicate. No harm done.
  • Without x-request-id — every POST creates a new trace, even if it’s the same data. If you retry after a network failure, you’ll get two traces.

This is critical for systems that might retry on error (use the same x-request-id as the original failed request).

For large traces, send Content-Encoding: gzip with a gzip-compressed body. Mibo will decompress it before processing. The 10 MB limit applies to both the compressed body and the decompressed trace.

Terminal window
curl -X POST https://api.mibo-ai.com/public/traces \
-H "x-api-key: $MIBO_API_KEY" \
-H "Content-Type: application/json" \
-H "Content-Encoding: gzip" \
--data-binary @payload.json.gz
Terminal window
curl -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: chat-001" \
-d '{
"serviceName": "support-bot",
"spans": [
{
"span_id": "root-001",
"parent_span_id": null,
"name": "Restaurant Reservations Agentflow",
"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\":\"Book a table for 4 at 8pm.\"}]}]",
"gen_ai.response.text": "Your table for 4 is booked at 8pm.",
"gen_ai.usage.input_tokens": 120,
"gen_ai.usage.output_tokens": 80,
"http.response.status_code": 200
},
"status": { "code": 1 }
},
{
"span_id": "tool-001",
"parent_span_id": "root-001",
"name": "create_booking",
"attributes": {
"gen_ai.tool.name": "create_booking",
"gen_ai.tool.call.arguments": "{\"date\":\"2026-06-07\",\"time\":\"20:00\",\"party\":4}"
},
"status": { "code": 1 }
}
]
}'

A 201 response means a new trace was accepted. See Passive Testing for evaluation eligibility and timing. A 200 response means an existing trace was replaced. Changed content is scheduled for evaluation again and runs shortly after the debounce period. An identical resend is not.

Building canonical payloads from common stacks

Section titled “Building canonical payloads from common stacks”

You probably don’t need to write the JSON by hand:

For anything else, just construct the payload in your code and POST it. The shape is small enough to write inline.

The endpoint returns 400 for:

  • Missing or empty spans.
  • Span without span_id or name.
  • Body that’s neither OTLP nor Your API.
  • No serviceName or platformId on a workspace key when the workspace does not have exactly one active non-demo Agent (SERVICE_NAME_REQUIRED).
  • Attributes nested more than 100 levels deep.

Legacy proprietary shapes ({ NodeName: { output, ... } }, agentFlowExecutedData, “n8n trace push”, etc.) are not accepted. Migrate to Your API.