Closed beta · run Worlds on your machineBrowse worlds →
Docs menu · Shopify API

Worlds / Commerce

Shopify API

A local Shopify store with products, variants, orders, fulfillments, refunds and inventory per location. Test the agent that refunds line items, cancels orders and restocks the right location.

Base path
/admin/api/2024-10
Auth
X-Shopify-Access-Token header, the world key
Endpoints
15
Status
Active today

This reference previews the surface the Shopify world serves in the closed beta. Paths mirror the public Shopify API; the exact subset is confirmed when your workflow is scoped.

Connect

The run gives your agent these bindings. Keep your SDK; change only where it sends requests.

bindingmeaning
WORLDS_SHOPIFY_URLThis world's origin followed by /admin/api/2024-10
WORLDS_API_KEYThe world key, accepted wherever Shopify expects a credential
WORLDS_WORLD_IDThe isolated world's identity
js · @shopify/admin-api-client
import { createAdminApiClient } from "@shopify/admin-api-client";

const client = createAdminApiClient({
  storeDomain: process.env.WORLDS_SHOPIFY_URL,
  apiVersion: "2024-10",
  accessToken: process.env.WORLDS_API_KEY,
});

const { data } = await client.request("{ orders(first: 5) { nodes { id name } } }");

API reference

Orders

Customer purchases and their payment and fulfillment state.

  • POST/admin/api/2024-10/graphql.json · ordersList orders
  • POST/admin/api/2024-10/graphql.json · orderGet an order
  • POST/admin/api/2024-10/graphql.json · orderUpdateUpdate an order
  • POST/admin/api/2024-10/graphql.json · orderCancelCancel an order
  • POST/admin/api/2024-10/graphql.json · refundCreateRefund an order
Fields · 6
idIDOrder global id
nameStringOrder number like #1001
displayFinancialStatusenumPAID, REFUNDED, PENDING and so on
displayFulfillmentStatusenumFULFILLED, UNFULFILLED and so on
totalPriceSetMoneyBagOrder total
customerCustomerBuyer

Products

Items for sale with variants.

  • POST/admin/api/2024-10/graphql.json · productsList products
  • POST/admin/api/2024-10/graphql.json · productCreateCreate a product
  • POST/admin/api/2024-10/graphql.json · productUpdateUpdate a product
Fields · 5
idIDProduct global id
titleStringTitle
statusenumACTIVE, DRAFT or ARCHIVED
variantsconnectionVariants with price and sku
totalInventoryIntUnits in stock

Customers

People who buy from the store.

  • POST/admin/api/2024-10/graphql.json · customersList customers
  • POST/admin/api/2024-10/graphql.json · customerCreateCreate a customer
  • POST/admin/api/2024-10/graphql.json · customerUpdateUpdate a customer
Fields · 5
idIDCustomer global id
emailStringEmail address
firstNameStringFirst name
numberOfOrdersUnsignedInt64Order count
amountSpentMoneyV2Lifetime spend

Fulfillments

Shipments sent for an order.

  • POST/admin/api/2024-10/graphql.json · fulfillmentCreateV2Create a fulfillment
  • POST/admin/api/2024-10/graphql.json · fulfillmentCancelCancel a fulfillment
Fields · 4
idIDFulfillment global id
statusenumSUCCESS, CANCELLED and so on
trackingInfoarrayCarrier and tracking number
fulfillmentLineItemsconnectionItems shipped

Inventory

Stock levels per location.

  • POST/admin/api/2024-10/graphql.json · inventoryItemsList inventory items
  • POST/admin/api/2024-10/graphql.json · inventoryAdjustQuantitiesAdjust stock
Fields · 4
idIDInventory item id
skuStringStock keeping unit
inventoryLevelsconnectionQuantities by location
trackedBooleanWhether stock is tracked

Test workflow

  1. Prepare. Select the Shopify setup for your workflow and review its starting records, including orders, products, customers.
  2. Connect. Configure your agent with this world's URL and key using the SDK example. Check that it reaches the intended API before running a test.
  3. Define. Describe the task, expected final changes and records that must stay untouched. Keep expected outcomes separate from the agent's instructions.
  4. Run and inspect. Use the dashboard or your workflow's generated CLI setup. Review final records and changes, then rerun from the same starting setup with the relevant failure conditions. Use Deployment and CI to automate the same workflow.

What to verify

  • #1042 partially refunded for one line item
  • #1044 untouched
  • Restocked quantity added at Warehouse East
  • #1045 voided, no refund created
  • #1046 from the second Dana Lee untouched

Test file

A task file names the jobs, the policy your agent is given and what the grader reads back from the world's final state. The agent never sees the expected outcomes.

