> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trajectory.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Ingest Events



## OpenAPI

````yaml /openapi.json post /api/v1/telemetry/events
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
servers:
  - url: https://api.trajectory.ai
security: []
paths:
  /api/v1/telemetry/events:
    post:
      tags:
        - telemetry
      summary: Ingest Events
      operationId: ingestTelemetryEvents
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TelemetryEventsIngestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TelemetryEventsIngestResponse'
        '207':
          description: Some telemetry event batches were accepted, but one or more failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TelemetryEventsIngestResponse'
        '400':
          description: No telemetry events were accepted because an event is invalid.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidTelemetryEventErrorResponse'
        '500':
          description: No telemetry events were accepted because storage failed.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/RequestId'
            Trajectory-Should-Retry:
              $ref: '#/components/headers/TrajectoryShouldRetry'
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TelemetryIngestionFailedErrorResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TelemetryEventsIngestRequest:
      properties:
        events:
          items:
            $ref: '#/components/schemas/TelemetryEventIngestRequest'
          type: array
          maxItems: 100000
          title: Events
          description: >-
            Telemetry events to ingest. A single event object may also be sent
            directly.
      type: object
      title: TelemetryEventsIngestRequest
    TelemetryEventsIngestResponse:
      properties:
        ingested:
          type: integer
          title: Ingested
          description: Number of telemetry events accepted for ingestion.
        skipped:
          type: integer
          title: Skipped
          description: Number of telemetry events skipped by validation.
          default: 0
        failures:
          items:
            $ref: '#/components/schemas/BatchItemFailure'
          type: array
          title: Failures
          description: Structured batch-level ingestion failures, if any.
      type: object
      required:
        - ingested
      title: TelemetryEventsIngestResponse
    InvalidTelemetryEventErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/InvalidTelemetryEventErrorBody'
      type: object
      required:
        - error
      title: InvalidTelemetryEventErrorResponse
    TelemetryIngestionFailedErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/TelemetryIngestionFailedErrorBody'
      type: object
      required:
        - error
      title: TelemetryIngestionFailedErrorResponse
    TelemetryEventIngestRequest:
      properties:
        event_id:
          type: string
          maxLength: 128
          minLength: 1
          title: Event Id
          description: >-
            Caller-provided unique event id used for idempotency and
            deduplication.
        event_type:
          type: string
          maxLength: 256
          minLength: 1
          title: Event Type
          description: >-
            Product-defined telemetry event name, such as 'tool_call' or
            'user_accept'.
        timestamp:
          type: string
          minLength: 1
          title: Timestamp
          description: ISO 8601 timestamp for when the event occurred.
        session_id:
          type: string
          maxLength: 512
          minLength: 1
          title: Session Id
          description: Grouping key for a broader user session, eval run, or import job.
        source:
          type: string
          maxLength: 128
          minLength: 1
          title: Source
          description: >-
            Origin of the event, such as 'sdk', 'api', 'training', or
            'synthetic'.
        user_id:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: User Id
          description: End-user identifier from the caller's system, when available.
        trajectory_id:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Trajectory Id
          description: >-
            Stored trajectory id returned by trajectory upload, when already
            known.
        trace_id:
          anyOf:
            - type: string
              maxLength: 512
            - type: 'null'
          title: Trace Id
          description: Caller-owned correlation key shared by telemetry and its trajectory.
        properties:
          additionalProperties: true
          type: object
          title: Properties
          description: Event-specific JSON properties.
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: >-
            Additional metadata for debugging, SDK versions, or ingestion
            context.
      type: object
      required:
        - event_id
        - event_type
        - timestamp
        - session_id
        - source
      title: TelemetryEventIngestRequest
    BatchItemFailure:
      properties:
        code:
          type: string
          title: Code
          description: Stable programmatic reason for this item failure.
        message:
          type: string
          title: Message
          description: Human-readable explanation for this item occurrence.
        item_index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Item Index
          description: Zero-based input index when the failed item came from a list.
        context:
          additionalProperties: true
          type: object
          title: Context
          description: Machine-readable values specific to this failure code.
      type: object
      required:
        - code
        - message
      title: BatchItemFailure
    InvalidTelemetryEventErrorBody:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: invalid_telemetry_event
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/TelemetryIngestionFailureContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: InvalidTelemetryEventErrorBody
    TelemetryIngestionFailedErrorBody:
      properties:
        type:
          type: string
          const: api_error
          title: Type
        code:
          type: string
          const: telemetry_ingestion_failed
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/TelemetryIngestionFailureContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: TelemetryIngestionFailedErrorBody
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    TelemetryIngestionFailureContext:
      properties:
        failures:
          items:
            $ref: '#/components/schemas/BatchItemFailure'
          type: array
          title: Failures
      additionalProperties: false
      type: object
      required:
        - failures
      title: TelemetryIngestionFailureContext
    ApiErrorBody:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          title: Code
          type: string
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          additionalProperties: true
          title: Context
          type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ApiErrorBody
      type: object
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      type: string
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  responses:
    ApiErrorResponse:
      description: >-
        Common API error. Possible codes: `authentication_required`,
        `permission_denied`, `validation_error`, `rate_limited`,
        `internal_error`, `service_unavailable`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestId'
        Trajectory-Should-Retry:
          $ref: '#/components/headers/TrajectoryShouldRetry'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````