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

# Create an export

> Connect a destination and schedule delivery of every closed window from startAt.



## OpenAPI

````yaml POST /v1/exports
openapi: 3.1.0
info:
  title: querying.ai
  description: >-
    One API for every AI answer engine. Every task is asynchronous: submit, then
    collect the result via webhook or polling.
  version: 1.0.0
servers:
  - url: https://api.querying.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/exports:
    post:
      tags:
        - Exports
      summary: Create an export
      description: >-
        Connects a destination and schedules every closed window from startAt.
        Writes <prefix><accountKey>/_querying/connection-check.json (or reads
        the BigQuery dataset) first; without the grant it returns 422
        EXPORT_DESTINATION_UNREACHABLE with the storage provider's reason and
        saves nothing. API keys limited to some engines get 403 KEY_SCOPE. Up to
        10 exports per account (409 EXPORT_LIMIT).
      operationId: createExport
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExportRequest'
      responses:
        '201':
          description: Created export.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/KeyScopeDenied'
        '409':
          description: 'EXPORT_LIMIT: the account already has 10 exports.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            EXPORT_DESTINATION_UNREACHABLE: the grant is missing; the message
            carries the storage provider's reason.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateExportRequest:
      type: object
      required:
        - destination
      properties:
        destination:
          $ref: '#/components/schemas/ExportDestination'
        interval:
          type: string
          enum:
            - hourly
            - daily
          default: daily
          description: Window length. Fixed for the life of the export.
        data:
          type: array
          items:
            type: string
            enum:
              - tasks
              - monitor_results
          description: 'Data sets to deliver. Default: both.'
        startAt:
          type: string
          format: date-time
          description: >-
            Deliver from the window containing this time, up to 30 days back.
            Default: now.
    ExportResponse:
      type: object
      properties:
        success:
          type: boolean
          const: true
        export:
          $ref: '#/components/schemas/Export'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorDetail'
    ExportDestination:
      type: object
      required:
        - type
      description: >-
        Where files land. S3 and GCS take bucket and an optional prefix; S3 also
        takes region and roleArn. BigQuery takes projectId and datasetId.
        Responses add path (S3, GCS) or tables and location (BigQuery).
      properties:
        type:
          type: string
          enum:
            - s3
            - gcs
            - bigquery
        bucket:
          type: string
        prefix:
          type: string
          description: Folder inside the bucket. Stored ending in /.
        region:
          type: string
          description: S3 bucket region, e.g. us-east-1.
        roleArn:
          type: string
          description: IAM role that trusts the export identity (GET /v1/exports/identity).
        projectId:
          type: string
        datasetId:
          type: string
        path:
          type: string
          readOnly: true
          description: 'Folder this account''s files land in: <prefix><accountKey>/.'
        tables:
          type: array
          items:
            type: string
          readOnly: true
        location:
          type: string
          readOnly: true
          description: BigQuery dataset location, read when connecting.
    Export:
      type: object
      properties:
        id:
          type: string
        destination:
          $ref: '#/components/schemas/ExportDestination'
        interval:
          type: string
          enum:
            - hourly
            - daily
        data:
          type: array
          items:
            type: string
            enum:
              - tasks
              - monitor_results
        enabled:
          type: boolean
        schemaVersion:
          type: integer
        nextWindowStart:
          type: string
          format: date-time
          description: Start of the first window not yet scheduled.
        createdAt:
          type: string
          format: date-time
        deliveredThrough:
          type:
            - string
            - 'null'
          format: date-time
          description: End of the latest delivered window.
        failedRuns:
          type: integer
          description: Windows that stopped after the last automatic retry.
        retryingRuns:
          type: integer
          description: Windows waiting for an automatic retry.
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable, safe to branch on. See the Errors guide for the full list.
        message:
          type: string
          description: For humans. May change.
        details:
          description: >-
            Context for the error. An array of `{field, message}` on most
            `VALIDATION_ERROR`s; an object elsewhere (for example `{id}` on
            `RESOURCE_NOT_FOUND`, `retryAfterSec` on 429 and 503 codes). Omitted
            when there is nothing to add.
          oneOf:
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
            - type: object
              additionalProperties: true
        timestamp:
          type: string
          format: date-time
  responses:
    ValidationError:
      description: >-
        The request is malformed — bad JSON, unrecognised `taskType`, or neither
        `payload.prompt` nor `payload.query` present. `details` names the
        offending field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingPrompt:
              summary: Neither prompt nor query supplied
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: payload.prompt
                      message: payload.prompt or payload.query is required
                  timestamp: '2026-07-09T04:12:00.000Z'
            badTaskType:
              summary: Unrecognised taskType
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: taskType
                      message: '''NOPE'' is not recognized'
                  timestamp: '2026-07-09T04:12:00.000Z'
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: MISSING_API_KEY
              message: Missing or invalid API key
              timestamp: '2026-07-09T04:12:00.000Z'
    KeyScopeDenied:
      description: >-
        The key is restricted to some engines (allowedTaskTypes) and the monitor
        schedules an engine outside that list. The scope that applies to POST
        /v1/async/task also applies to monitors, or a schedule would be a way
        around it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: KEY_SCOPE_DENIED
              message: This key is not allowed to use engine GEMINI
              timestamp: '2026-09-22T04:12:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.