yaml · worlds/tasks.yaml
# worlds/tasks.yaml · Shopify
version: 2
connector: shopify
seed: shopify-starter
mode: isolated
policy: >
  Handle today's return requests. Refund damaged items only, not the whole
  order, and restock to the location they shipped from. Void the unpaid order
  from Ortiz Labs.
tasks:
  - id: refund-one-line-item-and-restock-it
    prompt: Refund one line item and restock it
  - id: cancel-an-unfulfilled-order-with-the-right-reason
    prompt: Cancel an unfulfilled order with the right reason
  - id: adjust-inventory-at-a-single-location
    prompt: Adjust inventory at a single location
expected:
  - "#1042 partially refunded for one line item"
  - "#1044 untouched"
  - Restocked quantity added at Warehouse East
  - "#1045 voided, no refund created"
  - "#1046 from the second Dana Lee untouched"
scenarios:
  - throttled
  - user-error
  - already-fulfilled

See Tasks and outcomes for every field, and Deployment and CI to run the file on every pull request.

Failure conditions

Each one fires before the handler, at the same step on every run.

conditionwhat the agent sees
throttledGraphQL returns THROTTLED when the cost bucket is empty
user-erroruserErrors on refundCreate when the amount exceeds what was paid
already-fulfilledThe order shipped before the agent acted
gateway-timeoutThe refund call times out once and the retry must not double refund
webhook-twiceorders/updated arrives two times

Starting data

Start each run from the same records and relationships. The overview below describes the Shopify starter; use the setup supplied for your workflow when preparing your own snapshot.

RecordsStarting setup
products30 with 90 variants
orders50 paid, partially refunded, refunded and pending
fulfillments35 fulfilled, 10 unfulfilled
locationsWarehouse East and Retail Store
customers40, two named Dana Lee

The record shapes below reuse this world's API field definitions. They show illustrative values and placeholders, not an importable seed. API responses and seed input can differ; include all required records and references in the accepted import format for your workflow.

Orders records

Orders

Customer purchases and their payment and fulfillment state.

FieldTypeMeaning / relationship
idIDOrder global id
nameStringOrder number like #1001
displayFinancialStatusenumPAID, REFUNDED, PENDING and so on
displayFulfillmentStatusenumFULFILLED, UNFULFILLED and so on
totalPriceSetMoneyBagOrder total
customerCustomerBuyer
json · illustrative record shape
{
  "id": "<Order global id>",
  "name": "<Order number like #1001>",
  "displayFinancialStatus": "<PAID, REFUNDED, PENDING and so on>",
  "displayFulfillmentStatus": "<FULFILLED, UNFULFILLED and so on>",
  "totalPriceSet": "<Order total>",
  "customer": "<Buyer>"
}

See orders operations

Products records

Products

Items for sale with variants.

FieldTypeMeaning / relationship
idIDProduct global id
titleStringTitle
statusenumACTIVE, DRAFT or ARCHIVED
variantsconnectionVariants with price and sku
totalInventoryIntUnits in stock
json · illustrative record shape
{
  "id": "<Product global id>",
  "title": "<Title>",
  "status": "<ACTIVE, DRAFT or ARCHIVED>",
  "variants": "<Variants with price and sku>",
  "totalInventory": 1
}

See products operations

Customers records

Customers

People who buy from the store.

FieldTypeMeaning / relationship
idIDCustomer global id
emailStringEmail address
firstNameStringFirst name
numberOfOrdersUnsignedInt64Order count
amountSpentMoneyV2Lifetime spend
json · illustrative record shape
{
  "id": "<Customer global id>",
  "email": "person@example.test",
  "firstName": "<First name>",
  "numberOfOrders": "<Order count>",
  "amountSpent": "<Lifetime spend>"
}

See customers operations

Fulfillments records

Fulfillments

Shipments sent for an order.

FieldTypeMeaning / relationship
idIDFulfillment global id
statusenumSUCCESS, CANCELLED and so on
trackingInfoarrayCarrier and tracking number
fulfillmentLineItemsconnectionItems shipped
json · illustrative record shape
{
  "id": "<Fulfillment global id>",
  "status": "<SUCCESS, CANCELLED and so on>",
  "trackingInfo": [],
  "fulfillmentLineItems": "<Items shipped>"
}

See fulfillments operations

Inventory records

Inventory

Stock levels per location.

FieldTypeMeaning / relationship
idIDInventory item id
skuStringStock keeping unit
inventoryLevelsconnectionQuantities by location
trackedBooleanWhether stock is tracked
json · illustrative record shape
{
  "id": "<Inventory item id>",
  "sku": "<Stock keeping unit>",
  "inventoryLevels": "<Quantities by location>",
  "tracked": false
}

See inventory operations

See the Shopify world in the catalog