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

# Create collector batch

> Requires scopes: traces:write



## OpenAPI

````yaml /api-reference/openapi.json post /api/collector/batch
openapi: 3.1.0
info:
  title: EvalGate API
  version: 3.7.6
  description: EvalGate API. See docs/api-contract.md for stability commitments.
servers:
  - url: https://evalgate.com
    description: Production
  - url: http://localhost:3000
    description: Local
security: []
paths:
  /api/collector/batch:
    post:
      tags:
        - collector
      summary: Create collector batch
      description: 'Requires scopes: traces:write'
      operationId: post_collector_batch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostApiCollectorBatchRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiCollectorBatchResponse200ApplicationJson
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth:
            - traces:write
components:
  schemas:
    PostApiCollectorBatchRequest:
      type: object
      properties:
        traces:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              trace_id:
                type: string
              spans:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    span_id:
                      type: string
                    input:
                      $ref: '#/components/schemas/JsonValue'
                    params:
                      type: object
                      additionalProperties:
                        $ref: '#/components/schemas/JsonValue'
                    type:
                      oneOf:
                        - type: string
                          enum:
                            - default
                        - type: string
                          enum:
                            - agent
                        - type: string
                          enum:
                            - tool
                        - type: string
                          enum:
                            - retrieval
                        - type: string
                          enum:
                            - llm
                    error:
                      oneOf:
                        - type: 'null'
                        - type: object
                          properties:
                            message:
                              type: string
                            code:
                              type: string
                          additionalProperties: false
                          required:
                            - message
                    metadata:
                      type: object
                      additionalProperties:
                        $ref: '#/components/schemas/JsonValue'
                    output:
                      $ref: '#/components/schemas/JsonValue'
                    model:
                      type: string
                    metrics:
                      type: object
                      properties:
                        prompt_tokens:
                          type: number
                        completion_tokens:
                          type: number
                        total_time_ms:
                          type: number
                      additionalProperties: false
                    parent_span_id:
                      type: string
                    vendor:
                      type: string
                    timestamps:
                      type: object
                      properties:
                        started_at:
                          type: number
                        finished_at:
                          type: number
                      additionalProperties: false
                      required:
                        - started_at
                        - finished_at
                    behavioral:
                      type: object
                      additionalProperties:
                        $ref: '#/components/schemas/JsonValue'
                  additionalProperties: false
                  required:
                    - name
                    - span_id
              status:
                oneOf:
                  - type: string
                    enum:
                      - error
                  - type: string
                    enum:
                      - pending
                  - type: string
                    enum:
                      - success
              metadata:
                oneOf:
                  - type: 'null'
                  - type: object
                    additionalProperties:
                      $ref: '#/components/schemas/JsonValue'
              environment:
                oneOf:
                  - type: string
                    enum:
                      - production
                  - type: string
                    enum:
                      - dev
                  - type: string
                    enum:
                      - staging
              content_hash:
                type: string
              duration_ms:
                oneOf:
                  - type: 'null'
                  - type: number
              source:
                oneOf:
                  - type: string
                    enum:
                      - api
                  - type: string
                    enum:
                      - cli
                  - type: string
                    enum:
                      - sdk
                  - type: string
                    enum:
                      - otel
              user_feedback:
                type: object
                properties:
                  type:
                    oneOf:
                      - type: string
                        enum:
                          - rating
                      - type: string
                        enum:
                          - review_verdict
                      - type: string
                        enum:
                          - thumbs_up
                      - type: string
                        enum:
                          - thumbs_down
                      - type: string
                        enum:
                          - comment
                  value:
                    $ref: '#/components/schemas/JsonValue'
                  user_id:
                    type: string
                additionalProperties: false
                required:
                  - type
              repo_sha:
                type: string
            additionalProperties: false
            required:
              - name
              - trace_id
              - spans
      additionalProperties: false
      required:
        - traces
    PostApiCollectorBatchResponse200ApplicationJson:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              trace_id:
                type: string
              status:
                oneOf:
                  - type: string
                    enum:
                      - failed
                  - type: string
                    enum:
                      - accepted
              span_count:
                type: number
              spans_written:
                type: number
              spans_existing:
                type: number
              error:
                type: string
            additionalProperties: false
            required:
              - trace_id
              - status
        accepted:
          type: number
        failed:
          type: number
      additionalProperties: false
      required:
        - results
        - accepted
        - failed
    JsonValue:
      oneOf:
        - type: 'null'
        - type: boolean
        - type: number
        - type: string
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - VALIDATION_ERROR
                - RATE_LIMITED
                - CONFLICT
                - INTERNAL_ERROR
                - SERVICE_UNAVAILABLE
                - QUOTA_EXCEEDED
                - NO_ORG_MEMBERSHIP
                - CROSS_ORG_REFERENCE
                - INCOMPLETE
                - MALFORMED
            message:
              type: string
            details: {}
            requestId:
              type: string
              format: uuid
          required:
            - code
            - message
      required:
        - error
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Conflict:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RateLimited:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key or Session Token

````