attest Docs

API reference

Ingest OTLP traces

Verifies each span in an OTLP/HTTP JSON trace export as one event; new integrations should use POST /v1/events.

POST/v1/tracesSandbox and Production differLegacy

Overview #

Verifies each span in an OTLP/HTTP JSON trace export as one event; new integrations should use POST /v1/events.

Authenticate with an environment API key in the Authorization: Bearer header. See Authentication.

Environments. Production: each accepted span is one billed Verification Pass. Sandbox: recorded and counted, never billed.

Request · cURL
curl -X POST https://attestinfra.com/v1/traces \
  -H "Authorization: Bearer $ATTEST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceSpans": [
      {
        "scopeSpans": [
          {
            "scope": {
              "name": "my-service",
              "version": "1.4.0"
            },
            "spans": [
              {
                "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
                "spanId": "00f067aa0ba902b7",
                "name": "chat",
                "startTimeUnixNano": "1760882587120000000",
                "endTimeUnixNano": "1760882587940000000",
                "status": {
                  "code": "STATUS_CODE_OK"
                },
                "attributes": [
                  {
                    "key": "gen_ai.operation.name",
                    "value": {
                      "stringValue": "chat"
                    }
                  },
                  {
                    "key": "gen_ai.request.model",
                    "value": {
                      "stringValue": "summarizer-v2"
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }'
Request · JavaScript
const response = await fetch("https://attestinfra.com/v1/traces", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ATTEST_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "resourceSpans": [
      {
        "scopeSpans": [
          {
            "scope": {
              "name": "my-service",
              "version": "1.4.0"
            },
            "spans": [
              {
                "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
                "spanId": "00f067aa0ba902b7",
                "name": "chat",
                "startTimeUnixNano": "1760882587120000000",
                "endTimeUnixNano": "1760882587940000000",
                "status": {
                  "code": "STATUS_CODE_OK"
                },
                "attributes": [
                  {
                    "key": "gen_ai.operation.name",
                    "value": {
                      "stringValue": "chat"
                    }
                  },
                  {
                    "key": "gen_ai.request.model",
                    "value": {
                      "stringValue": "summarizer-v2"
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }),
});
console.log(response.status, await response.json());
Request · Python
import json, os, urllib.request
request = urllib.request.Request(
    "https://attestinfra.com/v1/traces",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["ATTEST_API_KEY"],
        "Content-Type": "application/json",
    },
    data=json.dumps({
        "resourceSpans": [
            {
                "scopeSpans": [
                    {
                        "scope": {
                            "name": "my-service",
                            "version": "1.4.0",
                        },
                        "spans": [
                            {
                                "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
                                "spanId": "00f067aa0ba902b7",
                                "name": "chat",
                                "startTimeUnixNano": "1760882587120000000",
                                "endTimeUnixNano": "1760882587940000000",
                                "status": {
                                    "code": "STATUS_CODE_OK",
                                },
                                "attributes": [
                                    {
                                        "key": "gen_ai.operation.name",
                                        "value": {
                                            "stringValue": "chat",
                                        },
                                    },
                                    {
                                        "key": "gen_ai.request.model",
                                        "value": {
                                            "stringValue": "summarizer-v2",
                                        },
                                    },
                                ],
                            },
                        ],
                    },
                ],
            },
        ],
    }).encode(),
)
with urllib.request.urlopen(request) as response:
    print(response.status, json.loads(response.read()))

Parameters #

NameTypeRequiredDescription
resourceSpansarray (body)Requiredundefined

Response #

200 Spans were accepted or recognized as duplicates.

Response fields #

FieldTypeDescription
accepted_spansintegerSpans that created a new record.
duplicate_spansintegerSpans already recorded in this environment.
usageobject
receiptsarrayOne signed receipt per span, in request order. For a duplicate span it is the receipt of the original acceptance.
Response · 200
{
  "accepted_spans": 1,
  "duplicate_spans": 0,
  "usage": {
    "customer_id": "79e99bf5-9836-496a-a846-9533be1c4a16",
    "environment_id": "1f7133e2-ec96-4c4c-89d1-ebdb7ca3dde3",
    "verification_passes": 1,
    "amount_usd": 0.001
  },
  "receipts": [
    {
      "status": "accepted",
      "attestation_id": "otlp_82fca850a093a09199a489ef965b5887",
      "verified_at": "2026-10-19T14:03:07.940Z",
      "payload": "{\"attestation_id\":\"otlp_82fca850a093a09199a489ef965b5887\",...}",
      "hash": "c6aacc35c6d43991c8604a21e4e20b9e12e75ca7282e66b3d9316f82f45037fd",
      "signature": "evb76MYMeNM8kbzSx5Dr4zEHu+sD655R1Tt3YAyw7RL/...",
      "signer": {
        "fingerprint": "sha256:552054128c0ca6f3fe6b6ef38e062f22593705e2e10a648a20418434f53b5e12"
      }
    }
  ]
}

Errors #

StatuserrorcodeMeaning
400Invalid OTLP payload—The body is not a valid OTLP trace export.
401Invalid API key—The API key is missing, unknown, revoked, or belongs to an environment that is not active.
413JSON payload exceeds the configured limit—The request body is larger than 1 MB.
500Trace ingestion failed—The spans could not be recorded.

All error bodies and their causes are listed in Errors.

Response · 400
{
  "error": "Invalid OTLP payload"
}
Response · 401
{
  "error": "Invalid API key"
}