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

# Create collections export

> Use this endpoint to kick off a background export job for all products in a single collection. Returns `exportId` to poll.

###### Required fields:
- `collectionId` - the collection to export.
- `catalog` - product catalog. One of `marketplace`, `swag`, `giftCards`, or `donations`.
- `locations` - array of ISO 3166-1 alpha-2 country codes for price localisation.

###### Optional fields:
- `format` - output file format. Currently `ndjson` only; defaults to `ndjson`.

###### Optional response shaping:
- `include` - related entities to include, as a JSON array. One or more of `brand`, `tags`.
- `fields` - computed / expanded fields, as a JSON array. One or more of `ranking`, `priceRange`, `variantsCount`. `ranking` is export-only (not accepted on GET product endpoints). When included, each exported product includes a `ranking` map keyed by requested location, with `merchandisingScore` per country.

###### Optional headers:
- `Snappy-Account-Id` - optional account scoping. Required when `catalog` is `swag`. Company scope comes from the API key.

###### Behavior notes:
- Returns **200 OK** immediately with `exportId`. The job runs in the background.
- Swag exports missing `Snappy-Account-Id` return **400 Bad Request** before a job is created.
- Poll `GET /v3/products/exports/{exportId}` until the job reaches a terminal state (`completed` or `failed`). On completion, the status response includes a `downloadUrls` map of signed URLs (keyed by file identifier or location code).
- The export record expires **48 hours** after creation. Download the file(s) before that - expired records cannot be re-issued; you'll need to create a new export job.
- The exported NDJSON file contains one product per line, each with its full variant list and per-country `availability`. `fields` does not control which variants are included - all variants are always exported.
- Returns `404` if the supplied `collectionId` does not exist.

#### Permissions
- Requires: `products:read`

###### Required fields:

* `collectionId` - the collection to export.
* `catalog` - product catalog to export from. One of `marketplace`, `swag`, `giftCards`, or `donations`.
* `locations` - array of ISO 3166-1 alpha-2 country codes for price localisation. We recommend up to 50 locations per job.

###### Optional fields:

* `format` - output file format. Currently `ndjson` only; defaults to `ndjson`.

###### Optional response shaping:

* `include` - related entities to include. One or more of `brand`, `tags`.
* `fields` - computed / expanded fields. One or more of `priceRange`, `variantsCount`, `ranking`. Include `ranking` to add Snappy's per-country catalog-ranking score (`merchandisingScore`, `0-100`, higher is stronger) to each product in the exported file. The score represents the product's general standing within each country's catalog and is independent of your collection context. Does not represent search relevance or position in the response.

###### Optional headers:

* `Snappy-Account-Id` - optional account scoping. Required when `catalog` is `swag` - swag exports without it return `400` before a job is created.

###### Behavior notes:

