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

# Export data by query

> Initiate data export by the given filter criteria.



## OpenAPI

````yaml exports.openapi post /oms-exports
openapi: 3.0.1
info:
  contact:
    email: support@fabric.inc
    name: fabric Support Team
  description: >-
    fabric **Exports** API supports exporting data of different modules such as
    Orders, Locations, Allocations, Inventory, Invoices, Networks,
    Shipping_Methods, and Aggregated_Networks. fabric's Exports API lets you
    export module-specific data (saved in JSON format in the database) to a zip
    file. These zip files contain different CSV files where:

    -   Each field of a single JSON schema is a file header (also called column
    title) in the CSV file

    -   Each item of the JSON schema is a row in the CSV file

    <p>The data, in the database, are arranged as nested objects and arrays
    which are complex to use. fabric's Exports API simplifies the data of a
    single object by segregating them into multiple CSV files (by specific
    identifiers) for ease of use.</p>

    <p>The following are the module (fabric service) names and its generated CSV
    files:<br/>1. Orders: order (exported by item), discount, logs, notes,
    payments, shipInfo<br/>2. Allocations: allocation, logs<br/>3. Shipments:
    shipment<br/>4. Shipping_Methods: shipping_methods<br/>5. Locations:
    location<br/>6. Invoices: invoice, appeasements, discounts, payments<br/>7.
    Inventory: inventory.</p>
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
  termsOfService: https://fabric.inc/terms-of-use
  title: Orders - Exports API
  version: 3.0.0
  x-audience: external-public
servers:
  - description: Production
    url: https://api.fabric.inc/v3
security:
  - authorization: []
tags:
  - description: >-
      fabric **Exports** API supports exporting data of different modules such
      as Orders, Locations, Allocations, Inventory, Invoices, Networks,
      Shipping_Methods, and Aggregated_Networks. fabric's Exports API lets you
      export module-specific data (saved in JSON format in the database) to a
      zip file. These zip files contain different CSV files where:

      -   Each field of a single JSON schema is a file header (also called
      column title) in the CSV file

      -   Each item of the JSON schema is a row in the CSV file

      <p>The data, in the database, are arranged as nested objects and arrays
      which are complex to use. fabric's Exports API simplifies the data of a
      single object by segregating them into multiple CSV files (by specific
      identifiers) for ease of use.</p>

      <p>The following are the module (fabric service) names and its generated
      CSV files:<br/>1. Orders: order (exported by item), discount, logs, notes,
      payments, shipInfo<br/>2. Allocations: allocation, logs<br/>3. Shipments:
      shipment<br/>4. Shipping_Methods: shipping_methods<br/>5. Locations:
      location<br/>6. Invoices: invoice, appeasements, discounts,
      payments<br/>7. Inventory: inventory.</p>
    name: Exports
externalDocs:
  description: Find out more about fabric Orders (also called OMS)
  url: https://developer.fabric.inc/v3/docs/orders-overview
