Commerce Layer packages API

resource type

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

commerce-layer-packages-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Commerce Layer addresses packages API
  version: 7.10.1
  contact:
    name: API Support
    url: https://commercelayer.io
    email: support@commercelayer.io
  description: Headless Commerce for Global Brands.
servers:
- url: https://{your_organization_slug}.commercelayer.io/api
  description: API
- url: https://core.commercelayer.io/users/sign_in
  description: Sign in
- url: https://docs.commercelayer.io/api
  description: API reference
security:
- bearerAuth: []
tags:
- name: packages
  description: resource type
paths:
  /packages:
    get:
      operationId: GET/packages
      summary: List all packages
      description: List all packages
      tags:
      - packages
      responses:
        '200':
          description: A list of package objects
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/packageResponseList'
    post:
      operationId: POST/packages
      summary: Create a package
      description: Create a package
      tags:
      - packages
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/packageCreate'
      responses:
        '201':
          description: The created package object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/packageResponse'
  /packages/{packageId}:
    get:
      operationId: GET/packages/packageId
      summary: Retrieve a package
      description: Retrieve a package
      tags:
      - packages
      parameters:
      - name: packageId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '200':
          description: The package object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/packageResponse'
    patch:
      operationId: PATCH/packages/packageId
      summary: Update a package
      description: Update a package
      tags:
      - packages
      parameters:
      - name: packageId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/packageUpdate'
      responses:
        '200':
          description: The updated package object
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/packageResponse'
    delete:
      operationId: DELETE/packages/packageId
      summary: Delete a package
      description: Delete a package
      tags:
      - packages
      parameters:
      - name: packageId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '204':
          description: No content
  /parcels/{parcelId}/package:
    get:
      operationId: GET/parcelId/package
      summary: Retrieve the package associated to the parcel
      description: Retrieve the package associated to the parcel
      tags:
      - packages
      parameters:
      - name: parcelId
        in: path
        schema:
          type: string
        required: true
        description: The resource's id
      responses:
        '200':
          description: The package associated to the parcel
components:
  schemas:
    packageResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the resource (hash).
              example: XAyRWNUzyN
            type:
              type: string
              description: The resource's type
              enum:
              - packages
            links:
              type: object
              properties:
                self:
                  type: string
                  description: URL
            attributes:
              $ref: '#/components/schemas/package/properties/data/properties/attributes'
            relationships:
              type: object
              properties:
                stock_location:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - stock_location
                        id:
                          type: string
                          description: The resource ID
                parcels:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - parcels
                        id:
                          type: string
                          description: The resource ID
                attachments:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - attachments
                        id:
                          type: string
                          description: The resource ID
                event_stores:
                  type: object
                  properties:
                    links:
                      type: object
                      properties:
                        self:
                          type: string
                          description: URL
                        related:
                          type: string
                          description: URL
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - event_stores
                        id:
                          type: string
                          description: The resource ID
    packageResponseList:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/packageResponse/properties/data'
    packageCreate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - packages
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: Unique name for the package.
                  example: Large (60x40x30)
                code:
                  type: string
                  description: The package identifying code.
                  example: YYYY 2000
                length:
                  type: number
                  description: The package length, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                width:
                  type: number
                  description: The package width, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                height:
                  type: number
                  description: The package height, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 25.0
                unit_of_length:
                  type: string
                  description: The unit of length. Can be one of 'cm', or 'in'.
                  example: gr
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
              required:
              - name
              - length
              - width
              - height
              - unit_of_length
            relationships:
              type: object
              properties:
                stock_location:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - stock_locations
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
              required:
              - stock_location
    packageUpdate:
      required:
      - data
      type: object
      properties:
        data:
          type: object
          required:
          - type
          - id
          - attributes
          properties:
            type:
              type: string
              description: The resource's type
              enum:
              - packages
            id:
              type: string
              description: Unique identifier for the resource (hash).
              example: XAyRWNUzyN
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: Unique name for the package.
                  example: Large (60x40x30)
                  nullable: false
                code:
                  type: string
                  description: The package identifying code.
                  example: YYYY 2000
                  nullable: true
                length:
                  type: number
                  description: The package length, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                  nullable: false
                width:
                  type: number
                  description: The package width, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                  nullable: false
                height:
                  type: number
                  description: The package height, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 25.0
                  nullable: false
                unit_of_length:
                  type: string
                  description: The unit of length. Can be one of 'cm', or 'in'.
                  example: gr
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
            relationships:
              type: object
              properties:
                stock_location:
                  required:
                  - data
                  type: object
                  properties:
                    data:
                      type: object
                      properties:
                        type:
                          type: string
                          description: The resource's type
                          enum:
                          - stock_locations
                        id:
                          type: string
                          description: Unique identifier for the resource (hash).
                          example: XAyRWNUzyN
    package:
      properties:
        data:
          properties:
            attributes:
              type: object
              properties:
                name:
                  type: string
                  description: Unique name for the package.
                  example: Large (60x40x30)
                  nullable: false
                code:
                  type: string
                  description: The package identifying code.
                  example: YYYY 2000
                  nullable: true
                length:
                  type: number
                  description: The package length, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                  nullable: false
                width:
                  type: number
                  description: The package width, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 40.0
                  nullable: false
                height:
                  type: number
                  description: The package height, used to automatically calculate the tax rates from the available carrier accounts.
                  example: 25.0
                  nullable: false
                unit_of_length:
                  type: string
                  description: The unit of length. Can be one of 'cm', or 'in'.
                  example: gr
                  nullable: false
                created_at:
                  type: string
                  description: Time at which the resource was created.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                updated_at:
                  type: string
                  description: Time at which the resource was last updated.
                  example: '2018-01-01T12:00:00.000Z'
                  nullable: false
                reference:
                  type: string
                  description: A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
                  example: ANY-EXTERNAL-REFEFERNCE
                  nullable: true
                reference_origin:
                  type: string
                  description: Any identifier of the third party system that defines the reference code.
                  example: ANY-EXTERNAL-REFEFERNCE-ORIGIN
                  nullable: true
                metadata:
                  type: object
                  description: Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
                  example:
                    foo: bar
                  nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT