> ## Documentation Index
> Fetch the complete documentation index at: https://arizeai-433a7140.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create spans

> Submit spans to be inserted into a project. If any spans are invalid or duplicates, no spans will be inserted.



## OpenAPI

````yaml post /v1/projects/{project_identifier}/spans
openapi: 3.1.0
info:
  title: Arize-Phoenix REST API
  description: Schema for Arize-Phoenix REST API
  version: '1.0'
servers: []
security: []
paths:
  /v1/projects/{project_identifier}/spans:
    post:
      tags:
        - spans
      summary: Create spans
      description: >-
        Submit spans to be inserted into a project. If any spans are invalid or
        duplicates, no spans will be inserted.
      operationId: createSpans
      parameters:
        - name: project_identifier
          in: path
          required: true
          schema:
            type: string
            description: >-
              The project identifier: either project ID or project name. If
              using a project name, it cannot contain slash (/), question mark
              (?), or pound sign (#) characters.
            title: Project Identifier
          description: >-
            The project identifier: either project ID or project name. If using
            a project name, it cannot contain slash (/), question mark (?), or
            pound sign (#) characters.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSpansRequestBody'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSpansResponseBody'
        '400':
          content:
            text/plain:
              schema:
                type: string
          description: Bad Request
        '403':
          description: Forbidden
          content:
            text/plain:
              schema:
                type: string
        '404':
          content:
            text/plain:
              schema:
                type: string
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateSpansRequestBody:
      properties:
        data:
          items:
            $ref: '#/components/schemas/Span'
          type: array
          title: Data
      type: object
      required:
        - data
      title: CreateSpansRequestBody
    CreateSpansResponseBody:
      properties:
        total_received:
          type: integer
          title: Total Received
          description: Total number of spans received
        total_queued:
          type: integer
          title: Total Queued
          description: Number of spans successfully queued for insertion
      type: object
      required:
        - total_received
        - total_queued
      title: CreateSpansResponseBody
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Span:
      properties:
        id:
          type: string
          title: Id
          description: Span Global ID, distinct from the OpenTelemetry span ID
          default: ''
        name:
          type: string
          title: Name
          description: Name of the span operation
        context:
          $ref: '#/components/schemas/SpanContext'
          description: Span context containing trace_id and span_id
        span_kind:
          type: string
          title: Span Kind
          description: Type of work that the span encapsulates
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: OpenTelemetry span ID of the parent span
        start_time:
          type: string
          format: date-time
          title: Start Time
          description: Start time of the span (must be timezone-aware)
        end_time:
          type: string
          format: date-time
          title: End Time
          description: End time of the span (must be timezone-aware)
        status_code:
          type: string
          title: Status Code
          description: Status code of the span
        status_message:
          type: string
          title: Status Message
          description: Status message
          default: ''
        attributes:
          additionalProperties: true
          type: object
          title: Attributes
          description: Span attributes
        events:
          items:
            $ref: '#/components/schemas/SpanEvent'
          type: array
          title: Events
          description: Span events
      type: object
      required:
        - name
        - context
        - span_kind
        - start_time
        - end_time
        - status_code
      title: Span
      examples:
        - attributes:
            llm.model_name: gpt-4
            llm.token_count.completion: 50
            llm.token_count.prompt: 100
          context:
            span_id: 1a2b3c4d5e6f7a8b
            trace_id: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
          end_time: '2024-01-01T12:00:01Z'
          events: []
          name: llm_call
          span_kind: LLM
          start_time: '2024-01-01T12:00:00Z'
          status_code: OK
          status_message: ''
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SpanContext:
      properties:
        trace_id:
          type: string
          title: Trace Id
          description: OpenTelemetry trace ID
        span_id:
          type: string
          title: Span Id
          description: OpenTelemetry span ID
      type: object
      required:
        - trace_id
        - span_id
      title: SpanContext
      examples:
        - span_id: 1a2b3c4d5e6f7a8b
          trace_id: a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
    SpanEvent:
      properties:
        name:
          type: string
          title: Name
          description: Name of the event
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: When the event occurred (must be timezone-aware)
        attributes:
          additionalProperties: true
          type: object
          title: Attributes
          description: Event attributes
      type: object
      required:
        - name
        - timestamp
      title: SpanEvent
      examples:
        - attributes:
            exception.message: Connection refused
          name: exception
          timestamp: '2024-01-01T12:00:00Z'

````