Commerce Layer carts API

Operations with carts resource

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

commerce-layer-carts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Commerce Layer addresses carts 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: carts
  description: Operations with carts resource
paths:
  /carts/breakdown:
    post:
      operationId: POST/carts/breakdown
      summary: Query breakdown on carts
      description: "Breakdowns are aggregations that summarize your data as metrics (based on specific operators) or statistics, computed on field values. When performing a breakdown query on the Metrics API endpoint you get in the response the value of the computation (based on the selected operator) on the selected field, aggregated by another field.\r\n\r\n### Nesting breakdowns\r\nBreakdowns can be nested recursively one into the other, up to one level (see example). The valid values allowed for the by key of the nested breakdown are strictly dependent on the value you specified in the by key of the parent breakdown. Hence, they are different for each resource you’re doing statistics on (see orders, returns, and carts for the related lists).You cannot group the nested breakdown by the same field by which you’re already grouping the parent breakdown.\r\n\r\nSingle breakdown request\r\n\r\n`{\r\n\t\"breakdown\": {\r\n\t  \"by\": \"market.name\",\r\n\t  \"field\": \"order.id\",\r\n\t  \"operator\": \"value_count\",\r\n\t  \"condition\": {\r\n\t    \"gte_lte\": [ 10000, 100000 ]\r\n\t  },\r\n\t  \"sort\": \"desc\",\r\n\t  \"limit\": 2\r\n\t}\r\n}`\r\n  \r\n  \r\n Nested breakdown request\r\n \r\n` {\r\n    \"breakdown\": {\r\n      \"by\": \"market.name\",\r\n      \"field\": \"order.id\",\r\n      \"operator\": \"value_count\",\r\n      \"condition\": {\r\n        \"gte_lte\": [ 10000, 100000 ]  \r\n      },\r\n      \"sort\": \"desc\",\r\n      \"limit\": 3,\r\n      \"breakdown\": {\r\n        \"by\": \"order.currency_code\",\r\n        \"field\": \"order.total_amount_with_taxes\",\r\n        \"operator\": \"sum\"\r\n        \"sort\": \"desc\",\r\n        \"limit\": 2\r\n      }\r\n    }\r\n  }`"
      tags:
      - carts
      requestBody:
        required: true
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/carts_breakdown_request'
      responses:
        '200':
          description: The breakdown result from carts
          content:
            application/vnd.api+json:
              schema:
                type: object
                properties:
                  data:
                    oneOf:
                    - type: object
                      properties:
                        billing_address.business:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.city:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.country_code:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.geocoded:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.localized:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.state_code:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        billing_address.zip_code:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        customer.id:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        customer.email:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        customer.group_name:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        customer.reference:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                                      example: 8
                                    min:
                                      type: number
                                      example: 8
                                    max:
                                      type: number
                                      example: 8
                                    avg:
                                      type: number
                                      example: 8
                                    sum:
                                      type: number
                                      example: 8
                            additionalProperties:
                              type: object
                              properties:
                                label:
                                  type: string
                                value:
                                  oneOf:
                                  - type: number
                                    example: 8
                                  - type: string
                                  - type: object
                                    properties:
                                      count:
                                        type: number
                                        example: 8
                                      min:
                                        type: number
                                        example: 8
                                      max:
                                        type: number
                                        example: 8
                                      avg:
                                        type: number
                                        example: 8
                                      sum:
                                        type: number
                                        example: 8
                    - type: object
                      properties:
                        customer.reference_origin:
                          type: array
                          items:
                            type: object
                            properties:
                              label:
                                type: string
                              value:
                                oneOf:
                                - type: number
                                  example: 8
                                - type: string
                                - type: object
                                  properties:
                                    count:
                                      type: number
                   

# --- truncated at 32 KB (461 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/commerce-layer/refs/heads/main/openapi/commerce-layer-carts-api-openapi.yml