Commerce Layer · Capability

Commerce Layer Metrics API — Returns

Analytics queries for returns.

Commerce Layer Metrics API — Returns is a Naftiko capability published by Commerce Layer, one of 16 capabilities the APIs.io network indexes for this provider. It bundles 5 operations across the POST method rooted at /api/returns.

The capability includes 5 state-changing operations. Lead operation: Run A Returns Breakdown Query. Can be deployed as a REST endpoint, MCP tool, or Agent Skill via Naftiko.

Tagged areas include Commerce Layer.

Run with Naftiko Commerce Layer

What You Can Do

POST
Returnsbreakdown
/api/returns/breakdown
POST
Returnsdatebreakdown
/api/returns/date_breakdown
POST
Returnsstats
/api/returns/stats
POST
Returnssearch
/api/returns/search
POST
Returnsexport
/api/returns/export

MCP Tools

commerce-layer-returnsbreakdown

Run A Returns Breakdown Query

commerce-layer-returnsdatebreakdown

Run A Returns Date-Breakdown Query

commerce-layer-returnsstats

Run A Returns Stats Query

commerce-layer-returnssearch

Run A Returns Search Query

commerce-layer-returnsexport

Run A Returns Export Query

Capability Spec

metrics-returns.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Commerce Layer Metrics API — Returns
  description: 'Analytics queries for returns.'
  tags:
  - Commerce Layer
  created: '2026-05-25'
  modified: '2026-05-25'
binds:
- namespace: env
  keys:
    COMMERCE_LAYER_ACCESS_TOKEN: COMMERCE_LAYER_ACCESS_TOKEN
    COMMERCE_LAYER_ORG_SLUG: COMMERCE_LAYER_ORG_SLUG
capability:
  consumes:
  - type: http
    namespace: metrics-returns
    baseUri: https://{{env.COMMERCE_LAYER_ORG_SLUG}}.commercelayer.io/metrics
    description: Commerce Layer Metrics API — Returns business surface.
    resources:
    - name: returns-breakdown
      path: /returns/breakdown
      operations:
      - name: returnsbreakdown
        method: POST
        description: Run A Returns Breakdown Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    - name: returns-date_breakdown
      path: /returns/date_breakdown
      operations:
      - name: returnsdatebreakdown
        method: POST
        description: Run A Returns Date-Breakdown Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    - name: returns-stats
      path: /returns/stats
      operations:
      - name: returnsstats
        method: POST
        description: Run A Returns Stats Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    - name: returns-search
      path: /returns/search
      operations:
      - name: returnssearch
        method: POST
        description: Run A Returns Search Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    - name: returns-export
      path: /returns/export
      operations:
      - name: returnsexport
        method: POST
        description: Run A Returns Export Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          required: true
    authentication:
      type: oauth2
      flow: client_credentials
      tokenUrl: https://auth.commercelayer.io/oauth/token
      value: 'Bearer {{env.COMMERCE_LAYER_ACCESS_TOKEN}}'
      placement: header
      key: Authorization
  exposes:
  - type: rest
    namespace: metrics-returns-rest
    port: 8080
    description: REST adapter for Commerce Layer Metrics API — Returns.
    resources:
    - path: /api/returns/breakdown
      name: returns-breakdown
      operations:
      - method: POST
        name: returnsbreakdown
        call: metrics-returns.returnsbreakdown
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /api/returns/date_breakdown
      name: returns-date-breakdown
      operations:
      - method: POST
        name: returnsdatebreakdown
        call: metrics-returns.returnsdatebreakdown
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /api/returns/stats
      name: returns-stats
      operations:
      - method: POST
        name: returnsstats
        call: metrics-returns.returnsstats
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /api/returns/search
      name: returns-search
      operations:
      - method: POST
        name: returnssearch
        call: metrics-returns.returnssearch
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /api/returns/export
      name: returns-export
      operations:
      - method: POST
        name: returnsexport
        call: metrics-returns.returnsexport
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: metrics-returns-mcp
    port: 9090
    transport: http
    description: MCP adapter for Commerce Layer Metrics API — Returns.
    tools:
    - name: commerce-layer-returnsbreakdown
      description: Run A Returns Breakdown Query
      hints:
        readOnly: false
        idempotent: false
        destructive: false
      call: metrics-returns.returnsbreakdown
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: commerce-layer-returnsdatebreakdown
      description: Run A Returns Date-Breakdown Query
      hints:
        readOnly: false
        idempotent: false
        destructive: false
      call: metrics-returns.returnsdatebreakdown
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: commerce-layer-returnsstats
      description: Run A Returns Stats Query
      hints:
        readOnly: false
        idempotent: false
        destructive: false
      call: metrics-returns.returnsstats
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: commerce-layer-returnssearch
      description: Run A Returns Search Query
      hints:
        readOnly: false
        idempotent: false
        destructive: false
      call: metrics-returns.returnssearch
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: commerce-layer-returnsexport
      description: Run A Returns Export Query
      hints:
        readOnly: false
        idempotent: false
        destructive: false
      call: metrics-returns.returnsexport
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.