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

# Export Query (async)

> Submits an async export of a saved query as CSV or JSONL. Returns immediately with a job id; poll the status endpoint for the download URLs.

<span style={{display: "flex", gap: "10px", flexDirection: "row", alignItems: "center"}}>
  <img src="https://cdn.peaka.com/badges/partner-api-key-badge.png" />

  <img src="https://cdn.peaka.com/badges/project-api-key-badge.png" />
</span>


## OpenAPI

````yaml post /data/projects/{projectId}/queries/{queryId}/exports
openapi: 3.0.1
info:
  title: Peaka Gateway API
  description: Peaka Gateway API Documentation
  version: '1.0'
servers:
  - url: https://partner.peaka.studio/api/v1
    description: Default Server URL (US Zone)
  - url: https://partner.eu.peaka.studio/api/v1
    description: EU Zone
security:
  - bearerAuth: []
paths:
  /data/projects/{projectId}/queries/{queryId}/exports:
    post:
      tags:
        - Data -- Exports
      summary: Export Query (async)
      description: >-
        Submits an async export of a saved query as CSV or JSONL. Returns
        immediately with a job id; poll the status endpoint for the download
        URLs.
      operationId: exportQuery
      parameters:
        - name: projectId
          in: path
          description: ID of the Project
          required: true
          schema:
            type: string
          example: mtKDhe1U
        - name: queryId
          in: path
          description: ID of the Query
          required: true
          schema:
            type: string
          example: 709922802836177300
      requestBody:
        description: Export options
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportRequest'
            examples:
              CSV:
                description: CSV
                value:
                  format: CSV
                  columns:
                    - id
                    - created
                    - amount
              JSONL:
                description: JSONL
                value:
                  format: JSONL
              CSV + GZIP:
                description: CSV + GZIP
                value:
                  format: CSV
                  compression: GZIP
        required: true
      responses:
        '202':
          description: Export job accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportJobCreated'
              example:
                id: 4c9fcb44-126a-45f8-99a0-f1d245083d78
                status: PENDING
components:
  schemas:
    ExportRequest:
      type: object
      properties:
        format:
          type: string
          description: Output format
          example: CSV
          enum:
            - CSV
            - JSONL
          default: CSV
        limit:
          type: integer
          description: Row limit; clamped to [1, 1000000]
          format: int32
          example: 100000
        csvOptions:
          $ref: '#/components/schemas/ExportCsvOptions'
        includeSystemColumns:
          type: boolean
          description: >-
            When false, Peaka system columns (_id, _version, …) are excluded.
            Cache plumbing columns (_q_*, _cache_*) are always dropped.
          example: true
          default: true
        columns:
          type: array
          description: >-
            Explicit column selection; an unknown name yields 400. Omit to
            export all columns.
          example:
            - id
            - created
            - amount
          items:
            type: string
            description: >-
              Explicit column selection; an unknown name yields 400. Omit to
              export all columns.
            example: '["id","created","amount"]'
        compression:
          type: string
          description: >-
            Output compression; with GZIP every artifact is a gzip stream
            carrying a .gz suffix
          example: NONE
          enum:
            - NONE
            - GZIP
          default: NONE
      description: >-
        Async export request. The job is accepted (202) and runs in the
        background; the result is downloaded via presigned URLs returned by the
        status endpoint.
    ExportJobCreated:
      type: object
      properties:
        id:
          type: string
          description: Export job id
          example: 4c9fcb44-126a-45f8-99a0-f1d245083d78
        status:
          type: string
          description: Initial job status
          example: PENDING
      description: Acknowledgement returned when an export job is accepted
    ExportCsvOptions:
      type: object
      properties:
        delimiter:
          type: string
          description: Field delimiter
          example: ','
          default: ','
        quoteChar:
          type: string
          description: Quote character
          example: '"'
          default: '"'
        recordSeparator:
          type: string
          description: Record separator
          example: \n
          default: \n
        includeHeader:
          type: boolean
          description: Whether to emit a header row
          example: true
          default: true
        nullValue:
          type: string
          description: Representation of NULL values
      description: CSV formatting options (ignored for JSONL exports)
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        Use the Authorization header with the value 'Bearer <apiKey>' to
        authenticate. Partner API Keys have full access; Project API Keys are
        limited to their project scope. Learn more:
        https://docs.peaka.com/api-reference/authentication
      scheme: bearer
      bearerFormat: Api Key

````