Catalog Capability

From search to cart

A shopper wants two blue 750 ml bottles. Follow the UCP 2026-08-25 REST flow from that search to a new cart. The requests and responses use simulated merchant data that you can validate offline against the pinned schemas.

Fetch the merchant’s Profile at /.well-known/ucp and select the negotiated rest endpoint from ucp.services["dev.ucp.shopping"]. Confirm that both sides negotiate the same version of dev.ucp.shopping.catalog.search, dev.ucp.shopping.catalog.lookup, and dev.ucp.shopping.cart. Append each path below to that endpoint and send Content-Type: application/json. Set UCP-Agent to the caller’s own Profile URL in dictionary syntax, such as profile="https://platform.example/.well-known/ucp". Keep the same US context in each request to compare results for one market.

1. Search for the product

Send POST /catalog/search. Use query to describe what the shopper wants.

Request

{
  "query": "blue 750 ml bottle",
  "context": {
    "address_country": "US"
  }
}

Response

{
  "ucp": {
    "version": "2026-08-25",
    "capabilities": {
      "dev.ucp.shopping.catalog.search": [
        {
          "version": "2026-08-25"
        }
      ]
    }
  },
  "products": [
    {
      "id": "trail-bottle",
      "title": "Trail Bottle",
      "description": {
        "plain": "Reusable trail bottle"
      },
      "price_range": {
        "min": {
          "amount": 1800,
          "currency": "USD"
        },
        "max": {
          "amount": 1800,
          "currency": "USD"
        }
      },
      "variants": [
        {
          "id": "trail-bottle-750-blue",
          "title": "Blue · 750 ml",
          "description": {
            "plain": "Blue 750 ml bottle"
          },
          "price": {
            "amount": 1800,
            "currency": "USD"
          },
          "availability": {
            "available": true
          }
        }
      ]
    }
  ]
}

Read the product ID trail-bottle from products[] and the chosen variant ID trail-bottle-750-blue from variants[]. The amount 1800 in USD minor units represents $18.00. The availability.available field reports availability at the time of the catalog response.

2. Look up the chosen variant

Send POST /catalog/lookup. Include a missing red variant to see how the batch handles a partial match.

Request

{
  "ids": [
    "trail-bottle-750-blue",
    "trail-bottle-750-red"
  ],
  "context": {
    "address_country": "US"
  }
}

Response

{
  "ucp": {
    "version": "2026-08-25",
    "capabilities": {
      "dev.ucp.shopping.catalog.lookup": [
        {
          "version": "2026-08-25"
        }
      ]
    }
  },
  "products": [
    {
      "id": "trail-bottle",
      "title": "Trail Bottle",
      "description": {
        "plain": "Reusable trail bottle"
      },
      "price_range": {
        "min": {
          "amount": 1800,
          "currency": "USD"
        },
        "max": {
          "amount": 1800,
          "currency": "USD"
        }
      },
      "variants": [
        {
          "id": "trail-bottle-750-blue",
          "title": "Blue · 750 ml",
          "description": {
            "plain": "Blue 750 ml bottle"
          },
          "price": {
            "amount": 1800,
            "currency": "USD"
          },
          "availability": {
            "available": true
          },
          "inputs": [
            {
              "id": "trail-bottle-750-blue",
              "match": "exact"
            }
          ]
        }
      ]
    }
  ],
  "messages": [
    {
      "type": "info",
      "code": "not_found",
      "content": "trail-bottle-750-red"
    }
  ]
}

Correlate the result to the request using id and match in variants[].inputs[]. An exact match resolves directly to the variant. A featured match identifies a representative variant the merchant chose for the matched product. A batch can return HTTP 200 with only the products it found and may include a not_found message. Use the input correlations to identify missing results. To retrieve one product and its available options, use the Lookup capability’s POST /catalog/product with a single id.

3. Create a cart

Send POST /carts. Set line_items[].item.id to the blue variant ID the merchant accepts for carts, and set the quantity to 2. The product ID identifies the product. The merchant decides whether to accept a sku as a lookup identifier.

Request

{
  "line_items": [
    {
      "item": {
        "id": "trail-bottle-750-blue"
      },
      "quantity": 2
    }
  ],
  "context": {
    "address_country": "US"
  }
}

Response

{
  "ucp": {
    "version": "2026-08-25",
    "capabilities": {
      "dev.ucp.shopping.cart": [
        {
          "version": "2026-08-25"
        }
      ],
      "dev.ucp.shopping.checkout": [
        {
          "version": "2026-08-25"
        }
      ]
    }
  },
  "id": "cart_bottles",
  "line_items": [
    {
      "id": "li_bottle",
      "item": {
        "id": "trail-bottle-750-blue",
        "title": "Blue · 750 ml",
        "price": 1900
      },
      "quantity": 2,
      "totals": [
        {
          "type": "subtotal",
          "amount": 3800
        },
        {
          "type": "total",
          "amount": 3800
        }
      ]
    }
  ],
  "currency": "USD",
  "totals": [
    {
      "type": "subtotal",
      "amount": 3800
    },
    {
      "type": "total",
      "amount": 3800
    }
  ]
}

The successful example returns HTTP 201. Save the cart ID cart_bottles and check the returned items, quantities, messages[], and totals[]. The current price is $19.00 per bottle, so two cost $38.00. Ask the shopper to confirm the updated amount before proceeding to checkout.

If Cart reports ucp.status: error and out_of_stock, check whether it created a cart even if the HTTP status is 200. The all-items-out-of-stock example creates no cart. For partial availability, use the retained line items and messages to decide whether to adjust quantities or return to the catalog. Cart creation and stock error example

The cart at this point still has no payment or fulfillment details. To turn it into a checkout session, initialize from the cart_id as described in Cart-to-Checkout Conversion. Run the official Flower Shop locally is a separate exercise: it ships its own sample data and does not take this tutorial’s cart_bottles, walking the full cart-to-checkout path on a loopback merchant with simulated payment data — for local practice only, not production charges.

Pinned sources