Overview
Universal Commerce Protocol (UCP) enables AI assistants to discover, evaluate, and purchase your products. This guide walks you through implementing UCP endpoints on your domain.
Prerequisites
Before starting, ensure you have:
- Access to your domain's DNS and web server configuration
- Ability to create API endpoints
- Product catalog data in a structured format
- Basic understanding of REST APIs
Quick Start Guide
Step 1: Set Up Capability Discovery
Create a .well-known/ucp endpoint that exposes your UCP capabilities:
{
"version": "1.0",
"capabilities": {
"product_catalog": {
"endpoint": "https://yourdomain.com/ucp/products",
"format": "json"
},
"checkout": {
"endpoint": "https://yourdomain.com/ucp/checkout",
"supported_methods": ["POST"]
}
}
}
Step 2: Expose Product Catalog
Create a /ucp/products endpoint that returns your product catalog in UCP format:
{
"products": [
{
"id": "prod_123",
"name": "Running Shoes",
"description": "High-performance running shoes",
"price": {
"amount": 12999,
"currency": "USD"
},
"availability": "in_stock",
"variants": [
{
"id": "var_123_1",
"attributes": {
"size": "10",
"color": "black"
}
}
]
}
]
}
Step 3: Implement Checkout Endpoint
Create a /ucp/checkout endpoint that handles purchase requests:
{
"cart": {
"items": [
{
"product_id": "prod_123",
"variant_id": "var_123_1",
"quantity": 1
}
]
},
"shipping_address": {
"street": "123 Main St",
"city": "San Francisco",
"state": "CA",
"zip": "94102",
"country": "US"
}
}
First Endpoint Setup
1. Create .well-known Directory
On your web server, create a .well-known directory in your web root.
2. Add UCP Capability File
Create .well-known/ucp (or .well-known/ucp.json) with your capabilities.
3. Test Capability Discovery
Use curl or a browser to test:
curl https://yourdomain.com/.well-known/ucp
You should receive your capability JSON response.
Testing Your Implementation
Use the UCP Readiness Checker
Visit our UCP readiness checker to validate your implementation.
Manual Testing
- Verify
.well-known/ucp endpoint returns valid JSON
- Test product catalog endpoint returns products
- Verify checkout endpoint accepts valid requests
- Test error handling for invalid requests
Next Steps