openapi: 3.0.1
info:
  title: Product Export
  version: 1.0.0
  description: Product Export API
  x-audience: external-public
  x-api-id: product-export-gateway-3634359717
  x-domain-gateway-integration:
    serviceName: product-export
    lambda:
      arn: '{{.lambdaArn}}'
  contact:
    name: Team Products Prices Promotions
    url: https://www.newstore.com
    email: team-product-prices-promotions@newstore.com
servers:
  - url: https://catalog.s.newstore.domains/catalog
  - url: https://catalog.p.newstore.domains/catalog
tags:
  - name: Product export
    description: Product Export
security:
  - oauth:
      - catalog:product-export:read
paths:
  /catalogs/{catalog}/offlineproducts:
    get:
      description: "Use this resource to download products in a file. The export can be requested in CSV.\n\n- CSV delimiter is `\\t` (tab)\n- CSV line is ended with `\\n` (end line)\n- CSV cell is escaped when containing special characters `\\t` (tab) `\\n` (new line) `\\r` (carriage return) with `\\\\t` `\\\\n` `\\\\r`\n- CSV cell is escaped with `\"` (double quote) when contain double quote originally (relevant to json fields) [RFC 4180](https://www.ietf.org/rfc/rfc4180.txt)\n\nSchema:\n- product_id (string)\n- variant_group_id (string)\n- is_available (bool) - true if product ATP > 0. This value is synchronized from Order Management. This field is eventually consistent. There is no SLA how old this value can be. Please consider using OM directly for use-cases requiring strict consistency. \n- categories (json array)\n  - path (string)\n  - position (int32)\n- main_category_path (string)\n- main_category_position (int32)\n- external_identifiers (json array)\n  - type (string)\n  - value (string)\n- extended_attributes (json array)\n  - name (string)\n  - value (string)\n- title (string)\n- brand\t(string)\n- caption (string)\n- description (string)\n- keywords (json array of strings)\n- images (json array)\n  - url (string)\n  - title (string)\n  - identifier (string)\n  - altText (string)\n  - dominantColor (string)\n  - width (int32)\n  - height (int32)\n  - aspectRatio (float32)\n  - tags (json array of strings)\n- template_id string\t\n- price (float32) price from default pricebook\n- currency (string)\t\n- country_of_origin (string)\n- tax_class_id (string)\n- preorder_start (string RFC3339 truncated to seconds)\n- online_from (string RFC3339 truncated to seconds)\n- online_to (string RFC3339 truncated to seconds)\n- variation_color_value (string)\n- variation_size_value (string)\n- variation_size_gender (string)\n- variation_size_type (string)\n- variation_size_system (string)\n- variation_size_sort_position (int32) \n- variation_additional_1_name (string)\n- variation_additional_1_value (string)\n- variation_additional_2_name (string)\n- variation_additional_2_value (string)\n- product_hts_number (string)\n- schedule_b (string)\n- shipping_dimension_height (float32)\n- shipping_dimension_length (float32)\n- shipping_dimension_unit (string)\n- shipping_dimension_width (float32)\n- shipping_weight_value (float32)\n- shipping_weight_unit (string)\n- serialized_inventory  (bool)\n- variable_pricing  (bool)\n- inventory_tracked  (bool)\n- material  (string)\n- updated_at  (int64 Unix Timestamp Milliseconds) - some products may have this value empty, value is then considered to be Thu Jan 01 1970 00:00:00 GMT+0000\n\nFiles are refreshed automatically. They are scheduled daily. Usually at 8:00 UTC. They are usually finished before 9:00 UTC.\nAPI can be used to retrieve max 1 day old snapshot of product data.\n\nResponse header `Last-Modified` can be used to determine when file was updated last time (example value `Mon, 18 Dec 2023 08:00:21 GMT`).\nResponse header `ETag` can be used to determine whether version you already downloaded before match current one. (example value `\"2ad5ba4e24fe1c0d225e9a94049f142d\"`)\nPlease use it with combination with `If-None-Match` request header to download file only when something changed.\n"
      security:
        - oauth:
            - catalog:product-export:read
      operationId: listProducts
      tags:
        - Product export
      parameters:
        - in: path
          name: catalog
          required: true
          schema:
            type: string
            minimum: 1
          description: The catalog the product, the user wants to export, belongs to.
        - in: query
          name: locale
          required: false
          schema:
            default: en-us
            type: string
            minimum: 1
          description: The locale the user wants to export. Example en-us.csv
        - in: header
          name: Accept
          required: false
          schema:
            default: text/csv
            enum:
              - text/csv
            type: string
        - in: query
          name: redirect
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            if true api will return HTTP 302 redirect to resource, otherwise it
            will return json response with link to a file.
      responses:
        '200':
          description: Response with a download link
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DownloadResponse'
        '302':
          description: Temporary redirect to actual export file, stored in S3.
          headers:
            Location:
              required: true
              description: >-
                The S3 presigned URL to redirect to, to access the requested
                product export.
              schema:
                type: string
        '400':
          description: Bad Request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden, authentication scope did not met requirements
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests
          headers:
            Retry-After:
              required: true
              description: The time in seconds after the request can be retried.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DownloadResponse:
      type: object
      required:
        - download_url
      properties:
        download_url:
          type: string
          description: >-
            The presigned URL to redirect to, to download the requested offline
            products.
    ErrorResponse:
      type: object
      required:
        - messages
        - error_code
        - request_id
      properties:
        request_id:
          type: string
        messages:
          type: array
          items:
            type: string
            example: export not found
        error_code:
          type: string
      example:
        request_id: request1234
        messages:
          - format parameter should be csv
        error_code: '400'
  securitySchemes:
    oauth:
      flows:
        clientCredentials:
          scopes:
            catalog:product-export:read: Grants privileges to export product data
          tokenUrl: >-
            https://id.{stage}.newstore.net/auth/realms/{tenant}/protocol/openid-connect/token
      type: oauth2
