Commerce Layer · Arazzo Workflow

Commerce Layer Create Return with Line Item

Version 1.0.0

Open a return against an order, add a return line item for an order line item, then request it.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub Headless CommerceComposable CommerceAPI-FirstE-CommerceJSON:APIAuthenticationMulti-MarketMulti-CurrencyB2CB2BSubscriptionPromotionsInventoryOrder ManagementCheckoutArazzoWorkflows

Provider

commerce-layer

Workflows

create-return-with-line-item
Create a return, add a return line item, and request the return.
Creates a return for an order, adds a return line item referencing an order line item, then patches the return with the documented _request flag.
3 steps inputs: accessToken, lineItemId, orderId, quantity outputs: returnId, returnLineItemId, status
1
createReturn
Create the return associated to the order.
2
addReturnLineItem
Add a return line item referencing the return and the order line item.
3
requestReturn
Toggle the documented _request transition flag to submit the return.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Commerce Layer Create Return with Line Item
  summary: Open a return against an order, add a return line item for an order line item, then request it.
  description: >-
    The Commerce Layer post-purchase returns flow. The workflow creates a return
    associated to an order, adds a return line item that references both the
    return and an original order line item with a return quantity, and then
    patches the return with the documented _request transition flag to submit
    it. Every step spells out its JSON:API request inline so the flow can be
    read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: returnLineItemsApi
  url: ../openapi/commerce-layer-return-line-items-api-openapi.yml
  type: openapi
- name: returnsApi
  url: ../openapi/commerce-layer-returns-api-openapi.yml
  type: openapi
workflows:
- workflowId: create-return-with-line-item
  summary: Create a return, add a return line item, and request the return.
  description: >-
    Creates a return for an order, adds a return line item referencing an order
    line item, then patches the return with the documented _request flag.
  inputs:
    type: object
    required:
    - accessToken
    - orderId
    - lineItemId
    - quantity
    properties:
      accessToken:
        type: string
        description: Bearer access token for the Commerce Layer organization.
      orderId:
        type: string
        description: The id of the order the return is for.
      lineItemId:
        type: string
        description: The id of the original order line item being returned.
      quantity:
        type: integer
        description: The quantity of the line item to return.
  steps:
  - stepId: createReturn
    description: Create the return associated to the order.
    operationId: POST/returns
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: returns
          relationships:
            order:
              data:
                type: orders
                id: $inputs.orderId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      returnId: $response.body#/data/id
  - stepId: addReturnLineItem
    description: Add a return line item referencing the return and the order line item.
    operationId: POST/return_line_items
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: return_line_items
          attributes:
            quantity: $inputs.quantity
          relationships:
            return:
              data:
                type: returns
                id: $steps.createReturn.outputs.returnId
            line_item:
              data:
                type: line_items
                id: $inputs.lineItemId
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      returnLineItemId: $response.body#/data/id
  - stepId: requestReturn
    description: Toggle the documented _request transition flag to submit the return.
    operationId: PATCH/returns/returnId
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.accessToken"
    - name: returnId
      in: path
      value: $steps.createReturn.outputs.returnId
    requestBody:
      contentType: application/vnd.api+json
      payload:
        data:
          type: returns
          id: $steps.createReturn.outputs.returnId
          attributes:
            _request: true
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/data/attributes/status
  outputs:
    returnId: $steps.createReturn.outputs.returnId
    returnLineItemId: $steps.addReturnLineItem.outputs.returnLineItemId
    status: $steps.requestReturn.outputs.status

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/commerce-layer-create-return-with-line-item-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.