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

# Upload Session

> Overwrite the stored JSONL for this session.

Body is raw NDJSON; the CLI sends the entire local session file each call.
Content-Length is checked before the body is read so oversized requests
are rejected without buffering bytes.



## OpenAPI

````yaml https://api.primeintellect.ai/openapi.json put /api/v1/agent-traces/sessions/{session_id}
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/v1/agent-traces/sessions/{session_id}:
    put:
      tags:
        - agent_traces
      summary: Upload Session
      description: >-
        Overwrite the stored JSONL for this session.


        Body is raw NDJSON; the CLI sends the entire local session file each
        call.

        Content-Length is checked before the body is read so oversized requests

        are rejected without buffering bytes.
      operationId: upload_session_api_v1_agent_traces_sessions__session_id__put
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: x-trace-id
          in: header
          required: false
          schema:
            type: string
            description: Root session id in the recursion tree.
            default: ''
            title: X-Trace-Id
          description: Root session id in the recursion tree.
        - name: x-parent-session
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Parent session id if this is a sub-agent session.
            title: X-Parent-Session
          description: Parent session id if this is a sub-agent session.
        - name: x-cwd
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Working directory the agent was launched from.
            title: X-Cwd
          description: Working directory the agent was launched from.
        - name: x-agent-version
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: prime-agent version string.
            title: X-Agent-Version
          description: prime-agent version string.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadSessionResponse'
        '401':
          description: Authorization failed
        '422':
          description: Invalid request data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    UploadSessionResponse:
      properties:
        session_id:
          type: string
          title: Session Id
        trace_id:
          type: string
          title: Trace Id
        bytes_stored:
          type: integer
          title: Bytes Stored
        key:
          type: string
          title: Key
          description: R2 object key the session was written to
      type: object
      required:
        - session_id
        - trace_id
        - bytes_stored
        - key
      title: UploadSessionResponse
    ErrorResponse:
      properties:
        errors:
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
          title: Errors
      type: object
      required:
        - errors
      title: ErrorResponse
    ErrorDetail:
      properties:
        param:
          type: string
          title: Param
        details:
          type: string
          title: Details
      type: object
      required:
        - param
        - details
      title: ErrorDetail
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````