Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview

Import an OTLP/JSON trace

Imports one bounded OTLP/JSON trace as a new run. The destination environment is always taken from the API key; source workspace and environment attributes are ignored.

POST/api/v2/runs/import
Authorization
AuthorizationBearer token (Anlyon API key) · headerrequired

Workspace API key sent as Authorization: Bearer <key>.

or
better-auth.session_tokenAPI key · cookierequired

Browser session used by dashboard-only operations.

Header parameters
X-Request-Idstring

Optional caller correlation ID. Unsafe or oversized values are replaced.

max length 128
Idempotency-Keystring

Stable retry key for a mutation. The key is claimed atomically before the handler runs, so concurrent retries execute the side effect at most once. Replaying the key for the same request (same method, path, workspace and JSON body) returns the original response with an X-Idempotent-Replay: true header. Reusing the key for a different request returns 409 with error code idempotency_key_reuse. A duplicate arriving while the first is still in flight waits and then replays; if the first does not finish in time the duplicate gets 409 idempotency_request_in_progress. Keys are retained for 24 hours. Only successful (2xx) responses are stored; a failed request frees the key so it can be retried.

min length 1 · max length 255
Request body
requiredapplication/json
resourceSpansOtlpResourceSpans[]required

One OTLP resource trace; at most 500 spans total are accepted.

min items 1 · max items 1
Show properties
Array of OtlpResourceSpans
resourceobject
Show properties
attributesOtlpAttribute[]
max items 100
Show properties
Array of OtlpAttribute
keystringrequired
min length 1 · max length 256
valueobject
scopeSpansobject[]required
min items 1 · max items 20
Show properties
Array of object
spansOtlpSpan[]required
max items 500
Show properties
Array of OtlpSpan
traceIdstring
max length 128
spanIdstringrequired
min length 1 · max length 128
parentSpanIdstring
min length 1 · max length 128
namestringrequired
min length 1 · max length 200
startTimeUnixNanostringrequired
max length 30 · matches ^[0-9]+$
endTimeUnixNanostring
max length 30 · matches ^[0-9]+$
statusobject
Show properties
codeinteger
min 0 · max 2
attributesOtlpAttribute[]
max items 100
Responses
201

OTLP trace imported as a new run in the API key's environment.

successbooleanrequired
Allowed:true
dataRunrequired
Show properties
idstringrequired

Public run id (run_xxx).

agentIdstring | null
agentVersionstring | null
environmentIdstring<uuid>required
namestring | nullrequired
statusstringrequired
Allowed:runningsucceededfailedcancelled
userIdstring | null
applicationstring | null
inputany | null
outputany | null
errorobject | null
tokensinteger | null
costnumber | null
tagsstring[] | null
metadataobject | null
startedAtstring<date-time>required
endedAtstring<date-time> | null
durationMsinteger | null
400

Bad Request - Invalid input data

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
401

Unauthorized - Invalid or missing API key

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
403

Authenticated credential lacks the required scope or workspace access.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST 'https://api.anlyon.com/api/v2/runs/import' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "resourceSpans": [
    {
      "resource": {
        "attributes": [
          {
            "key": "string",
            "value": {}
          }
        ]
      },
      "scopeSpans": [
        {
          "spans": [
            {
              "traceId": "string",
              "spanId": "string",
              "parentSpanId": "string",
              "name": "string",
              "startTimeUnixNano": "1760000000000000000",
              "endTimeUnixNano": "1760000001000000000",
              "status": {
                "code": 0
              },
              "attributes": [
                {
                  "key": "string",
                  "value": {}
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}'
Response
{
  "success": true,
  "data": {
    "id": "string",
    "agentId": "string",
    "agentVersion": "string",
    "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563",
    "name": "string",
    "status": "running",
    "userId": "string",
    "application": "string",
    "input": null,
    "output": null,
    "error": {},
    "tokens": 0,
    "cost": 0,
    "tags": [
      "string"
    ],
    "metadata": {},
    "startedAt": "2019-08-24T14:15:22Z",
    "endedAt": "2019-08-24T14:15:22Z",
    "durationMs": 0
  }
}