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

# Track an event (legacy path)

> Record a customer event against a trace or thread. Identical to `POST /api/events/track`, which is the path to use in new integrations; this one stays for callers written against it. Supply `event_id` yourself to make the call idempotent.



## OpenAPI

````yaml POST /api/track_event
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/track_event:
    post:
      tags:
        - Events
      summary: Track an event (legacy path)
      description: >-
        Record a customer event against a trace or thread. Identical to `POST
        /api/events/track`, which is the path to use in new integrations; this
        one stays for callers written against it. Supply `event_id` yourself to
        make the call idempotent.
      operationId: postApiTrack_event
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  properties:
                    event_type:
                      type: string
                    metrics:
                      type: object
                      additionalProperties:
                        type: number
                    trace_id:
                      type: string
                  required:
                    - event_type
                    - metrics
                    - trace_id
                - type: object
                  properties:
                    event_id:
                      type: string
                    event_details:
                      type: object
                      additionalProperties:
                        type: string
                        nullable: true
                    timestamp:
                      type: number
      responses:
        '200':
          description: The event was accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable confirmation
                required:
                  - message
        '400':
          description: The body was not valid JSON, or failed validation
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Set when the request was rejected before validation
                  error:
                    type: string
                    description: Set when the body parsed and then failed validation
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '403':
          description: The API key lacks traces:create
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Stable failure code; branch on this
                  message:
                    type: string
                  fault:
                    type: string
                    description: >-
                      Who the failure is attributable to: customer, platform,
                      provider
                  tips:
                    type: array
                    items:
                      type: string
                  docsUrl:
                    type: string
                required:
                  - error
                additionalProperties: true
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````