Swell · Arazzo Workflow

Swell Find-or-Create Customer and Order

Version 1.0.0

Look up a customer by email and reuse it or create it, then place an order.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub CommerceHeadless CommerceAPI-FirstB2CB2BSubscriptionMarketplacesWholesaleStorefrontCheckoutPaymentsCartOrderCatalogInternationalizationArazzoWorkflows

Provider

swell-io

Workflows

find-or-create-customer-and-order
Resolve a customer by email, creating one if absent, then place an order.
Filters accounts by email; on a hit it reuses the matched account id, on a miss it creates a new account, then both paths create an order.
4 steps inputs: currency, email, first_name, items, last_name outputs: newAccountOrderId, orderId
1
findAccountStep
Search accounts for one whose email matches the supplied value, returning at most one match.
2
orderForExistingStep
Create an order for the matched existing account.
3
createAccountStep
Create a new account because no existing account matched the email.
4
orderForNewStep
Create an order for the newly created account.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Swell Find-or-Create Customer and Order
  summary: Look up a customer by email and reuse it or create it, then place an order.
  description: >-
    A branching find-then-act flow that prevents duplicate customer records. The
    workflow searches accounts for a matching email using a where filter and
    branches: when a match is found it reuses that account id, and when none is
    found it creates a new account. Either branch converges on creating an order
    for the resolved account. Each step spells out its request inline so the flow
    can be read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: accountsApi
  url: ../openapi/swell-io-accounts-api-openapi.yml
  type: openapi
- name: ordersApi
  url: ../openapi/swell-io-orders-api-openapi.yml
  type: openapi
workflows:
- workflowId: find-or-create-customer-and-order
  summary: Resolve a customer by email, creating one if absent, then place an order.
  description: >-
    Filters accounts by email; on a hit it reuses the matched account id, on a
    miss it creates a new account, then both paths create an order.
  inputs:
    type: object
    required:
    - email
    - items
    properties:
      email:
        type: string
        description: Customer email used to match an existing account.
      first_name:
        type: string
        description: First name used when creating a new account.
      last_name:
        type: string
        description: Last name used when creating a new account.
      currency:
        type: string
        description: ISO 4217 currency code for the order.
      items:
        type: array
        description: Order line items.
        items:
          type: object
  steps:
  - stepId: findAccountStep
    description: >-
      Search accounts for one whose email matches the supplied value, returning
      at most one match.
    operationId: listAccounts
    parameters:
    - name: where
      in: query
      value:
        email: $inputs.email
    - name: limit
      in: query
      value: 1
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      matchedAccountId: $response.body#/results/0/id
    onSuccess:
    - name: accountExists
      type: goto
      stepId: orderForExistingStep
      criteria:
      - context: $response.body
        condition: $.results.length > 0
        type: jsonpath
    - name: accountMissing
      type: goto
      stepId: createAccountStep
      criteria:
      - context: $response.body
        condition: $.results.length == 0
        type: jsonpath
  - stepId: orderForExistingStep
    description: Create an order for the matched existing account.
    operationId: createOrder
    requestBody:
      contentType: application/json
      payload:
        account_id: $steps.findAccountStep.outputs.matchedAccountId
        items: $inputs.items
        currency: $inputs.currency
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      orderId: $response.body#/id
      orderNumber: $response.body#/number
    onSuccess:
    - name: done
      type: end
  - stepId: createAccountStep
    description: Create a new account because no existing account matched the email.
    operationId: createAccount
    requestBody:
      contentType: application/json
      payload:
        email: $inputs.email
        first_name: $inputs.first_name
        last_name: $inputs.last_name
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      accountId: $response.body#/id
  - stepId: orderForNewStep
    description: Create an order for the newly created account.
    operationId: createOrder
    requestBody:
      contentType: application/json
      payload:
        account_id: $steps.createAccountStep.outputs.accountId
        items: $inputs.items
        currency: $inputs.currency
    successCriteria:
    - condition: $statusCode == 201
    outputs:
      orderId: $response.body#/id
      orderNumber: $response.body#/number
  outputs:
    orderId: $steps.orderForExistingStep.outputs.orderId
    newAccountOrderId: $steps.orderForNewStep.outputs.orderId

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/swell-io-find-or-create-customer-order-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.