paths:
  /oms-exports:
    post:
      tags:
        - Exports
      summary: Export data by query
      description: Initiate data export by the given filter criteria.
      operationId: exportData
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xFabricRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/exportRequest'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/exportLog'
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '400':
          content:
            application/json:
              example:
                errors:
                  - message: Invalid request
                    type: CLIENT_ERROR
                message: Bad request
                type: CLIENT_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '401':
          content:
            application/json:
              example:
                message: Unauthorized request
                type: CLIENT_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
        '500':
          content:
            application/json:
              example:
                message: Internal server error
                type: SERVER_ERROR
              schema:
                $ref: '#/components/schemas/errorResponse'
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponseHeader'
components:
  parameters:
    xFabricTenantId:
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
      example: 5f328bf0b5f328bf0b5f328b
      in: header
      name: x-fabric-tenant-id
      required: true
      schema:
        type: string
    xFabricChannelId:
      description: >-
        x-fabric-channel-id identifies the sales channel where the API request
        is being made; primarily for multichannel use cases. The channel ids are
        12 corresponding to US and 13 corresponding to Canada. The default
        channel id is 12. This field is required.
      example: '12'
      in: header
      name: x-fabric-channel-id
      required: true
      schema:
        type: string
    xFabricRequestId:
      description: Unique request ID
      example: 263e731c-45c8-11ed-b878-0242ac120002
      in: header
      name: x-fabric-request-id
      required: false
      schema:
        type: string
  schemas:
    exportRequest:
      description: Sample request to export module
      properties:
        csvHeadersConfig:
          description: Header name by which the module will be exported to CSV
          example: default
          type: string
        filters:
          additionalProperties:
            default: {}
            description: >-
              JSON to filter records. JSON structure should match the schema of
              the target entity such as, order, shipment, and invoice.
            example:
              createdAt: '2022-08-01T20:03:28Z'
            type: object
          default: {}
          description: >-
            JSON to filter records. JSON structure should match the schema of
            the target entity such as, order, shipment, and invoice.
          example:
            createdAt: '2022-08-01T20:03:28Z'
          type: object
        module:
          description: >-
            The module, also known as the fabric service, thAT data will be
            exported from. Accepted values are ORDER, LOCATION, LOCATION_OUTAGE,
            LOCATION_CAPACITY_OVERRIDE, ALLOCATION, INVENTORY, INVOICE,
            SHIPMENT, NETWORK, SHIPPING_METHODS, AGGREGATED_NETWORK.
          example: ORDER
          type: string
        recordFormat:
          default: CSV
          description: >-
            The file format used to export your records. The records are
            exported in a zip file that can be downloaded from the provided URL
            link and extracted. Both CSV and JSON are supported.
          enum:
            - CSV
            - JSON
          example: CSV
          type: string
        sort:
          description: Property by which data is sorted
          example: +updatedAt, +createdAt
          type: string
      required:
        - filters
        - module
        - recordFormat
      type: object
    exportLog:
      description: Export log details
      properties:
        createdAt:
          description: Time when the export operation was triggered for the first time
          example: '2022-11-22T10:26:38Z'
          format: date-time
          type: string
        csvHeadersConfig:
          description: Header name by which the module is exported to CSV
          example: default
          type: string
        exportId:
          description: Unique ID for export request
          example: order_2022-11-25T17-25-38-417225543Z
          type: string
        module:
          description: >-
            Module (fabric service) for which data is exported. Accepted values
            are ORDER, LOCATION, ALLOCATION, INVENTORY, INVOICE, SHIPMENT,
            NETWORK, SHIPPING_METHODS, AGGREGATED_NETWORK
          example: ORDER
          type: string
        recordFormat:
          default: CSV
          description: >-
            The file format used to export your records. The records are
            exported in a zip file that can be downloaded from the provided URL
            link and extracted. Both CSV and JSON are supported.
          enum:
            - CSV
            - JSON
          example: CSV
          type: string
        status:
          description: >-
            Export log status. `INITIATED`: Export request is successfully
            initiated. `PROCESSING`: Export request is accepted, and the export
            is under process. `FINISHED`: Request is successfully completed. Use
            the *GET/exports/{exportId}* endpoint to download export records.
            `SYSTEM_ERROR`: Request errored out for some reason. 
          enum:
            - INITIATED
            - PROCESSING
            - FINISHED
            - SYSTEM_ERROR
          example: INITIATED
          type: string
        totalRecordsExported:
          description: Total number of records (allocation, order, etc) exported
          example: 20
          format: int32
          type: integer
        totalRowsExported:
          description: Total number of rows exported for a record
          example: 20
          format: int32
          type: integer
        updatedAt:
          description: Time when the export operation was updated last time
          example: '2022-11-22T10:26:38Z'
          format: date-time
          type: string
        url:
          description: >-
            Download URL. The URL will be available to download only when status
            is `FINISHED`
          example: https://abc.zip
          type: string
        version:
          description: >-
            Number of updates happened to this export document. This gets
            incremented with every update that happens to the export document.
            For example, when export of data is initiated, the status is marked
            `INITIATED`, then the status gets updated to `PROCESSING`, and then
            it's marked `FINISHED`, thereby the document gets updated thrice.
            So, the version will be 3.
          example: 2
          format: int64
          type: integer
      required:
        - module
        - recordFormat
        - version
      type: object
    errorResponse:
      description: Error response
      properties:
        errors:
          description: Errors
          items:
            $ref: '#/components/schemas/errorResponse'
          type: array
        message:
          description: Error message
          example: Bad request
          type: string
        type:
          description: Error type
          example: CLIENT_ERROR
          type: string
      type: object
  headers:
    xFabricRequestIdResponseHeader:
      description: Unique request ID
      example: 263e731c-45c8-11ed-b878-0242ac120002
      required: false
      schema:
        type: string
  securitySchemes:
    authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````