* Returns **200 OK** immediately with an `exportId`. The job runs in the background.
* Poll `GET /v3/products/exports/{exportId}` until the job reaches a terminal state (`completed` or `failed`). On completion, the status response includes a `downloadUrls` map of signed URLs (keyed by file identifier or location code).
* The exported NDJSON file contains one product per line, each with its full variant list and per-country `availability`. `fields` does not control which variants are included - all variants are always exported. See [NDJSON export format](https://docs.snappy.com/modules/api/v3/exports/overview.md#ndjson-export-format) for the full shape.
* The export record expires **48 hours** after creation. Download the file(s) before that - expired records cannot be re-issued; you'll need to create a new export job.
* Returns `404` if the supplied `collectionId` does not exist.

###### Recommended usage:

* Run each export at most once a day. Use [Webhooks](https://docs.snappy.com/pages/webhook-event-types.md) for changes between exports.
* Keep `locations` to 50 country codes or fewer per job. To cover more countries, split them across multiple export jobs.

#### Permissions

Requires: `products:read`


## OpenAPI

````yaml post /v3/collections/exports
openapi: 3.0.3
info:
  title: Snappy Public API v3
  version: 3.0.0
  contact:
    name: Snappy Support
    email: info@snappy.com
  description: >-
    Welcome to the Snappy API reference documentation!

    You can use this API to integrate with Snappy and spread smiles to your
    employees/clients/customers and much more.

    So let's get started!
servers:
  - url: https://api.snappy.com/public-api
    description: Base API URL
  - url: https://mtls-api.snappy.com/public-api
    description: >-
      ## mTLS URL

      You can also use mTLS to enhance your API security. To get your specific
      certificates please contact our support.

      Once you configure the certificated correctly, you need to also update
      endpoints to use the following secure api base URL:
security: []
tags:
  - name: Products
    description: >-
      Use these endpoints to retrieve products and tags for building catalog and
      browse experiences in your UI.
  - name: Collections
    description: >-
      Use these endpoints to retrieve products within curated collections for
      marketplace and browse experiences.
  - name: Variants
    description: >-
      Use these endpoints to retrieve variants, variant pricing, and country
      availability for orderable product SKUs.
  - name: Billing Methods
    description: >-
      A **Billing Method** is the funding source attached to an **Account** -
      for example, a Purchase Order (PO), Invoice, Prepay deposit, or Credit
      Card. Use these endpoints to retrieve billing method details such as
      remaining balance, status, and expiration.
  - name: Accounts
    description: >-
      An **Account** is a sub-entity within a **Company**, used to organize
      campaigns and gift sends. Use these endpoints to list, retrieve, and
      create accounts.
  - name: API Keys
    description: >-
      Use these endpoints to manage API keys for programmatic access. Key
      management requires company owner privileges.
  - name: Orders
    description: >-
      Use these endpoints to place, retrieve, cancel, and validate orders and
      shipping addresses.
  - name: Digital cards
    description: Use these endpoints to create, retrieve, and access digital cards.
  - name: Base products
    description: Browse swag product templates and their available variants.
  - name: Base variants
    description: Retrieve individual orderable variants of swag product templates.
  - name: Designs
    description: >-
      A **Design** is a logo-based swag design that can be applied to base
      products. Use these endpoints to retrieve your designs and their tags.
paths:
  /v3/collections/exports:
    post:
      tags:
        - Export
      summary: Create collections export
      description: >-
        Use this endpoint to kick off a background export job for all products
        in a single collection. Returns `exportId` to poll.


        ###### Required fields:

        - `collectionId` - the collection to export.

        - `catalog` - product catalog. One of `marketplace`, `swag`,
        `giftCards`, or `donations`.

        - `locations` - array of ISO 3166-1 alpha-2 country codes for price
        localisation.


        ###### Optional fields:

        - `format` - output file format. Currently `ndjson` only; defaults to
        `ndjson`.


        ###### Optional response shaping:

        - `include` - related entities to include, as a JSON array. One or more
        of `brand`, `tags`.

        - `fields` - computed / expanded fields, as a JSON array. One or more of
        `ranking`, `priceRange`, `variantsCount`. `ranking` is export-only (not
        accepted on GET product endpoints). When included, each exported product
        includes a `ranking` map keyed by requested location, with
        `merchandisingScore` per country.


        ###### Optional headers:

        - `Snappy-Account-Id` - optional account scoping. Required when
        `catalog` is `swag`. Company scope comes from the API key.


        ###### Behavior notes:

        - Returns **200 OK** immediately with `exportId`. The job runs in the
        background.

        - Swag exports missing `Snappy-Account-Id` return **400 Bad Request**
        before a job is created.

        - Poll `GET /v3/products/exports/{exportId}` until the job reaches a
        terminal state (`completed` or `failed`). On completion, the status
        response includes a `downloadUrls` map of signed URLs (keyed by file
        identifier or location code).

        - The export record expires **48 hours** after creation. Download the
        file(s) before that - expired records cannot be re-issued; you'll need
        to create a new export job.

        - The exported NDJSON file contains one product per line, each with its
        full variant list and per-country `availability`. `fields` does not
        control which variants are included - all variants are always exported.

        - Returns `404` if the supplied `collectionId` does not exist.


        #### Permissions

        - Requires: `products:read`
      operationId: postCollectionsExportAsyncV3
      parameters:
        - schema:
            type: string
            minLength: 1
            description: >-
              Optional account identifier. Scopes the request to a specific
              account. Required for swag requests on endpoints that serve swag -
              see the endpoint description.
            example: acc123456
          required: false
          description: >-
            Optional account identifier. Scopes the request to a specific
            account. Required for swag requests on endpoints that serve swag -
            see the endpoint description.
          name: snappy-account-id
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostCollectionsExportAsyncV3Body'
      responses:
        '200':
          description: >-
            Export job accepted (**200 OK**). Poll the returned `exportId` via
            `GET /v3/products/exports/{exportId}`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostCollectionsExportAsyncV3Response'
        '400':
          description: Bad Request - Invalid or missing body fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseV3'
              example:
                message: Request validation failed.
                errorCode: 400_PBLC_001
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseV3'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseV3'
        '404':
          description: Not Found - Supplied `collectionId` does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseV3'
              example:
                message: Collection not found.
                errorCode: 404_PBLC_004
      security:
        - ApiKeyAuthentication: []
components:
  schemas:
    PostCollectionsExportAsyncV3Body:
      type: object
      properties:
        collectionId:
          type: string
          pattern: ^[A-Za-z0-9]{8,}$
          description: Collection identifier.
          example: abcdef12
        catalog:
          allOf:
            - $ref: '#/components/schemas/ProductCatalogV3'
            - description: >-
                Product catalog to export from (`marketplace` | `swag` |
                `giftCards` | `donations`).
        format:
          type: string
          enum:
            - ndjson
          default: ndjson
          description: Output file format. Async export is NDJSON-only.
          example: ndjson
        locations:
          type: array
          items:
            type: string
            pattern: ^[A-Z]{2}$
          minItems: 1
          description: ISO 3166-1 alpha-2 country codes used for price localisation.
          example:
            - US
        include:
          type: array
          items:
            $ref: '#/components/schemas/ProductIncludeV3'
          minItems: 1
          description: Related entities to include.
          example:
            - brand
            - tags
        fields:
          type: array
          items:
            $ref: '#/components/schemas/ProductExportFieldsV3'
          description: >-
            Computed or expanded product fields. One or more of `priceRange`,
            `variantsCount`, `ranking`. `ranking` is export-only and is not
            accepted on GET product endpoints.
          example:
            - ranking
            - priceRange
            - variantsCount
      required:
        - collectionId
        - catalog
        - locations
      additionalProperties: false
      description: Request body for an async collection export job.
      example:
        collectionId: abcdef12
        catalog: marketplace
        format: ndjson
        locations:
          - US
        include:
          - brand
          - tags
        fields:
          - ranking
          - priceRange
          - variantsCount
    PostCollectionsExportAsyncV3Response:
      type: object
      properties:
        data:
          type: object
          properties:
            exportId:
              type: string
              description: >-
                Export job identifier. Poll `GET
                /v3/products/exports/{exportId}` until the job reaches a
                terminal state.
              example: 6650a1b2c3d4e5f6a7b8c9d0
          required:
            - exportId
      required:
        - data
      additionalProperties: false
      description: >-
        Export job accepted. The job runs in the background; poll `GET
        /v3/products/exports/{exportId}` for status.
      example:
        data:
          exportId: 6650a1b2c3d4e5f6a7b8c9d0
    ErrorResponseV3:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message.
          example: Product not found.
        errorCode:
          type: string
          description: Structured error code.
          example: 404_PROD_001
        errors:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
                example: Product with id 'q1w2e3r4t5' was not found
              path:
                type: string
                description: Dot-separated path to the field that caused the error.
                example: pathParameters.productId
              errorCode:
                type: string
                example: 404_PROD_001
            required:
              - message
              - path
          description: Optional field-level error details.
      required:
        - message
        - errorCode
      description: Standard v3 error envelope.
    ProductCatalogV3:
      type: string
      enum:
        - marketplace
        - swag
        - giftCards
        - donations
      default: marketplace
      description: >-
        Which product catalog to search. Required on product list/search
        endpoints. Defaults to marketplace.
      example: marketplace
    ProductIncludeV3:
      type: string
      enum:
        - brand
        - tags
      description: Related entities to include.
      example: brand
    ProductExportFieldsV3:
      type: string
      enum:
        - priceRange
        - variantsCount
        - ranking
      description: >-
        Computed or expanded fields for product export jobs. Same values as list
        `fields`, plus export-only `ranking`. Not accepted on GET product
        endpoints.
      example: ranking
  securitySchemes:
    ApiKeyAuthentication:
      type: apiKey
      in: header
      name: X-Api-Key
      description: |-
        ## Company Level Authentication

        Include your API key in the `X-Api-Key` header for every request:
        ```
        X-Api-Key: YOUR_API_KEY
        ```

````

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