components:
  headers:
    page-next.header:
      description: Next value for X-Page-Continue, for more results
      schema:
        type: string
  parameters:
    document-type.param:
      description: Type of document to download
      in: path
      name: documentType
      required: true
      schema:
        $ref: '#/components/schemas/shipment-document-type.schema'
    invoice-id.param:
      description: Invoice ID
      in: path
      name: invoiceId
      required: true
      schema:
        example: 64e4d5e837572a4813b73e40
        type: string
    page-continue.param:
      description: Page marker, from X-Page-Next header
      example: 64df700931a04885276c3364
      in: header
      name: X-Page-Continue
      schema:
        type: string
    page-size.param:
      description: Page size, defaults to 20
      example: 20
      in: header
      name: X-Page-Size
      schema:
        type: integer
    return-id.param:
      description: Return ID
      in: path
      name: returnId
      required: true
      schema:
        example: 64e4d5e837572a4813b73e40
        type: string
    shipment-id.param:
      description: Shipment ID
      in: path
      name: shipmentId
      required: true
      schema:
        example: 67c7e87a2c8c262c0ddc9861
        type: string
    store-id.param:
      description: Store ID
      in: path
      name: storeId
      required: true
      schema:
        example: 64e5a8a1af49a89df37e4ee7
        type: string
    updated-at-max.param:
      description: Maximum updated time, exclusive
      example: '2000-02-01T00:00:00Z'
      in: query
      name: updated_at_max
      schema:
        format: date-time
        type: string
    updated-at-min.param:
      description: Minimum updated time, inclusive
      example: '2000-01-01T00:00:00Z'
      in: query
      name: updated_at_min
      schema:
        format: date-time
        type: string
    webhook-id.param:
      description: Webhook ID
      in: path
      name: webhookId
      required: true
      schema:
        example: 64e5a865a58eefeed7f05ea6
        type: string
  schemas:
    address.schema:
      description: Address.
      properties:
        city:
          description: City name
          examples:
            - Anytown
          title: City
          type: string
        country:
          description: Country code
          examples:
            - US
            - CA
          title: Country
          type: string
        line1:
          description: Line 1
          examples:
            - 123 Main St
          title: Line 1
          type: string
        line2:
          default: ''
          description: Line 2
          examples:
            - ''
          title: Line 2
          type: string
        postalCode:
          description: Postal or ZIP code
          examples:
            - '12345'
          title: Postal code
          type: string
        state:
          description: State or province
          examples:
            - WA
            - Washington
          title: State
          type: string
      required:
        - city
        - country
        - line1
        - state
        - postalCode
      title: Address
      type: object
    comment.schema:
      description: Comment with either message or image.
      examples:
        - message: Item is worn.
        - image: eJxiYAEAAAD//wMAAAYABQ==
      oneOf:
        - properties:
            image:
              contentEncoding: base64
              description: Base64-encoded image
              title: Image
              type: string
          title: Image comment
          type: object
        - properties:
            message:
              description: Message.
              title: Message
              type: string
          title: Message comment
          type: object
      title: Comment
    coverage-product.schema:
      description: Coverage product.
      properties:
        coverages:
          description: Coverage.
          items:
            properties:
              lineItems:
                items:
                  properties:
                    id:
                      description: Line item ID.
                      title: ID
                      type: string
                  type: object
                type: array
              type:
                enum:
                  - shipping_failure
                  - return_shipping
                title: Coverage
            required:
              - lineItems
              - type
            type: object
          type: array
        id:
          description: Coverage ID.
          title: ID
          type: string
        price:
          $ref: '#/components/schemas/money.schema'
          description: Price.
          title: Price
      required:
        - coverage
        - id
        - price
      title: Coverage product
      type: object
    error.schema:
      description: Problem details. See [RFC 7807 Section 3](https://datatracker.ietf.org/doc/html/rfc7807#section-3).
      properties:
        detail:
          description: Human-readable description of the problem.
          title: Detail
          type: string
        instance:
          description: A URI reference that identifies this problem.
          format: uri-reference
          type: string
        title:
          description: Human-readable summary of the problem type.
          title: Title
          type: string
        type:
          default: about:blank
          description: A URI reference that identifies the problem type.
          format: uri-reference
          type: string
      title: Problem details
      type: object
    exchange-provision.schema:
      enum:
        - instant
        - deferred
      example: deferred
      title: Exchang provision
      type: string
    https-callback.schema:
      description: HTTPS callback
      properties:
        auth:
          description: Authorization.
          oneOf:
            - properties:
                bearer:
                  description: Bearer
                  properties:
                    token:
                      description: Token for Bearer authorization.
                      example: abc123
                      format: password
                      title: Token
                      type: string
                  title: Bearer
              title: Bearer authorization
              type: object
            - type: 'null'
          title: Authorization
        url:
          description: HTTPS callback URL.
          example: https://subscriber.example.org/events
          format: uri
          pattern: ^https://
          title: URL
          type: string
      required:
        - auth
        - url
      title: HTTPS callback
      type: object
    invoice.schema:
      description: Schema for an invoice.
      properties:
        charge:
          $ref: '#/components/schemas/money.schema'
          description: The charge that the invoice is for.
        createdAt:
          description: The time the invoice was created.
          format: date-time
          type: string
        id:
          description: The ID of the charge.
          type: string
        status:
          description: The status of the invoice.
          type: string
        store:
          properties:
            id:
              description: The ID of the store.
              type: string
          required:
            - id
          type: object
        updatedAt:
          description: The time the invoice was last updated.
          format: date-time
          type: string
      required:
        - team
        - updatedAt
        - status
        - createdAt
        - charge
      type: object
    item-quantity.schema:
      description: Item quantity.
      example: 1
      exclusiveMinimum: 0
      title: Item quantity
      type: number
    length.schema:
      description: Length measurement with unit.
      properties:
        unit:
          description: Length unit
          enum:
            - in
            - cm
          examples:
            - in
            - cm
          title: Unit
          type: string
        value:
          description: Numeric length value
          examples:
            - 10.5
            - 30
          minimum: 0
          title: Value
          type: number
      required:
        - value
        - unit
      title: Length
      type: object
    money.schema:
      description: Currency amount
      properties:
        amount:
          examples:
            - '50.2'
            - '1.78'
          title: Amount
          type: string
        currency:
          examples:
            - USD
            - EUR
          title: Currency
          type: string
      title: Money
      type: object
    order-read.schema:
      description: Order.
      properties:
        customer:
          properties:
            emailAddress:
              description: Email address of customer.
              format: email
              title: Email address
              type: string
            name:
              $ref: '#/components/schemas/person-name.schema'
              description: Name of customer.
              title: Name
            phoneNumber:
              $ref: '#/components/schemas/phone-number.schema'
              description: Phone number of customer.
              title: Phone number
          required:
            - name
          type: object
        externalId:
          description: Shopify ID
          examples:
            - '1073459971'
            - '450789469'
          title: External ID
          type: string
        id:
          description: Order ID
          example: 64e4da943dd822979a70bd12
          title: ID
          type: string
        items:
          items:
            properties:
              externalId:
                example: '123'
                type: string
              fulfillmentLocationId:
                description: ID of the location where the item was be fulfilled.
                example: '123'
                type:
                  - string
                  - 'null'
              id:
                description: Line item ID
                title: ID
                type: string
              price:
                $ref: '#/components/schemas/money.schema'
                title: Price
              product:
                $ref: '#/components/schemas/product.schema'
                title: Product
              quantity:
                $ref: '#/components/schemas/item-quantity.schema'
                title: Quantity
              variant:
                $ref: '#/components/schemas/product-variant.schema'
                title: Variant
            required:
              - id
              - product
              - quantity
              - variant
              - price
              - fulfillmentLocationId
          title: Line items
          type: array
        name:
          description: Shopify name.
          examples:
            - '#123'
          title: Name
          type: string
      required:
        - customer
        - id
        - items
        - name
      title: Order
      type: object
    parcel-type.schema:
      description: Parcel type enum.
      enum:
        - box
        - envelope
        - soft_pack
      title: Parcel Type
      type: string
    parcel.schema:
      description: Parcel information for shipping.
      properties:
        height:
          $ref: '#/components/schemas/length.schema'
        length:
          $ref: '#/components/schemas/length.schema'
        type:
          $ref: '#/components/schemas/parcel-type.schema'
        weight:
          $ref: '#/components/schemas/shipping-weight.schema'
        width:
          $ref: '#/components/schemas/length.schema'
      required:
        - height
        - length
        - width
        - weight
        - type
      title: Parcel
      type: object
    person-name.schema:
      description: Person name.
      properties:
        given:
          description: Given name
          examples:
            - John
            - Mary
          type: string
        surname:
          description: Surname
          examples:
            - Smith
            - Brown
          type: string
      required:
        - given
        - surname
      title: Person name
      type: object
    phone-number.schema:
      description: Phone number, in E.164 format
      examples:
        - '+15555555555'
      title: Phone number
      type: string
    product-variant.schema:
      properties:
        externalId:
          title: External ID
          type: string
        name:
          title: Title
          type: string
        sku:
          title: SKU
          type: string
        weight:
          $ref: '#/components/schemas/weight.schema'
          title: Weight
      required:
        - name
      title: Product variant
      type: object
    product.schema:
      description: Product.
      properties:
        externalId:
          description: Product ID in external system (e.g. shopify).
          title: External ID
          type: string
        name:
          description: Product title
          title: Name
          type: string
      required:
        - name
      title: Product
      type: object
    return-read.schema:
      description: Return read.
      properties:
        createdAt:
          description: Time of creation.
          format: date-time
          title: Created at
          type: string
        destination:
          properties:
            mailingAddress:
              $ref: '#/components/schemas/address.schema'
              description: Mailing address to send the returned items.
              title: Mailing address
            phoneNumber:
              $ref: '#/components/schemas/phone-number.schema'
              description: Phone number of the destination.
              title: Phone number
          type: object
        exchange:
          description: Exchange order
          properties:
            items:
              items:
                properties:
                  id:
                    title: ID
                    type: string
                  product:
                    $ref: '#/components/schemas/product.schema'
                    title: Product
                  quantity:
                    $ref: '#/components/schemas/item-quantity.schema'
                    title: Quantity
                  variant:
                    $ref: '#/components/schemas/product-variant.schema'
                required:
                  - id
                  - quantity
                  - product
                  - variant
              title: Line items
              type: array
            order:
              properties:
                externalId:
                  description: ID of external order
                  title: External ID
                  type: string
                id:
                  type: string
              type: object
            provision:
              $ref: '#/components/schemas/exchange-provision.schema'
              title: Provision
          required:
            - items
            - provision
          title: Exchange
          type: object
        giftCards:
          description: Gift card(s) created for return
          items:
            properties:
              amount:
                $ref: '#/components/schemas/money.schema'
                title: Amount
              code:
                description: Gift card 16 digit code.
                title: Code
                type: string
              externalId:
                description: Gift card ID.
                title: ID
                type: string
            required:
              - amount
              - code
              - externalId
            type: object
          title: Gift cards
          type: array
        id:
          description: Return identifier.
          examples:
            - 64df65d4c5a4ca3eff4b4e43
          title: Identifier
          type: string
        items:
          description: Return items
          items:
            properties:
              exchangeItem:
                properties:
                  id:
                    description: ID of exchange line item
                    title: ID
                    type: string
                required:
                  - string
                title: Exchange item
                type: object
              id:
                description: Return item ID.
                title: ID
                type: string
              orderItem:
                description: Order line item
                properties:
                  id:
                    description: 'Line item ID in original order. Note: There can be more than return item for an original line item, with different quantity, return reasons, etc.'
                    title: ID
                    type: string
                required:
                  - index
                title: Order item
                type: object
              quantity:
                $ref: '#/components/schemas/item-quantity.schema'
                title: Quantity
              reason:
                description: Return reason
                examples:
                  - Too big
                  - Other
                type: string
              refund:
                description: Refund
                properties:
                  amount:
                    $ref: '#/components/schemas/money.schema'
                    title: Amount
                  pendingAmount:
                    $ref: '#/components/schemas/money.schema'
                    title: Planned amount
                  pendingTaxAmount:
                    $ref: '#/components/schemas/money.schema'
                    description: Taxes.
                    title: Taxes
                  taxAmount:
                    $ref: '#/components/schemas/money.schema'
                    description: Taxes.
                    title: Taxes
                  type:
                    description: Refund method
                    enum:
                      - credit
                      - refund
                    type: string
                required:
                  - amount
                  - pendingAmount
                  - pendingTaxAmount
                  - taxAmount
                  - type
                type: object
            required:
              - item
              - quantity
              - reason
            type: object
          type: array
        order:
          description: Original order.
          properties:
            id:
              description: Order ID.
              example: abc123
              title: ID
              type: string
          required:
            - id
          title: Order
          type: object
        shipment:
          description: Shipment, if has been made
          properties:
            carrier:
              description: Carrier code
              title: Carrier
              type: string
            status:
              description: Status of shipment
              enum:
                - pre_transit
                - transit
                - delivered
                - cancelled
                - flagged
              title: Status
              type: string
            tracker:
              description: Tracking number
              title: Tracker
              type: string
          title: Shipment
          type: object
        source:
          properties:
            emailAddress:
              description: Email address.
              format: email
              title: Email address
              type: string
            mailingAddress:
              $ref: '#/components/schemas/address.schema'
              description: Mailing address returned items are sent from.
              title: Mailing address
            name:
              $ref: '#/components/schemas/person-name.schema'
              description: Name of returner.
              title: Name
            phoneNumber:
              $ref: '#/components/schemas/phone-number.schema'
              description: Phone number of returner.
              title: Phone number
          required:
            - emailAddress
            - mailingAddress
            - name
            - phoneNumber
          type: object
        status:
          $ref: '#/components/schemas/return-status.schema'
          description: Return status.
          title: Status
        type:
          $ref: '#/components/schemas/return-type.schema'
          description: Return type.
          title: Type
        updatedAt:
          description: Time of last update.
          format: date-time
          title: Updated at
          type: string
      required:
        - createdAt
        - destination
        - giftCards
        - source
        - id
        - order
        - items
        - status
        - updatedAt
      title: Return
      type: object
    return-status-update.schema:
      description: |
        Return status.

        * complete: The return has been completed successfully.
        * open: Return has been approved and is awaiting shipment.
        * flagged: A problem with return processing requires merchant action.
        * rejected: The return has been rejected.
        * deleted: The return has been reset.
      enum:
        - complete
        - open
        - flagged
        - rejected
        - deleted
      example: open
      title: Return status
      type: string
    return-status.schema:
      description: |
        Return status.

        * open: Return has been approved and is awaiting shipment.
        * in_transit: Return shipment is in transit.
        * delivered: Return shipment has been delivered and awaiting processing.
        * needs_review: Return requires review before further action.
        * in_review: Return is currently being reviewed.
        * complete: The return has been completed successfully.
        * rejected: The return has been rejected.
        * flagged: A problem with return processing requires merchant action.
        * pre_shipment: Return requires pre-shipment merchant authorization.
        * deleted: The return has been deleted (Reset).
      enum:
        - open
        - in_transit
        - delivered
        - needs_review
        - in_review
        - complete
        - rejected
        - flagged
        - pre_shipment
        - deleted
      example: open
      title: Return status
      type: string
    return-type.schema:
      description: |
        Return type.
      enum:
        - claim
        - return
        - warranty
      example: return
      title: Return type
      type: string
    shipment-document-type.schema:
      description: Type of shipping document.
      enum:
        - label
        - commercialInvoice
      title: Shipment Document Type
      type: string
    shipment-document.schema:
      description: Shipping document information.
      properties:
        type:
          $ref: '#/components/schemas/shipment-document-type.schema'
      required:
        - type
      title: Shipment Document
      type: object
    shipment-rate.schema:
      description: Shipping rate information.
      properties:
        carrier:
          properties:
            id:
              description: ID for the carrier account that provides the shipping rate.
              title: Carrier Account ID
              type: string
            name:
              description: Carrier display name
              examples:
                - USPS
                - FedEx
              title: Carrier Name
              type: string
          required:
            - id
            - name
          type: object
        price:
          $ref: '#/components/schemas/money.schema'
        service:
          properties:
            name:
              description: Service level name
              examples:
                - Priority
                - Ground
              title: Service Name
              type: string
          required:
            - name
          type: object
      required:
        - carrier
        - price
        - service
      title: Shipment Rate
      type: object
    shipment-tracker.schema:
      description: Shipment tracking information.
      properties:
        code:
          description: Carrier tracking code
          examples:
            - '9400100000000000000000'
          title: Tracking Code
          type: string
      required:
        - code
      title: Shipment Tracker
      type: object
    shipment.schema:
      description: Shipment information.
      properties:
        documents:
          description: Available shipping documents. You can access these documents using the GET Shipment document endpoint.
          items:
            $ref: '#/components/schemas/shipment-document.schema'
          title: Documents
          type: array
        id:
          description: Shipment identifier
          title: Shipment ID
          type: string
        price:
          $ref: '#/components/schemas/money.schema'
        tracker:
          $ref: '#/components/schemas/shipment-tracker.schema'
      required:
        - id
        - documents
        - tracker
        - price
      title: Shipment
      type: object
    shipping-contact.schema:
      description: Contact information for shipping.
      properties:
        address:
          $ref: '#/components/schemas/address.schema'
        name:
          description: Contact name
          examples:
            - John Doe
          title: Name
          type: string
        phoneNumber:
          description: Contact phone number
          examples:
            - '+12025550123'
          title: Phone Number
          type: string
      required:
        - name
        - phoneNumber
        - address
      title: Shipping Contact
      type: object
    shipping-weight.schema:
      description: Weight measurement with unit for shipping.
      properties:
        unit:
          description: Weight unit
          enum:
            - g
            - kg
            - oz
            - lb
          examples:
            - lb
            - kg
          title: Unit
          type: string
        value:
          description: Numeric weight value
          examples:
            - 1.5
            - 10
          minimum: 0
          title: Value
          type: number
      required:
        - value
        - unit
      title: Shipping Weight
      type: object
    storefront-cart.schema:
      description: Storefront cart.
      properties:
        lineItems:
          description: Line items.
          items:
            properties:
              coupons:
                items:
                  properties:
                    code:
                      type: string
                    discountAmount:
                      $ref: '#/components/schemas/money.schema'
                      description: The amount this coupon discounts in dollars for this line item.
                    id:
                      type: string
                  required:
                    - id
                    - code
                    - discountAmount
                  type: object
                type: array
              id:
                description: Line item ID.
                title: ID
                type: string
              originalPrice:
                $ref: '#/components/schemas/money.schema'
                description: Original price.
                title: Original Price
              priceTotal:
                $ref: '#/components/schemas/money.schema'
                description: Total price.
                title: Price
              product:
                description: Product.
                properties:
                  id:
                    title: ID
                    type: string
                required:
                  - id
                type: object
              quantity:
                description: Quantity.
                title: Quantity
                type: integer
              variant:
                description: Variant.
                properties:
                  id:
                    title: ID
                    type: string
                required:
                  - id
                type: object
            required:
              - id
              - quantity
              - product
              - variant
              - priceTotal
            type: object
          title: Line items
          type: array
        priceTotal:
          $ref: '#/components/schemas/money.schema'
          description: Total price.
          title: Price
      required:
        - lineItems
      title: Storefront Cart
      type: object
    storefront-customer.schema:
      description: Storefront customer.
      properties:
        id:
          description: Customer ID.
          title: ID
          type: string
      required:
        - id
      title: Storefront Customer
      type: object
    storefront-event.schema:
      additionalProperties: true
      description: Shopify pixel event for storefront tracking.
      properties:
        anonymousId:
          description: Anonymous identifier for users without account.
          type: string
        cart:
          description: Cart information.
          type:
            - object
            - 'null'
        cartLine:
          description: Information about specific cart line item.
          type: object
        checkout:
          description: Checkout information.
          type: object
        collection:
          description: Collection information.
          type: object
        customer:
          description: Customer information if available.
          type:
            - object
            - 'null'
        customerEmail:
          description: Customer email if available.
          format: email
          type: string
        customerPhone:
          description: Customer phone if available.
          type: string
        eventId:
          description: Unique identifier for the event.
          type: string
        eventName:
          description: Name of the Shopify pixel event.
          enum:
            - product_added_to_cart
            - product_removed_from_cart
            - product_viewed
            - checkout_started
            - checkout_completed
            - checkout_contact_info_submitted
            - page_viewed
            - collection_viewed
          type: string
        productVariant:
          description: Product variant information.
          type: object
        source:
          description: Source of the event.
          enum:
            - AIMERCE
          type: string
        timestamp:
          description: ISO 8601 timestamp when the event occurred.
          format: date-time
          type: string
        urlWithParams:
          description: Complete page URL with query parameters.
          type: string
        urlWithoutParams:
          description: Page URL without query parameters.
          type: string
      required:
        - eventName
        - eventId
        - timestamp
        - source
      title: Storefront Event
      type: object
    webhook-create.schema:
      description: Webhook create.
      properties:
        backfill:
          default: false
          description: Create events for already-existing items
          title: Backfill
          type: boolean
        callback:
          $ref: '#/components/schemas/https-callback.schema'
          description: HTTPS callback to POST events.
          title: HTTPS callback
        externalId:
          default: null
          description: Optional external identifier.
          title: External ID
          type:
            - string
            - 'null'
        kind:
          $ref: '#/components/schemas/webhook-kind.schema'
          description: Kind.
          title: Kind
        topic:
          $ref: '#/components/schemas/webhook-topic.schema'
          description: Topic.
          title: Topic
      required:
        - callback
        - topic
      title: Webhook create
      type: object
    webhook-kind.schema:
      description: Webhook kind.
      enum:
        - redo
        - loop
      title: Webhook kind
      type: string
    webhook-read.schema:
      description: Webhook read.
      properties:
        callback:
          $ref: '#/components/schemas/https-callback.schema'
          description: HTTPS callback URL to POST events.
          title: Callback
        createdAt:
          description: Time created.
          format: date-time
          title: Created at.
          type: string
        externalId:
          default: null
          description: Optional external identifier.
          title: External ID
          type:
            - string
            - 'null'
        id:
          description: Webhook ID.
          readonly: true
          title: ID
          type: string
        kind:
          $ref: '#/components/schemas/webhook-kind.schema'
          description: Kind.
          title: Kind
        topic:
          $ref: '#/components/schemas/webhook-topic.schema'
          description: Topic.
          title: Topic
        updatedAt:
          description: Last time updated.
          format: date-time
          title: Updated at.
          type: string
      required:
        - callback
        - createdAt
        - externalId id
        - updatedAt
        - topic
      title: Webhook read
      type: object
    webhook-topic.schema:
      description: Webhook topic.
      enum:
        - return
      title: Webhook topic
      type: string
    webhook-update.schema:
      description: Webhook update.
      properties:
        callback:
          $ref: '#/components/schemas/https-callback.schema'
          description: HTTPS callback to POST events.
          title: HTTPS callback
        externalId:
          default: null
          description: Optional external identifier.
          title: External ID
          type:
            - string
            - 'null'
      required:
        - callback
      title: Webhook update
      type: object
    weight.schema:
      description: Weight.
      properties:
        kg:
          description: Weight in kilograms
          examples:
            - 0.021
            - 1.4
          minimum: 0
          title: Kilograms
          type: number
      title: Weight
      type: object
  securitySchemes:
    Bearer:
      scheme: Bearer
      type: http
    UserBearer:
      scheme: Bearer
      type: http
info:
  contact:
    email: engineering-admin@getredo.com
    name: Redo Engineering
  description: |
    ## Endpoints

    Endpoints are authenticated using the Bearer authorization scheme, using the
    REDO_API_SECRET.

    ```txt
    GET /v2.2/resource HTTP/1.1
    Authorization: Bearer 77bb7598b7a972475cc7c7e171ec33af
    Host: api.getredo.com
    ```

    ## Webhooks

    Webhooks are authenticated using the Bearer authorization scheme, using
    a secret supplied by the subscriber.

    ```txt
    POST /events HTTP/1.1
    Authorization: Bearer subscriberauth123
    Host: subscriber.example.com
    ```

    Webhook events are delivered in order for each individual subject (e.g.
    return).

    If the response is not a 2xx status code, the event will be retried multiple
    times before discarding it.
  title: Redo API
  version: 2.2.1
openapi: 3.1.0
paths:
  /invoices/pending/items.csv:
    description: Return invoice CSV file.
    get:
      description: Get an invoice as a CSV.
      operationId: Invoice pending csv get
      responses:
        '200':
          content:
            text/csv:
              schema:
                format: binary
                type: string
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Get pending invoice
      tags:
        - Invoice
    summary: Pending invoice
  /invoices/{invoiceId}/items.csv:
    description: Return invoice CSV file.
    get:
      description: Get an invoice as a CSV.
      operationId: Invoice csv get
      parameters:
        - $ref: '#/components/parameters/invoice-id.param'
      responses:
        '200':
          content:
            text/csv:
              schema:
                format: binary
                type: string
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Get invoice
      tags:
        - Invoice
    summary: Invoice
  /returns/{returnId}:
    description: Return.
    get:
      description: Get return.
      operationId: Return get
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  order:
                    $ref: '#/components/schemas/order-read.schema'
                  return:
                    $ref: '#/components/schemas/return-read.schema'
                required:
                  - return
                  - order
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Get return
      tags:
        - Returns
    parameters:
      - $ref: '#/components/parameters/return-id.param'
    summary: Return
  /returns/{returnId}/comments:
    description: Return comment.
    get:
      description: List return comments.
      operationId: Return comments get
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  comments:
                    description: Return comments.
                    items:
                      $ref: '#/components/schemas/comment.schema'
                    title: Comments
                    type: array
                required:
                  - comments
                type: object
          description: Success
      summary: List return comments
      tags:
        - Returns
    parameters:
      - $ref: '#/components/parameters/return-id.param'
    post:
      description: Create return comment.
      operationId: Return comment create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                comment:
                  $ref: '#/components/schemas/comment.schema'
              required:
                - comment
              type: object
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                properties:
                  comment:
                    $ref: '#/components/schemas/comment.schema'
                required:
                  - comment
                type: object
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Create return comment
      tags:
        - Returns
    summary: Return comment
  /returns/{returnId}/status:
    description: Return status.
    get:
      description: Get return status.
      operationId: Return status get
      parameters:
        - $ref: '#/components/parameters/return-id.param'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  status:
                    $ref: '#/components/schemas/return-status.schema'
                required:
                  - status
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Get return status
      tags:
        - Returns
    put:
      description: Update return status.
      operationId: Return status update
      parameters:
        - $ref: '#/components/parameters/return-id.param'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                status:
                  $ref: '#/components/schemas/return-status-update.schema'
              required:
                - status
              type: object
        required: true
      responses:
        '204':
          description: Updated
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Update return status
      tags:
        - Returns
    summary: Return status
  /stores/{storeId}/admin:
    description: Navigate to the merchant admin page.
    get:
      description: Navigate to the merchant admin page.
      operationId: Merchant admin navigate
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      responses:
        '302':
          description: Redirect
      summary: Navigate to merchant admin
      tags:
        - Merchant admin
    summary: Merchant admin
  /stores/{storeId}/checkout-buttons-ui:
    description: Generate HTML and CSS for checkout buttons
    get:
      description: Generate HTML and CSS for checkout buttons
      operationId: Checkout buttons UI
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  css:
                    description: Boilerplate checkout button CSS, plus any merchant configured styles or A/B tests.
                    title: Checkout buttons CSS
                    type: string
                  html:
                    description: Boilerplate checkout button HTML
                    title: Checkout buttons HTML
                    type: string
      summary: Retrieve some rendered HTML and CSS for checkout buttons options for enabling and disabling coverage
      tags:
        - Checkout buttons
        - UI
    summary: Checkout buttons UI
  /stores/{storeId}/coverage-info:
    description: Navigate to the coverage info page.
    get:
      description: Navigate to the coverage info page.
      operationId: Coverage info navigate
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      responses:
        '302':
          description: Redirect
      summary: Navigate to coverage info
      tags:
        - Coverage info
    summary: Coverage info
  /stores/{storeId}/coverage-products:
    description: Available coverage products.
    post:
      description: Get available coverage products.
      operationId: Coverage products
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                cart:
                  $ref: '#/components/schemas/storefront-cart.schema'
                customer:
                  $ref: '#/components/schemas/storefront-customer.schema'
              required:
                - cart
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  coverageProducts:
                    description: Coverage products.
                    items:
                      $ref: '#/components/schemas/coverage-product.schema'
                    title: Coverage Products
                    type: array
                required:
                  - coverageProducts
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      summary: Get coverage products
      tags:
        - Coverage Products
    summary: Coverage products
  /stores/{storeId}/customer-portal:
    description: Navigate to the customer portal.
    get:
      description: Navigate to the customer portal.
      operationId: Customer portal navigate
      parameters:
        - $ref: '#/components/parameters/store-id.param'
        - description: HMAC-SHA256 JWT of {"iss":"<partnerId>","sub":"<storeId>/<customerId>"}
          in: query
          name: token
          schema:
            type: string
        - description: Order ID
          in: query
          name: order_id
          schema:
            type: string
      responses:
        '302':
          description: Redirect
      summary: Navigate to customer portal
      tags:
        - Customer portal
    summary: Customer portal
  /stores/{storeId}/invoices:
    description: Return a list of invoices.
    get:
      description: Get a list of invoices.
      operationId: Invoice list
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  invoices:
                    items:
                      $ref: '#/components/schemas/invoice.schema'
                    type: array
                required:
                  - invoices
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        Bearer: []
      summary: Get invoice
      tags:
        - Invoice
    summary: Invoice
  /stores/{storeId}/returns:
    description: List of returns for store.
    get:
      description: List returns, sorted by most recent to least recent.
      operationId: Returns list
      parameters:
        - $ref: '#/components/parameters/page-continue.param'
        - $ref: '#/components/parameters/page-size.param'
        - $ref: '#/components/parameters/updated-at-max.param'
        - $ref: '#/components/parameters/updated-at-min.param'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  orders:
                    items:
                      $ref: '#/components/schemas/order-read.schema'
                    type: array
                  returns:
                    items:
                      $ref: '#/components/schemas/return-read.schema'
                    type: array
                required:
                  - orders
                  - returns
                type: object
          description: Success
          headers:
            X-Page-Next:
              $ref: '#/components/headers/page-next.header'
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: List returns
      tags:
        - Returns
    parameters:
      - $ref: '#/components/parameters/store-id.param'
    summary: Returns
  /stores/{storeId}/shipments/buy:
    description: Purchase a shipping label.
    parameters:
      - $ref: '#/components/parameters/store-id.param'
    post:
      description: Purchase a shipping label based on origin, destination, carrier, service, and parcel information.
      operationId: Shipment buy
      requestBody:
        content:
          application/json:
            schema:
              properties:
                carrier:
                  properties:
                    id:
                      description: ID for the carrier account that provides the shipping rate.
                      title: Carrier Account ID
                      type: string
                  required:
                    - id
                  type: object
                destination:
                  $ref: '#/components/schemas/shipping-contact.schema'
                origin:
                  $ref: '#/components/schemas/shipping-contact.schema'
                parcel:
                  $ref: '#/components/schemas/parcel.schema'
                service:
                  properties:
                    name:
                      description: Service level name
                      examples:
                        - Priority
                        - Ground
                      type: string
                  required:
                    - name
                  type: object
              required:
                - origin
                - destination
                - carrier
                - service
                - parcel
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  shipment:
                    $ref: '#/components/schemas/shipment.schema'
                required:
                  - shipment
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Purchase shipping label
      tags:
        - Shipping
    summary: Shipment Buy
  /stores/{storeId}/shipments/rates:
    description: Fetch available shipping label rates.
    parameters:
      - $ref: '#/components/parameters/store-id.param'
    post:
      description: Get available shipping rates based on origin, destination, and parcel information.
      operationId: Shipment rates
      requestBody:
        content:
          application/json:
            schema:
              properties:
                destination:
                  properties:
                    address:
                      $ref: '#/components/schemas/address.schema'
                  required:
                    - address
                  type: object
                origin:
                  properties:
                    address:
                      $ref: '#/components/schemas/address.schema'
                  required:
                    - address
                  type: object
                parcel:
                  $ref: '#/components/schemas/parcel.schema'
              required:
                - origin
                - destination
                - parcel
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  rates:
                    description: Available shipping rates
                    items:
                      $ref: '#/components/schemas/shipment-rate.schema'
                    type: array
                required:
                  - rates
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Get shipping rates
      tags:
        - Shipping
    summary: Shipment Rates
  /stores/{storeId}/shipments/{shipmentId}/documents/{documentType}:
    description: Download shipment document.
    get:
      description: Get a shipment document (label, commercial invoice, etc).
      operationId: Shipment document download
      parameters:
        - $ref: '#/components/parameters/shipment-id.param'
        - $ref: '#/components/parameters/document-type.param'
      responses:
        '200':
          content:
            application/pdf:
              schema:
                format: binary
                type: string
            image/png:
              schema:
                format: binary
                type: string
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Download shipment document
      tags:
        - Shipping
    parameters:
      - $ref: '#/components/parameters/store-id.param'
    summary: Shipment Document
  /stores/{storeId}/storefront/events:
    post:
      description: Processes events from storefronts using Shopify pixel event schema
      operationId: Storefront Event
      parameters:
        - $ref: '#/components/parameters/store-id.param'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/storefront-event.schema'
        required: true
      responses:
        '204':
          description: Event processed successfully
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Invalid event payload
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Receive storefront events
      tags:
        - Storefront
  /stores/{storeId}/webhooks:
    description: Webhooks.
    get:
      description: List webhooks for store.
      operationId: Webhooks list
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  webhooks:
                    items:
                      $ref: '#/components/schemas/webhook-read.schema'
                    type: array
                required:
                  - webhooks
                type: object
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      summary: List webhooks
      tags:
        - Webhooks
    parameters:
      - $ref: '#/components/parameters/store-id.param'
    post:
      description: Create webhook for store. Or if webhook already exists with `externalId`, update it.
      operationId: Webhook create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                webhook:
                  $ref: '#/components/schemas/webhook-create.schema'
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  webhook:
                    $ref: '#/components/schemas/webhook-read.schema'
                type: object
          description: Updated
        '201':
          content:
            application/json:
              schema:
                properties:
                  webhook:
                    $ref: '#/components/schemas/webhook-read.schema'
                type: object
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      security:
        - Bearer: []
      summary: Create or update webhook
      tags:
        - Webhooks
    summary: Webhooks
  /webhooks/{webhookId}:
    delete:
      description: Delete a webhook.
      operationId: Webhook delete
      parameters:
        - $ref: '#/components/parameters/webhook-id.param'
      responses:
        '204':
          description: Deleted
      security:
        - Bearer: []
      summary: Delete webhook
      tags:
        - Webhooks
    description: Webhook.
    get:
      description: Get a webhook.
      operationId: Webhook get
      parameters:
        - $ref: '#/components/parameters/webhook-id.param'
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  webhook:
                    $ref: '#/components/schemas/webhook-read.schema'
                required:
                  - webhook
                type: object
          description: Success
      summary: Get webhook
      tags:
        - Webhooks
    put:
      description: Update a webhook.
      operationId: Webhook update
      parameters:
        - $ref: '#/components/parameters/webhook-id.param'
      requestBody:
        content:
          application/json:
            schema:
              properties:
                webhook:
                  $ref: '#/components/schemas/webhook-update.schema'
              required:
                - webhook
              type: object
        required: true
      responses:
        '204':
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      summary: Update webhook
      tags:
        - Webhooks
    summary: Webhook
  /webhooks/{webhookId}/replay:
    description: Webhook replay.
    parameters:
      - $ref: '#/components/parameters/webhook-id.param'
    post:
      description: Replay a webhook.
      operationId: Webhook replay
      requestBody:
        content:
          application/json:
            schema:
              properties:
                start:
                  format: date-time
                  type: string
              required:
                - start
              type: object
        required: true
      responses:
        '202':
          description: Success
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/error.schema'
          description: Error
      summary: Replay webhook
      tags:
        - Webhooks
    summary: Webhook replay
servers:
  - url: https://api.getredo.com/v2.2
webhooks:
  return:
    description: Return event webhook.
    post:
      operationId: Webhook return event
      requestBody:
        content:
          application/json:
            schema:
              description: Return event
              properties:
                at:
                  description: Event time
                  format: date-time
                  title: At
                  type: string
                order:
                  $ref: '#/components/schemas/order-read.schema'
                  description: Order for return.
                  title: Order
                return:
                  $ref: '#/components/schemas/return-read.schema'
                  description: Return.
                  title: Return
                type:
                  description: Event type
                  enum:
                    - backfill
                    - created
                    - updated
                  type: string
              type: object
        description: |
          Return event webhook.
        required: true
      responses:
        2xx:
          description: Success. Return a 2xx status code to indicate success.
        default:
          description: Error. The event will be retried multiple times and then discarded.
      security:
        - UserBearer: []
      summary: Return event
      tags:
        - Returns
    summary: Return event
