openapi: 3.1.0
info:
  title: Integrations
  contact:
    name: Sendcloud API Support
    email: contact@sendcloud.com
    url: https://www.sendcloud.dev
  version: 2.0.0
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  description: >-
    The Integrations API allows you to retrieve, update and add orders to custom
    webshop integrations.
servers:
  - url: https://panel.sendcloud.sc/api/v2
    description: Sendcloud Production
tags:
  - name: Integrations
  - name: Shipments
paths:
  /integrations:
    get:
      summary: Retrieve a list of integrations
      operationId: sc-public-v2-orders-get-retrieve_a_list_of_integrations
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/retrieve-a-list-of-integrations
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          The information returned includes the shop name and URL, the date, and
          the time of the last order fetch. The response indicates whether
          service point delivery is enabled for this integration, and for which
          carriers.
      description: >-
        Retrieve information about all the shop integrations currently connected
        to your Sendcloud account.
      parameters:
        - schema:
            type: string
          in: query
          name: ordering
          description: Specifies the field used to order the resulting response
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Integration'
              examples:
                RetrieveIntegrationList:
                  summary: Retrieve a list of integrations
                  value:
                    - id: 123
                      shop_name: 'Integration #1'
                      shop_url: https://example.com
                      system: api / amazon / magento
                      failing_since: '2019-08-24T14:15:22Z'
                      last_fetch: '2019-08-24T14:15:22Z'
                      last_updated_at: '2019-08-24T14:15:22Z'
                      service_point_enabled: true
                      service_point_carriers:
                        - ups
                      webhook_active: true
                      webhook_url: https://example.com
      tags:
        - Integrations
  /integrations/{id}:
    get:
      summary: Retrieve an integration
      operationId: sc-public-v2-orders-get-retrieve_an_integration
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/retrieve-an-integration
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          The information returned includes the shop name and URL, the date and
          the time of the last order fetch. The response will also indicate
          whether service point delivery is enabled for this integration, and
          for which carriers.
      description: Retrieve information about a specific integration using its `id`.
      tags:
        - Integrations
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Integration'
              examples:
                RetrieveIntegration:
                  summary: Retrieve an integration
                  value:
                    id: 123
                    shop_name: 'Integration #1'
                    shop_url: https://example.com
                    system: api / amazon / magento
                    failing_since: '2019-08-24T14:15:22Z'
                    last_fetch: '2019-08-24T14:15:22Z'
                    last_updated_at: '2019-08-24T14:15:22Z'
                    service_point_enabled: true
                    service_point_carriers:
                      - ups
                    webhook_active: true
                    webhook_url: https://example.com
        '404':
          $ref: '#/components/responses/404-Integrations'
    put:
      summary: Update an integration
      operationId: sc-public-v2-orders-put-update_an_integration
      x-mint:
        href: /api/v2/integrations/update-an-integration
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          Using this endpoint, you can change the webshop name and URL, edit the
          list of carriers you want to enable for service point delivery and
          enable or disable service point delivery by setting
          `service_point_enabled` to `true` or `false`.


          Unlike the [Partially update an
          integration](/api/v2/integrations/partially-update-an-integration)
          endpoint, you must send all fields, even those you don't want to
          change.


          You can obtain an integration `id` via the [Retrieve a list of
          integrations](/api/v2/integrations/retrieve-a-list-of-integrations)
          endpoint.
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      description: Update settings for a specific integration using its `id`.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationUpdate'
              examples:
                UpdateIntegration:
                  summary: Update an integration
                  value:
                    shop_name: 'Integration #1'
                    shop_url: https://example.com
                    last_updated_at: '2019-08-24T14:15:22Z'
                    service_point_enabled: true
                    service_point_carriers:
                      - ups
                    webhook_active: true
                    webhook_url: https://example.com
          description: OK
        '400':
          $ref: '#/components/responses/400-Integration'
        '404':
          $ref: '#/components/responses/404-Integrations'
      tags:
        - Integrations
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationUpdate'
            examples:
              UpdateIntegration:
                summary: Update an Integration
                value:
                  shop_name: 'Integration #1'
                  shop_url: https://example.com
                  service_point_enabled: true
                  service_point_carriers:
                    - ups
                  webhook_active: true
                  webhook_url: https://example.com
        description: ''
    patch:
      operationId: sc-public-v2-orders-patch-partial_update_an_integration
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/partially-update-an-integration
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          Using this endpoint, you can change the webshop name and URL, edit the
          list of carriers you want to enable for service point delivery and
          enable or disable service point delivery by setting
          `service_point_enabled` to `true` or `false`.


          Unlike the [Update an
          integration](/api/v2/integrations/update-an-integration) endpoint, you
          can send only the fields you want to update.


          You can obtain an integration `id` via the [Retrieve a list of
          integrations](/api/v2/integrations/retrieve-a-list-of-integrations)
          endpoint.
      description: Partially update settings for a specific integration using its `id`.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationUpdate'
              examples:
                UpdateIntegration:
                  summary: Update an Integration
                  value:
                    shop_name: 'Integration #1'
                    shop_url: https://example.com
                    last_updated_at: '2019-08-24T14:15:22Z'
                    service_point_enabled: true
                    service_point_carriers:
                      - ups
                    webhook_active: true
                    webhook_url: https://example.com
                partial_update:
                  summary: Partial update of an Integration
                  value:
                    service_point_enabled: true
                    service_point_carriers:
                      - ups
          description: OK
        '400':
          $ref: '#/components/responses/400-Integration'
        '404':
          $ref: '#/components/responses/404-Integrations'
      tags:
        - Integrations
      summary: Partially update an integration
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationUpdate'
            examples:
              UpdateIntegration:
                summary: Update an integration
                value:
                  shop_name: 'Integration #1'
                  shop_url: https://example.com
                  last_updated_at: '2019-08-24T14:15:22Z'
                  service_point_enabled: true
                  service_point_carriers:
                    - ups
                  webhook_active: true
                  webhook_url: https://example.com
              partial_update:
                summary: Partial update of an Integration
                value:
                  service_point_enabled: true
                  service_point_carriers:
                    - ups
    delete:
      summary: Delete an integration
      operationId: sc-public-v2-orders-delete-delete_an_integration
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/delete-an-integration
        content: |-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>
      description: Delete a shop integration from the Sendcloud system.
      responses:
        '204':
          description: No Content
        '404':
          $ref: '#/components/responses/404-Integrations'
      tags:
        - Integrations
    parameters:
      - schema:
          type: integer
        name: id
        in: path
        required: true
        description: The id of the integration
  /integrations/{id}/shipments:
    get:
      operationId: sc-public-v2-orders-get-retrieve_a_list_of_shipments
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/retrieve-a-list-of-shipments
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          Note that the orders **are not** affected by [shipping
          rules](https://support.sendcloud.com/hc/en-us/articles/360025143571-Automate-your-workflow-using-Sendcloud-Shipping-Rules)
          at the time of retrieval, unless enabled explicitly.


          This endpoint is paginated, meaning that you can navigate through the
          `results` via the URLs provided within the `next` and `previous`
          fields.
      x-sendcloud-paginated: true
      x-sendcloud-paginated-discriminator: results
      description: >-
        Retrieve a list of orders that were imported from a specific webshop
        integration.
      parameters:
        - $ref: '#/components/parameters/cursor-parameter'
        - name: start_date
          in: query
          required: false
          description: >-
            Displays orders from the given `start_date`, including the set date.
            It defaults to one year ago.
          schema:
            type: string
            format: date
        - name: end_date
          in: query
          required: false
          description: >-
            Displays orders up to the given `end_date`, including the set date.
            It defaults to the current date.
          schema:
            type: string
            format: date
        - name: external_order_ids
          in: query
          required: false
          description: >-
            Filters results to shipments where their `external_order_id` matches
            one of the user provided ones.
          schema:
            type: array
            items:
              type: string
        - name: external_shipment_ids
          in: query
          required: false
          description: >-
            Filters results to shipments where their `external_shipments_id`
            matches one of the user provided ones.
          schema:
            type: array
            items:
              type: string
        - name: shipping_rules
          in: query
          required: false
          description: >-
            Enable shipping rules when retrieving orders. This will have an
            impact on the `allowed_shipping_methods`.
          schema:
            type: boolean
        - name: order_number
          in: query
          required: false
          description: Filters results to shipments on `order_number`.
          schema:
            type: string
        - name: sender_address
          in: query
          required: false
          description: >-
            Allows to specify a sender address id to display proper
            `allowed_shipping_methods`.
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  next:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go forward. By following
                      this URL you can get a next batch of shipments
                  previous:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go backwards. By following
                      this URL you can get a previous batch of shipments
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/ShipmentBlobOrder'
              examples:
                RetrieveShipmentList:
                  summary: Retrieve a list of shipments
                  value:
                    next: https://example.com
                    previous: https://example.com
                    results:
                      - address: Lansdown Glade
                        address_2: string
                        allowed_shipping_methods:
                          - 0
                        barcode: string
                        city: Oss
                        company_name: string
                        country: AW
                        created_at: '2019-08-24T14:15:22Z'
                        currency: EUR
                        customs_invoice_nr: '120'
                        customs_shipment_type: 0
                        email: user@example.com
                        external_order_id: '555413'
                        external_shipment_id: '777413'
                        house_number: '15'
                        integration: 0
                        name: John Doe
                        order_number: OXSDFGHTD-12
                        order_status:
                          id: fulfilled
                          message: Fulfilled
                        parcel_items:
                          - description: Very orange color
                            hs_code: '01013000'
                            origin_country: AW
                            product_id: '1458734634'
                            properties:
                              size: small
                              colour: red
                            quantity: 2
                            sku: WW-DR-GR-XS-001
                            value: '3.5'
                            weight: '1'
                            mid_code: NLOZR92MEL
                            material_content: 100% Cotton
                            intended_use: Personal use
                        payment_status:
                          id: paid
                          message: Paid
                        postal_code: '5341'
                        sender_address: 12345
                        shipment_uuid: 6b436cb2-65a4-482c-9d25-38be7868ff00
                        shipping_method: 12345
                        shipping_method_checkout_name: string
                        telephone: string
                        to_post_number: string
                        to_service_point: 0
                        to_state: string
                        total_order_value: string
                        updated_at: '2019-08-24T14:15:22Z'
                        weight: string
                        checkout_payload:
                          sender_address_id: 0
                          shipping_product:
                            code: postnl:standard
                            name: PostNL Standard
                            selected_functionalities:
                              age_check: 18
                              last_mile: home_delivery
                              first_mile: pickup_dropoff
                              multicollo: true
                              form_factor: parcel
                              service_area: domestic
                              weekend_delivery: saturday
                              delivery_deadline: best_effort
                              direct_contract_only: false
                          delivery_method_type: string
                          delivery_method_data:
                            delivery_date: '2019-08-24T14:15:22Z'
                            formatted_delivery_date: string
                            parcel_handover_date: '2019-08-24T14:15:22Z'
                        width: string
                        height: string
                        length: string
                        customs_details:
                          discount_granted: '3.99'
                          insurance_costs: '9.99'
                          freight_costs: '5.99'
                          other_costs: '2.99'
                          tax_numbers:
                            sender:
                              - tax_number:
                                  name: VAT
                                  country: NL
                                  value: NL987654321B02
                            receiver:
                              - tax_number:
                                  name: VAT
                                  country: DE
                                  value: DE123456789B03
                            importer_of_records:
                              - tax_number:
                                  name: VAT
                                  country: NL
                                  value: NL975318642B01
                        shipment_created_at: '2019-09-25T14:15:22Z'
                        shipment_updated_at: '2019-09-25T14:15:22Z'
        '404':
          $ref: '#/components/responses/404-Shipments'
      summary: Retrieve a list of shipments
      tags:
        - Shipments
    post:
      operationId: sc-public-v2-orders-post-create_a_list_of_shipments
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/create-a-list-of-shipments
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          <Info>
            This endpoint is only available for official Sendcloud partners.
          </Info>


          This endpoint allows you to insert shipments (or 'orders') into an API
          integration from your shop system, and have them appear in your
          Sendcloud account. Imported orders will appear in the Sendcloud
          platform under the **Incoming order overview** with the status "Ready
          to process". This allows you to easily generate parcels and create
          shipping labels via the API or directly from the Sendcloud platform.
          The validation for this endpoint is more relaxed, therefore we
          recommend this method over the [Create a parcel or
          parcels](/api/v2/parcels/create-a-parcel-or-parcels) endpoint for
          third-party integrators.


          This is an **UPSERT** endpoint which attempts to be idempotent given
          specific fields to ensure that orders are not duplicated. If there's
          an existing match in our database for specific fields
          (`external_order_id` and `external_shipment_id`), then the shipment
          will be updated. The system will only update orders that have had
          their `updated_at` (ISO 8601 DateTime) timestamp changed.


          The `external_shipment_id` field is used to split orders across
          multiple shipments, however, this field is not supported by all shop
          systems. If your shop system supports the distribution of product
          items within an order across multiple shipments, you can use the
          shipment data to create multiple entries. If your shop does not
          support this feature, you can set the `external_shipment_id` value to
          `null`.


          Batches are limited to 100 orders at once. This endpoint should accept
          most values in any of the available fields, but in the case of
          erroneous data, an error message will be returned directly. Your
          requests should almost always succeed unless the field structure is
          not correct.
      description: >-
        Insert shipments (or 'orders') into an API integration from your shop
        system, and have them appear in your Sendcloud account.
      responses:
        '200':
          description: >-
            List with references to created shipments, or the errors that
            occurred while creating the shipment.

            When a shipment can't be created, the response will contain an entry
            for the object with the errors.

            This object will have a path to each field containing errors,
            listing the error(s) it contains.
          content:
            application/json:
              schema:
                type: array
                items:
                  oneOf:
                    - $ref: '#/components/schemas/ShipmentCreateUpdateLog'
                    - $ref: '#/components/schemas/ShipmentErrorLog'
              examples:
                CreateUpdateShipments:
                  summary: Create or update a list of shipments
                  value:
                    - external_order_id: '1175584'
                      external_shipment_id: '777413'
                      shipment_uuid: 6b436cb2-65a4-482c-9d25-38be7868ff00
                      status: created
                    - error:
                        checkout_payload:
                          delivery_method_data:
                            delivery_date:
                              - This field is required.
                      external_order_id: '1184635'
                      external_shipment_id: ''
                      status: error
        '400':
          description: Bad Request
        '404':
          $ref: '#/components/responses/404-Shipments'
      summary: Create or update a list of shipments
      tags:
        - Shipments
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/ShipmentBlobOrderCreate'
            examples:
              CreateUpdateShipments:
                summary: Create or update a list of shipments
                value:
                  - address: Lansdown Glade
                    address_2: string
                    city: Oss
                    company_name: string
                    country: AW
                    created_at: '2019-08-24T14:15:22Z'
                    currency: EUR
                    customs_invoice_nr: '120'
                    customs_shipment_type: 0
                    email: user@example.com
                    external_order_id: '555413'
                    external_shipment_id: '777413'
                    house_number: '15'
                    name: John Doe
                    order_number: OXSDFGHTD-12
                    order_status:
                      id: fulfilled
                      message: Fulfilled
                    parcel_items:
                      - description: Very orange color
                        hs_code: '01013000'
                        origin_country: AW
                        product_id: '1458734634'
                        properties:
                          size: small
                          colour: red
                        quantity: 2
                        sku: WW-DR-GR-XS-001
                        value: '3.5'
                        weight: '1'
                        mid_code: NLOZR92MEL
                        material_content: 100% Cotton
                        intended_use: Personal use
                    payment_status:
                      id: paid
                      message: Paid
                    postal_code: '5341'
                    shipping_method: 12345
                    shipping_method_checkout_name: string
                    telephone: string
                    to_post_number: string
                    to_service_point: 0
                    to_state: string
                    total_order_value: string
                    updated_at: '2019-08-24T14:15:22Z'
                    weight: string
                    checkout_payload:
                      sender_address_id: 0
                      shipping_product:
                        code: postnl:standard
                        name: PostNL Standard
                        selected_functionalities:
                          age_check: 18
                          last_mile: home_delivery
                          first_mile: pickup_dropoff
                          multicollo: true
                          form_factor: parcel
                          service_area: domestic
                          weekend_delivery: saturday
                          delivery_deadline: best_effort
                          direct_contract_only: false
                      delivery_method_type: string
                      delivery_method_data:
                        delivery_date: '2019-08-24T14:15:22Z'
                        formatted_delivery_date: string
                        parcel_handover_date: '2019-08-24T14:15:22Z'
                    width: string
                    height: string
                    length: string
                    customs_details:
                      discount_granted: '3.99'
                      insurance_costs: '9.99'
                      freight_costs: '5.99'
                      other_costs: '2.99'
                      tax_numbers:
                        sender:
                          - tax_number:
                              name: VAT
                              country: NL
                              value: NL987654321B02
                        receiver:
                          - tax_number:
                              name: VAT
                              country: DE
                              value: DE123456789B03
                        importer_of_records:
                          - tax_number:
                              name: VAT
                              country: NL
                              value: NL975318642B01
        description: ''
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
        description: The id of the integration to which the shipments belong
  /integrations/{id}/shipments/delete:
    post:
      tags:
        - Shipments
      summary: Delete a shipment
      operationId: sc-public-v2-orders-post-delete_a_shipment
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/delete-a-shipment
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          The `order_status` and `payment_status` fields we retrieve from
          integrations are not mapped in our system, meaning that orders will
          not be automatically updated or deleted if the values for these fields
          change after an order is placed.


          You can delete an order by providing either a `shipment_uuid`, or a
          combination of the `external_order_id` and `external_shipment_id`
          properties.
      description: >-
        Allows you to delete a shipment from Sendcloud, e.g. if it has been
        canceled or deleted in your shop system.
      requestBody:
        description: >-
          You must provide either a shipment_uuid or the combination of
          external_order_id and external_shipment_id to this endpoint.
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    shipment_uuid:
                      type: string
                      format: uuid
                      description: Autogenerated Sendcloud's internal ID
                  required:
                    - shipment_uuid
                - type: object
                  properties:
                    external_order_id:
                      type: string
                      description: External order ID assigned by shop system
                    external_shipment_id:
                      type: string
                      description: External shipment ID assigned by shop system
                  required:
                    - external_order_id
                    - external_shipment_id
            examples:
              DeleteByUUID:
                summary: Delete a shipment (via UUID)
                value:
                  shipment_uuid: 39874b59-2a68-4a3d-8e00-aeb9e0540d00
              DeleteByOrderIdShipmentId:
                summary: Delete a shipment (via `order_id` and `shipment_id`)
                value:
                  external_order_id: '123457'
                  external_shipment_id: S00002
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: integer
                      request:
                        type: string
                      message:
                        type: string
              examples:
                RequiredFieldMissing:
                  summary: Missing required fields
                  value:
                    error:
                      code: 400
                      request: api/v2/integrations/1234/shipments/delete
                      message: >-
                        Missing shipment_uuid or the pair external_order_id and
                        external_shipment_id
                invalid_uuid:
                  summary: Invalid UUID
                  value:
                    error:
                      code: 400
                      request: api/v2/integrations/1234/shipments/delete
                      message: Must be a valid UUID.
        '404':
          $ref: '#/components/responses/404-Shipments'
    parameters:
      - schema:
          type: integer
        name: id
        in: path
        required: true
        description: The id of the integration to which the shipments belong
  /integrations/logs:
    get:
      summary: Retrieve all integration exception logs
      operationId: sc-public-v2-orders-get-retrieve_integrations_logs
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-sendcloud-paginated: true
      x-sendcloud-paginated-discriminator: results
      x-mint:
        href: /api/v2/integrations/retrieve-all-integration-exception-logs
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          Integration exception logs might be generated, for example:


          - if some resource cannot be found

          - if API credentials are no longer valid


          Each log record may contain information about the request and
          response, the status code and code exception, and can be used as a
          reference to identify issues between Sendcloud and a webshop.
      description: >-
        Retrieve all integration exception logs. These logs are created when
        integrations have problems making API requests to shop systems.
      tags:
        - Integrations
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  next:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go forward. By following
                      this URL you can get a next batch of logs
                  previous:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go backwards. By following
                      this URL you can get a previous batch of logs
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/IntegrationLog'
              examples:
                RetrieveIntegrationLogs:
                  summary: Retrieve a list of integration logs
                  value:
                    next: https://example.com
                    previous: https://example.com
                    results:
                      - id: 123
                        base_url: https://example.com
                        full_url: https://example.com/order-note.json
                        method: POST
                        response_code: 495
                        response:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          body: |
                            <!doctype html>
                            <html>
                             <head>
                             <title>SSL Certificate Error</title>
                             </head>
                             </html>
                        request:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          payload:
                            order_note:
                              note: Success
                        created_at: '2023-03-01T02:02:00+01:00'
                        exception_type: requests.exceptions.SSLError
                        exception: An SSL error occurred
                        protected: false
                      - id: 124
                        integration_id: 123
                        user_id: 123
                        base_url: https://example.com
                        full_url: https://example.com/order-note.json
                        method: POST
                        response_code: 404
                        response: {}
                        request:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          payload: {}
                        created_at: '2023-03-01T02:02:00+01:00'
                        exception: PageNotFound
                        protected: false
  /integrations/{id}/logs:
    get:
      summary: Retrieve exception logs for a specific integration
      operationId: sc-public-v2-orders-get-retrieve_integration_logs
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: >-
          /api/v2/integrations/retrieve-exception-logs-for-a-specific-integration
        content: >-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>


          Integration exception logs might be generated, for example:


          - if some resource cannot be found

          - if API credentials are no longer valid


          Each log record may contain information about the request and
          response, the status code and code exception, and can be used as a
          reference to identify issues between Sendcloud and a webshop.
      x-sendcloud-paginated: true
      x-sendcloud-paginated-discriminator: results
      description: >-
        Retrieve exception logs for a specific integration. These logs are
        created when integrations have problems making API requests to shop
        systems.
      tags:
        - Integrations
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  next:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go forward. By following
                      this URL you can get a next batch of logs
                  previous:
                    type: string
                    format: uri
                    description: >-
                      Cursor based pagination url to go backwards. By following
                      this URL you can get a previous batch of logs
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/IntegrationLog'
              examples:
                RetrieveIntegrationLogs:
                  summary: Retrieve a list of integration logs
                  value:
                    next: https://example.com
                    previous: https://example.com
                    results:
                      - id: 123
                        base_url: https://example.com
                        full_url: https://example.com/order-note.json
                        method: POST
                        response_code: 495
                        response:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          body: |
                            <!doctype html>
                            <html>
                             <head>
                             <title>SSL Certificate Error</title>
                             </head>
                             </html>
                        request:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          payload:
                            order_note:
                              note: Success
                        created_at: '2023-03-01T02:02:00+01:00'
                        exception_type: requests.exceptions.SSLError
                        exception: An SSL error occurred
                        protected: false
                      - id: 124
                        integration_id: 123
                        user_id: 123
                        base_url: https://example.com
                        full_url: https://example.com/order-note.json
                        method: POST
                        response_code: 404
                        response: {}
                        request:
                          headers:
                            Cache-Control: max-age=3600
                            Content-Type: text/html; charset=utf-8
                            Connection: keep-alive
                          payload: {}
                        created_at: '2023-03-01T02:02:00+01:00'
                        exception: PageNotFound
                        protected: false
        '404':
          $ref: '#/components/responses/404-Integrations'
    post:
      summary: Create integration exceptions logs
      operationId: sc-public-v2-orders-post-create_integration_logs
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds: []
      x-mint:
        href: /api/v2/integrations/create-integration-exception-logs
        content: |-
          <Warning>
            **API v2 is entering maintenance mode.** New users should start with API v3 to access our latest features and improved performance. Already using v2? Don't worry, your current integration remains fully functional. Read more about [maintenance mode](/docs/getting-started/api-version-guide), or check out the [migration guide for API v3](/docs/getting-started/migration-guidelines-for-api-v3).
          </Warning>
      description: >-
        Create integration exception logs, which will appear in the connection
        issue log screen of the user's integration.
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationLog'
              examples:
                CreateIntegrationLog:
                  summary: Create an integration log
                  value:
                    id: 123
                    integration_id: 123
                    user_id: 123
                    base_url: https://example.com
                    full_url: https://example.com/order-note.json
                    method: POST
                    response_code: 495
                    response:
                      headers:
                        Cache-Control: max-age=3600
                        Content-Type: text/html; charset=utf-8
                        Connection: keep-alive
                      body: |
                        <!doctype html>
                        <html>
                         <head>
                         <title>SSL Certificate Error</title>
                         </head>
                         </html>
                    request:
                      headers:
                        Cache-Control: max-age=3600
                        Content-Type: text/html; charset=utf-8
                        Connection: keep-alive
                      payload:
                        order_note:
                          note: Success
                    created_at: '2023-03-01T02:02:00+01:00'
                    exception_type: requests.exceptions.SSLError
                    exception: An SSL error occurred
                    protected: false
          description: OK
        '400':
          $ref: '#/components/responses/400-IntegrationLog'
        '404':
          $ref: '#/components/responses/404-Integrations'
      tags:
        - Integrations
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationLog'
            examples:
              CreateIntegrationLog:
                summary: Create an integration log
                value:
                  integration_id: 123
                  user_id: 123
                  base_url: https://example.com
                  full_url: https://example.com/order-note.json
                  method: POST
                  response_code: 495
                  response:
                    headers:
                      Cache-Control: max-age=3600
                      Content-Type: text/html; charset=utf-8
                      Connection: keep-alive
                    body: |
                      <!doctype html>
                      <html>
                       <head>
                       <title>SSL Certificate Error</title>
                       </head>
                       </html>
                  request:
                    headers:
                      Cache-Control: max-age=3600
                      Content-Type: text/html; charset=utf-8
                      Connection: keep-alive
                    payload:
                      order_note:
                        note: Success
                  created_at: '2023-03-01T02:02:00+01:00'
                  exception_type: requests.exceptions.SSLError
                  exception: An SSL error occurred
    parameters:
      - schema:
          type: integer
        name: id
        in: path
        required: true
        description: The id of the integration to which the shipments belong
components:
  schemas:
    Integration:
      type: object
      title: Integration Object
      properties:
        id:
          type: integer
          title: ID
          description: ID of an integration
          minimum: 1
          example: 123
          readOnly: true
        shop_name:
          type: string
          title: Name
          maxLength: 250
          minLength: 1
          description: Name of the shop
          example: 'Integration #1'
          readOnly: true
        shop_url:
          type:
            - string
            - 'null'
          title: Shop url
          description: URL of the shop the integration connects to
          format: uri
          minLength: 1
        system:
          type: string
          title: System
          maxLength: 50
          minLength: 1
          example: api / amazon / magento
          description: Type of shop/system the integration connects to
          readOnly: true
        failing_since:
          type:
            - string
            - 'null'
          title: Failing since
          description: >-
            Timestamp from when the integration is failing to fetch orders or to
            send feedback
          format: date-time
          readOnly: true
        last_fetch:
          type:
            - string
            - 'null'
          title: Last fetch
          description: >-
            The last time we managed to fetch data from this integration, used
            for rate limiting purposes
          format: date-time
          readOnly: true
        last_updated_at:
          type: string
          title: Last updated at
          format: date-time
          description: Timestamp when the integration was last updated
          readOnly: true
        service_point_enabled:
          type: boolean
          title: Service point enabled
          description: Flag for denoting if delivery to service points is enabled
        service_point_carriers:
          title: Service point carriers
          type: array
          description: A list of carriers available for the service point picker
          items:
            type: string
            example: ups
          readOnly: true
        webhook_active:
          type: boolean
          title: Webhook active
          description: >-
            Flag indicating if updates for parcels should be send via the
            webhook
        webhook_url:
          type:
            - string
            - 'null'
          title: Webhook url
          format: uri
          description: A URL to which Sendcloud communicates updates to a parcel
          minLength: 1
      required:
        - shop_name
        - system
        - last_updated_at
    IntegrationLog:
      type:
        - object
      title: Integration Log Object
      properties:
        id:
          type:
            - integer
          title: ID
          description: ID of an log record
          minimum: 1
          example: 123
          readOnly: true
        integration_id:
          type:
            - integer
            - 'null'
          description: ID of an integration to which this log belongs
          minimum: 1
          example: 123
          writeOnly: true
        user_id:
          type:
            - integer
          description: ID of a user to which this log belongs
          minimum: 1
          example: 123
          writeOnly: true
        base_url:
          description: Base shop URL
          type:
            - string
          example: https://example.com
          minLength: 1
        full_url:
          description: Full path to resource where error happened
          type:
            - string
            - 'null'
          example: https://example.com/order-note.json
        method:
          type:
            - string
          description: HTTP method caused an error
          example: POST
        response_code:
          type:
            - integer
            - 'null'
          description: Standard HTTP error code
          example: 495
          minimum: 0
        response:
          type:
            - object
            - 'null'
          title: Response object
          description: Response JSON containing response body and headers
          properties:
            headers:
              title: HTTP headers
              description: HTTP headers which were sent within a response
              examples:
                - headerExample:
                    Cache-Control: max-age=3600
                    Content-Type: text/html; charset=utf-8
                    Connection: keep-alive
              type:
                - object
                - 'null'
            body:
              title: HTTP response body
              description: HTTP response body
              example: |
                <!doctype html>
                <html>
                 <head>
                 <title>SSL Certificate Error</title>
                 </head>
                 </html>
              type:
                - string
                - object
                - 'null'
        request:
          type:
            - object
            - 'null'
          title: Request object
          description: Request JSON containing request body and headers
          properties:
            headers:
              title: HTTP headers
              description: HTTP headers which were sent within a request
              type:
                - object
                - string
                - 'null'
              examples:
                - headerExample:
                    Cache-Control: max-age=3600
                    Content-Type: text/html; charset=utf-8
                    Connection: keep-alive
            payload:
              title: HTTP request body
              description: HTTP request body
              type:
                - object
                - string
                - 'null'
              examples:
                - order_note:
                    note: Success
        created_at:
          type:
            - string
          format: date-time
          description: >-
            Timestamp indicating when an exception occurred. If the fields is
            not presented in the request, current date will be set
          example: '2023-03-01T02:02:00+01:00'
        exception_type:
          type:
            - string
            - 'null'
          description: >-
            Internal field to store Python exception type. We use this field to
            suggest our users the ways how they can fix issues.
          example: requests.exceptions.SSLError
        exception:
          type:
            - string
            - 'null'
          title: Exception text
          description: Human readable description of exception
          example: An SSL error occurred
        protected:
          type:
            - boolean
          description: An indication whether or not request/response is obfuscated
          example: false
          readOnly: true
      required:
        - base_url
      description: ''
    IntegrationUpdate:
      title: Integration Update Object
      description: An updated integration response object
      properties:
        shop_name:
          type: string
          title: Name
          maxLength: 250
          minLength: 1
          description: Name of the shop
          example: 'Integration #1'
          readOnly: true
        shop_url:
          type: string
          title: Shop url
          description: URL of the shop the integration connects to
          format: uri
          minLength: 1
        last_updated_at:
          type: string
          title: Last updated at
          format: date-time
          description: Timestamp when the integration was last updated
          readOnly: true
        service_point_enabled:
          type: boolean
          title: Service point enabled
          description: Flag for denoting if delivery to service points is enabled
        service_point_carriers:
          type: array
          title: Service point carriers
          description: >-
            A list of carriers available for the service point picker. At least
            one carrier must be provided if the service point delivery is
            enabled.
          items:
            type: string
            example: ups
        webhook_active:
          type: boolean
          title: Webhook active
          description: >-
            Flag indicating if updates for parcels should be send via the
            webhook
        webhook_url:
          type: string
          title: Webhook url
          format: uri
          description: A URL to which Sendcloud communicates updates in a parcel
          minLength: 1
    CheckoutPayload:
      title: Checkout Payload Object
      type: object
      properties:
        sender_address_id:
          title: >-
            The [sender address unique
            identifier](../sender-addresses/openapi.yaml) associated with the
            order
          type: integer
          description: The sender_address_id associated with the order
        shipping_product:
          title: Shipping product
          type: object
          description: >-
            The shipping product with the associated functionalities of the
            order. See example payload. The `code`, `name` and
            `selected_functionalities` fields are **all required**. This data
            follows from the chosen `delivery_method` (by the end-consumer).
        delivery_method_type:
          title: Delivery method type
          type: string
          minLength: 1
          description: >-
            The type of the delivery method. Needs to be either
            `standard_delivery`, `nominated_day_delivery` or
            `same_day_delivery`.
        delivery_method_data:
          type: object
          properties:
            delivery_date:
              title: Delivery date
              type: string
              format: date-time
              description: The delivery date required by the end-consumer
            formatted_delivery_date:
              type: string
              title: Formatted delivery date
              minLength: 1
              example: February 21, 2012
            parcel_handover_date:
              title: Parcel handover date
              type: string
              format: date-time
              description: Date at which the parcel needs to be handed over to the carrier
          required:
            - delivery_date
            - formatted_delivery_date
            - parcel_handover_date
      required:
        - sender_address_id
        - shipping_product
        - delivery_method_type
    CostsObject:
      properties:
        value:
          type:
            - string
            - 'null'
          pattern: '[\d]+(\.[\d]+)?'
          example: '3.99'
        currency:
          type:
            - string
            - 'null'
          example: EUR
    TaxNumber:
      type: object
      title: Tax Number
      properties:
        name:
          type:
            - string
            - 'null'
          title: Tax ID name
          example: VAT
        country_code:
          type:
            - string
            - 'null'
          title: The country code of the country in the address
          example: NL
        value:
          type:
            - string
            - 'null'
          title: The value of the Tax ID
          example: NL987654321B02
    CustomsInformation:
      type:
        - object
        - 'null'
      title: Customs Information
      description: Customs information related to this shipment
      properties:
        discount_granted:
          type:
            - object
            - 'null'
          title: Discount Granted
          description: Discount granted on the total order
          $ref: '#/components/schemas/CostsObject'
        insurance_costs:
          type:
            - object
            - 'null'
          title: Insurance Cost
          description: Amount the order is insured for
          $ref: '#/components/schemas/CostsObject'
        freight_costs:
          type:
            - object
            - 'null'
          title: Freight Cost
          description: Shipping cost of the order
          $ref: '#/components/schemas/CostsObject'
        other_costs:
          type:
            - object
            - 'null'
          title: Other Costs
          description: Any other costs (for eg, wrapping costs) associated with the order
          $ref: '#/components/schemas/CostsObject'
        tax_numbers:
          type:
            - object
            - 'null'
          title: Tax information about sender, receiver, and importer of records
          properties:
            sender:
              type: array
              title: Sender's Tax Information
              minItems: 0
              items:
                $ref: '#/components/schemas/TaxNumber'
            receiver:
              type: array
              title: Receiver's Tax Information
              minItems: 0
              items:
                $ref: '#/components/schemas/TaxNumber'
            importer_of_records:
              type: array
              title: Receiver's Tax Information
              minItems: 0
              items:
                $ref: '#/components/schemas/TaxNumber'
    ShipmentBlobOrder:
      title: Shipment Blob Order Object
      type: object
      properties:
        address:
          title: Address
          type: string
          minLength: 1
        address_2:
          title: Address 2
          type: string
        allowed_shipping_methods:
          type: array
          items:
            type: integer
          readOnly: true
        barcode:
          title: Barcode
          type: string
          minLength: 1
          description: Barcode value of the label
          readOnly: true
        city:
          title: City
          type: string
          minLength: 1
        company_name:
          title: Company name
          type: string
        country:
          $ref: '#/components/schemas/country-codes'
        created_at:
          type: string
          title: Created at
          format: date-time
          description: >-
            Timestamp indicating when the shipment was created in the Sendcloud
            system
          example: '2022-05-07T15:08:12.152000Z'
        currency:
          type:
            - string
            - 'null'
          title: Currency
          minLength: 1
          description: ISO 4217 currency code
          enum:
            - EUR
            - USD
            - GBP
        customs_invoice_nr:
          type: string
          title: Customs invoice nr
          description: Your own commercial invoice number
          example: '120'
        customs_shipment_type:
          type:
            - integer
            - 'null'
          title: Customs shipment type
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
          description: |
            Type of shipment for customs purposes:
              - `0` - Gift
              - `1` - Documents
              - `2` - Commercial Goods
              - `3` - Commercial Sample
              - `4` - Returned Goods
          minimum: 0
          maximum: 4
        email:
          title: Customer email address
          type: string
          format: email
        external_order_id:
          title: External order id
          type: string
          minLength: 1
          description: External order ID assigned by the shop system
        external_shipment_id:
          title: External shipment id
          type:
            - string
            - 'null'
          minLength: 1
          description: External shipment ID assigned by the shop system
        house_number:
          title: House number
          type: string
        integration:
          title: Integration
          type: integer
          description: Sendcloud Integration ID
          readOnly: true
        name:
          title: Name
          type: string
          minLength: 1
        order_number:
          title: Order number
          type: string
          minLength: 1
          description: Unique order number generated manualy or by the shop system
        order_status:
          $ref: '#/components/schemas/ShipmentBlobStatus'
        parcel_items:
          type:
            - array
            - 'null'
          description: List of items the parcel contains
          items:
            $ref: '#/components/schemas/ParcelItems'
        payment_status:
          $ref: '#/components/schemas/ShipmentBlobStatus'
        postal_code:
          title: Postal code
          type: string
          minLength: 1
        sender_address:
          title: Sender address
          type:
            - integer
            - 'null'
          description: ID of a sender address in the Sendcloud system
          readOnly: true
        shipment_uuid:
          type: string
          title: Shipment uuid
          minLength: 1
          format: uuid
          description: Automatically generated Sendcloud's internal ID
          readOnly: true
        shipping_method:
          type:
            - integer
            - 'null'
          title: Shipping method
          description: Foreign key indicating shipping method used
          example: 1234
        shipping_method_checkout_name:
          title: Shipping method checkout name
          type: string
          maxLength: 100
          description: Human readable shipping method name
        telephone:
          title: Telephone
          type: string
        to_post_number:
          title: To post number
          type: string
        to_service_point:
          title: To service point
          type:
            - integer
            - 'null'
        to_state:
          title: To state
          type:
            - string
            - 'null'
          minLength: 1
        total_order_value:
          title: Total order value
          type:
            - string
            - 'null'
          format: decimal
          description: The total price of an order
        updated_at:
          type: string
          title: Updated at
          format: date-time
          description: Timestamp for when the shipment was updated in the Sendcloud system
          example: '2022-05-07T15:08:12.152000Z'
        weight:
          type:
            - string
            - 'null'
          title: Weight
          format: decimal
          description: Total weight of the order. Cannot be smaler than 0.001
          example: '10.2'
          maxLength: 10
        checkout_payload:
          $ref: '#/components/schemas/CheckoutPayload'
        width:
          type:
            - string
            - 'null'
          title: Width
          description: Volumetric weight width
          format: decimal
          maxLength: 10
          example: '10.2'
        height:
          type:
            - string
            - 'null'
          title: Height
          description: Volumetric weight height
          format: decimal
          maxLength: 10
          example: '10.2'
        length:
          type:
            - string
            - 'null'
          title: Length
          description: Volumetric weight length
          format: decimal
          maxLength: 10
          example: '10.2'
        customs_details:
          $ref: '#/components/schemas/CustomsInformation'
        shipment_created_at:
          type: string
          format: date-time
          description: >-
            Timestamp indicating when the shipment was created in the shop
            system
          example: '2022-07-07T15:08:12.152000Z'
          readOnly: true
        shipment_updated_at:
          type: string
          format: date-time
          description: Timestamp for when the shipment was updated in the shop system
          example: '2022-07-07T15:08:12.152000Z'
          readOnly: true
      required:
        - address
        - address_2
        - city
        - company_name
        - country
        - created_at
        - currency
        - customs_invoice_nr
        - customs_shipment_type
        - email
        - external_order_id
        - external_shipment_id
        - house_number
        - name
        - order_number
        - order_status
        - parcel_items
        - payment_status
        - postal_code
        - shipping_method_checkout_name
        - telephone
        - to_post_number
        - to_service_point
        - to_state
        - updated_at
        - shipment_created_at
        - shipment_updated_at
    ShipmentBlobStatus:
      title: Shipment Blob Status Object
      type:
        - object
        - 'null'
      properties:
        id:
          title: Id
          type: string
          minLength: 1
          description: Custom internal shop status, can be used for filtering
        message:
          title: Message
          type: string
          minLength: 1
          description: User-defined human readable status
      required:
        - id
        - message
    ParcelItems:
      title: Parcel Items Object
      type: object
      properties:
        description:
          type: string
          title: Description
          minLength: 1
          description: Description of the type of product
          example: Bag
        hs_code:
          description: Harmonized System Code
          type: string
          title: HS code
          example: '01013000'
          maxLength: 12
        origin_country:
          type:
            - string
            - 'null'
          title: Origin country
          enum:
            - AW
            - AF
            - AO
            - AI
            - AX
            - AL
            - AD
            - AE
            - AR
            - AM
            - AS
            - AQ
            - TF
            - AG
            - AU
            - AT
            - AZ
            - BI
            - BE
            - BJ
            - BQ
            - BF
            - BD
            - BG
            - BH
            - BS
            - BA
            - BL
            - BY
            - BZ
            - BM
            - BO
            - BR
            - BB
            - BN
            - BT
            - BV
            - BW
            - CF
            - CA
            - CC
            - CH
            - CL
            - CN
            - CI
            - CM
            - CD
            - CG
            - CK
            - CO
            - KM
            - CV
            - CR
            - CU
            - CW
            - CX
            - KY
            - CY
            - CZ
            - DE
            - DJ
            - DM
            - DK
            - DO
            - DZ
            - EC
            - EG
            - ER
            - EH
            - ES
            - EE
            - ET
            - FI
            - FJ
            - FK
            - FR
            - FO
            - FM
            - GA
            - GB
            - GE
            - GG
            - GH
            - GI
            - GN
            - GP
            - GM
            - GW
            - GQ
            - GR
            - GD
            - GL
            - GT
            - GF
            - GU
            - GY
            - HK
            - HM
            - HN
            - HR
            - HT
            - HU
            - ID
            - IM
            - IN
            - IO
            - IE
            - IR
            - IQ
            - IS
            - IL
            - IT
            - JM
            - JE
            - JO
            - JP
            - KZ
            - KE
            - KG
            - KH
            - KI
            - KN
            - KR
            - KW
            - LA
            - LB
            - LR
            - LY
            - LC
            - LI
            - LK
            - LS
            - LT
            - LU
            - LV
            - MO
            - MF
            - MA
            - MC
            - MD
            - MG
            - MV
            - MX
            - MH
            - MK
            - ML
            - MT
            - MM
            - ME
            - MN
            - MP
            - MZ
            - MR
            - MS
            - MQ
            - MU
            - MW
            - MY
            - YT
            - NA
            - NC
            - NE
            - NF
            - NG
            - NI
            - NU
            - NL
            - 'NO'
            - NP
            - NR
            - NZ
            - OM
            - PK
            - PA
            - PN
            - PE
            - PH
            - PW
            - PG
            - PL
            - PR
            - KP
            - PT
            - PY
            - PS
            - PF
            - QA
            - RE
            - RO
            - RU
            - RW
            - SA
            - SD
            - SN
            - SG
            - GS
            - SH
            - SJ
            - SB
            - SL
            - SV
            - SM
            - SO
            - PM
            - RS
            - SS
            - ST
            - SR
            - SK
            - SI
            - SE
            - SZ
            - SX
            - SC
            - SY
            - TC
            - TD
            - TG
            - TH
            - TJ
            - TK
            - TM
            - TL
            - TO
            - TT
            - TN
            - TR
            - TV
            - TW
            - TZ
            - UG
            - UA
            - UM
            - UY
            - US
            - UZ
            - VA
            - VC
            - VE
            - VG
            - VI
            - VN
            - VU
            - WF
            - WS
            - YE
            - ZA
            - ZM
            - ZW
            - IC
            - XK
          description: >-
            Country code from where the products were originally produced (ISO
            3166-1 alpha-2)
          minLength: 2
          maxLength: 2
        product_id:
          type: string
          title: Product id
          description: Internal ID of the product
          example: '1458734634'
        properties:
          title: Properties
          type: object
          additionalProperties:
            type:
              - string
              - 'null'
          description: >-
            An object containing any additional properties of the product, e.g.
            `color: Black`
        quantity:
          type: integer
          title: Quantity
          minimum: 1
          description: Number of units of a given item
          example: 2
        sku:
          type: string
          title: Sku
          description: >-
            Internal stock keeping unit, used by retailers to assign to
            products, in order to keep track of stock levels internally.
          example: WW-DR-GR-XS-001
        value:
          title: Value
          type: string
          format: decimal
          description: Price of an item
        weight:
          title: Weight
          type:
            - string
            - 'null'
          format: decimal
          description: Weight of an item
        mid_code:
          title: MID Code
          type:
            - string
            - 'null'
          description: >-
            MID code is short for Manufacturer's Identification code and must be
            shown on the commercial invoice. It's used as an alternative to the
            full name and address of a manufacturer, shipper or exporter and is
            always required for U.S. formal customs entries.
          example: NLOZR92MEL
        material_content:
          title: Material Content
          type:
            - string
            - 'null'
          description: A description of materials of the order content.
          example: 100% Cotton
        intended_use:
          title: Intended Use
          type:
            - string
            - 'null'
          description: >-
            Intended use of the order contents. The intended use may be personal
            or commercial.
          example: Personal use
      required:
        - description
        - quantity
        - value
    ShipmentBlobOrderCreate:
      title: Shipment Blob Order Create Object
      type: object
      properties:
        address:
          title: Address
          type: string
          minLength: 1
        address_2:
          title: Address 2
          type: string
          minLength: 0
        city:
          title: City
          type: string
          minLength: 1
        company_name:
          title: Company name
          type: string
          minLength: 0
        country:
          $ref: '#/components/schemas/country-codes'
        created_at:
          type: string
          title: Created at
          format: date-time
          description: >-
            Timestamp indicating when the shipment was created in the shop
            system. This value will be saved and accessible through
            `shipment_created_at` field in GET response.
          example: '2022-05-07T15:08:12.152000Z'
        currency:
          type:
            - string
            - 'null'
          title: Currency
          minLength: 1
          description: ISO 4217 currency code
          enum:
            - EUR
            - USD
            - GBP
        customs_invoice_nr:
          type: string
          title: Customs invoice nr
          minLength: 0
          description: Your own commercial invoice number
          example: '120'
        customs_shipment_type:
          type:
            - integer
            - 'null'
          title: Customs shipment type
          enum:
            - 0
            - 1
            - 2
            - 3
            - 4
          description: |
            Type of shipment for customs purposes:
              - `0` - Gift
              - `1` - Documents
              - `2` - Commercial Goods
              - `3` - Commercial Sample
              - `4` - Returned Goods
          minimum: 0
          maximum: 4
        email:
          title: Customer email address
          type: string
          format: email
          minLength: 0
        external_order_id:
          title: External order id
          type: string
          minLength: 1
          description: External order ID assigned by the shop system
        external_shipment_id:
          title: External shipment id
          type:
            - string
            - 'null'
          minLength: 1
          description: External shipment ID assigned by the shop system
        house_number:
          title: House number
          type: string
          minLength: 0
        name:
          title: Name
          type: string
          minLength: 1
        order_number:
          title: Order number
          type: string
          minLength: 1
          description: Unique order number generated manualy or by the shop system
        order_status:
          $ref: '#/components/schemas/ShipmentBlobStatus'
        parcel_items:
          type:
            - array
            - 'null'
          description: List of items the parcel contains
          items:
            $ref: '#/components/schemas/ParcelItems'
        payment_status:
          $ref: '#/components/schemas/ShipmentBlobStatus'
        postal_code:
          title: Postal code
          type: string
          minLength: 1
        shipping_method:
          type:
            - integer
            - 'null'
          title: Shipping method
          description: Foreign key indicating shipping method used
          example: 1234
        shipping_method_checkout_name:
          title: Shipping method checkout name
          type: string
          minLength: 0
          maxLength: 100
          description: Human readable shipping method name
        telephone:
          title: Telephone
          type: string
          minLength: 0
        to_post_number:
          title: To post number
          type: string
          minLength: 0
        to_service_point:
          title: To service point
          type:
            - integer
            - 'null'
        to_state:
          title: To state
          type:
            - string
            - 'null'
          minLength: 1
        total_order_value:
          title: Total order value
          type:
            - string
            - 'null'
          format: decimal
          description: The total price of an order
        updated_at:
          type: string
          title: Updated at
          format: date-time
          description: >-
            Timestamp indicating when the shipment was updated in the shop
            system. This value will be saved and accessible through
            `shipment_updated_at` field in GET response.
          example: '2022-05-07T15:08:12.152000Z'
        weight:
          type:
            - string
            - 'null'
          title: Weight
          format: decimal
          description: Total weight of the order. Cannot be smaler than 0.001
          example: '10.2'
          maxLength: 10
        checkout_payload:
          $ref: '#/components/schemas/CheckoutPayload'
        width:
          type:
            - string
            - 'null'
          title: Width
          description: Volumetric weight width
          format: decimal
          maxLength: 10
          example: '10.2'
        height:
          type:
            - string
            - 'null'
          title: Height
          description: Volumetric weight height
          format: decimal
          maxLength: 10
          example: '10.2'
        length:
          type:
            - string
            - 'null'
          title: Length
          description: Volumetric weight length
          format: decimal
          maxLength: 10
          example: '10.2'
        customs_details:
          $ref: '#/components/schemas/CustomsInformation'
      required:
        - address
        - address_2
        - city
        - company_name
        - country
        - created_at
        - currency
        - customs_invoice_nr
        - customs_shipment_type
        - email
        - external_order_id
        - external_shipment_id
        - house_number
        - name
        - order_number
        - order_status
        - parcel_items
        - payment_status
        - postal_code
        - shipping_method_checkout_name
        - telephone
        - to_post_number
        - to_service_point
        - to_state
        - updated_at
    ShipmentCreateUpdateLog:
      title: Shipment Creation or Update information log
      type: object
      properties:
        external_order_id:
          title: External Order ID
          type: string
          minLength: 1
        external_shipment_id:
          title: External Shipment ID
          type: string
          minLength: 1
        shipment_uuid:
          title: Shipment UUID
          type: string
          format: uuid
          minLength: 1
        status:
          title: Status
          type: string
          enum:
            - created
            - updated
    ShipmentErrorLog:
      title: Shipment create/update error log
      type: object
      properties:
        error:
          title: Error(s)
          type: object
        external_order_id:
          title: External Order ID
          type: string
        external_shipment_id:
          title: External Shipment ID
          type: string
        status:
          title: Status
          type: string
          enum:
            - error
    country-codes:
      type: string
      title: Country Code Object
      enum:
        - AW
        - AF
        - AO
        - AI
        - AX
        - AL
        - AD
        - AE
        - AR
        - AM
        - AS
        - AQ
        - TF
        - AG
        - AU
        - AT
        - AZ
        - BI
        - BE
        - BJ
        - BQ
        - BF
        - BD
        - BG
        - BH
        - BS
        - BA
        - BL
        - BY
        - BZ
        - BM
        - BO
        - BR
        - BB
        - BN
        - BT
        - BV
        - BW
        - CF
        - CA
        - CC
        - CH
        - CL
        - CN
        - CI
        - CM
        - CD
        - CG
        - CK
        - CO
        - KM
        - CV
        - CR
        - CU
        - CW
        - CX
        - KY
        - CY
        - CZ
        - DE
        - DJ
        - DM
        - DK
        - DO
        - DZ
        - EC
        - EG
        - ER
        - EH
        - ES
        - EE
        - ET
        - FI
        - FJ
        - FK
        - FR
        - FO
        - FM
        - GA
        - GB
        - GE
        - GG
        - GH
        - GI
        - GN
        - GP
        - GM
        - GW
        - GQ
        - GR
        - GD
        - GL
        - GT
        - GF
        - GU
        - GY
        - HK
        - HM
        - HN
        - HR
        - HT
        - HU
        - ID
        - IM
        - IN
        - IO
        - IE
        - IR
        - IQ
        - IS
        - IL
        - IT
        - JM
        - JE
        - JO
        - JP
        - KZ
        - KE
        - KG
        - KH
        - KI
        - KN
        - KR
        - KW
        - LA
        - LB
        - LR
        - LY
        - LC
        - LI
        - LK
        - LS
        - LT
        - LU
        - LV
        - MO
        - MF
        - MA
        - MC
        - MD
        - MG
        - MV
        - MX
        - MH
        - MK
        - ML
        - MT
        - MM
        - ME
        - MN
        - MP
        - MZ
        - MR
        - MS
        - MQ
        - MU
        - MW
        - MY
        - YT
        - NA
        - NC
        - NE
        - NF
        - NG
        - NI
        - NU
        - NL
        - 'NO'
        - NP
        - NR
        - NZ
        - OM
        - PK
        - PA
        - PN
        - PE
        - PH
        - PW
        - PG
        - PL
        - PR
        - KP
        - PT
        - PY
        - PS
        - PF
        - QA
        - RE
        - RO
        - RU
        - RW
        - SA
        - SD
        - SN
        - SG
        - GS
        - SH
        - SJ
        - SB
        - SL
        - SV
        - SM
        - SO
        - PM
        - RS
        - SS
        - ST
        - SR
        - SK
        - SI
        - SE
        - SZ
        - SX
        - SC
        - SY
        - TC
        - TD
        - TG
        - TH
        - TJ
        - TK
        - TM
        - TL
        - TO
        - TT
        - TN
        - TR
        - TV
        - TW
        - TZ
        - UG
        - UA
        - UM
        - UY
        - US
        - UZ
        - VA
        - VC
        - VE
        - VG
        - VI
        - VN
        - VU
        - WF
        - WS
        - YE
        - ZA
        - ZM
        - ZW
        - IC
        - XK
      description: A country represented by its ISO 3166-1 alpha-2 code
      example: NL
  responses:
    404-Integrations:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    description: HTTP response status code
                    default: 404
                  request:
                    type: string
                    description: Endpoint which returned the response
                  message:
                    type: string
                    description: Human readable error message
                required:
                  - code
                  - request
                  - message
          examples:
            NotFound:
              summary: Integration not found
              value:
                error:
                  code: 404
                  request: api/v2/integrations/
                  message: No Integration matches the given query.
    404-Shipments:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    description: HTTP response status code
                    example: 404
                  request:
                    type: string
                    description: Endpoint which returned the response
                  message:
                    type: string
                    description: Human readable error message
                required:
                  - code
                  - request
                  - message
          examples:
            ShipmentNotFound:
              summary: Shipment not found
              value:
                error:
                  code: 404
                  request: api/v2/integrations/1/shipments/
                  message: No ShipmentBlob matches the given query.
            IntegrationNotFound:
              summary: Integration not found
              value:
                error:
                  code: 404
                  request: api/v2/integrations/1/shipments/
                  message: No Integration matches the given query.
    400-Integration:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    default: 400
                    description: HTTP response status code
                  request:
                    type: string
                    description: Endpoint which returned the response
                  message:
                    type: string
                    description: Human readable error message
                required:
                  - code
                  - request
                  - message
          examples:
            WrongFieldValue:
              summary: Wrong field value
              value:
                error:
                  code: 400
                  request: api/v2/integrations/
                  message: >-
                    {'settings': ['webhook_active: This field may not be null.',
                    'webhook_url: This field may not be null.']}
    400-IntegrationLog:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: integer
                    default: 400
                    description: HTTP response status code
                  request:
                    type: string
                    description: Endpoint which returned the response
                  message:
                    type: string
                    description: Human readable error message
                required:
                  - code
                  - request
                  - message
          examples:
            WrongFieldValue:
              summary: Wrong field value
              value:
                error:
                  code: 400
                  request: api/v2/integrations/12/logs
                  message: '{''exception'': [''This field may not be null.'', ]}'
  requestBodies: {}
  securitySchemes:
    HTTPBasicAuth:
      type: http
      description: >-
        Basic Authentication using API key and secrets is currently the main
        authentication mechanism.
      scheme: basic
    OAuth2ClientCreds:
      type: oauth2
      description: >-
        OAuth2 is a standardized protocol for authorization that allows users to
        share their private resources stored on one site with another site
        without having to provide their credentials. OAuth2 Client Credentials
        Grant workflow. This workflow is typically used for server-to-server
        interactions that require authorization to access specific resources.
      flows:
        clientCredentials:
          tokenUrl: https://account.sendcloud.com/oauth2/token/
          scopes:
            api: Default OAuth scope required to access Sendcloud API.
  parameters:
    cursor-parameter:
      name: cursor
      in: query
      description: >
        The cursor query string will be used as the pivot value to filter
        results. If no value is provided, the service must return the first
        page. The value is Base64 encoded GET parameters. example:
          For a cursor string there are 3 possible parameters to encode:
          - o: Offset
          - r: Reverse
          - p: Position
          Combine into GET parameters. Example: r=1&p=300
          Base 64 encoded it would become: cj0xJnA9MzAw
          GET parameter in url would be https://some.url.com/api/endpoint/?cursor=cj0xJnA9MzAw
      schema:
        type: string
        example: cj0xJnA9MzAw
