UCP via REST
Paths are relative to the rest endpoint in the manifest.
REST binding
Paths are relative to the rest endpoint in the manifest.
POST /checkout-sessionsCreateGET /checkout-sessions/{id}RetrievePUT /checkout-sessions/{id}UpdatePOST /checkout-sessions/{id}/completeCompleteorder set.POST /checkout-sessions/{id}/cancelCancelHeaders
Send UCP-Agent with your platform's profile URI on every request, and Idempotency-Key on every mutation. Request-Id is accepted for tracing. Authorization is optional — send a linked-identity bearer token when you have one.
curl -X POST \
https://go.sessions.website/@<handle>/api/ucp/rest/checkout-sessions \
-H 'Content-Type: application/json' \
-H 'UCP-Agent: profile="https://you.example/ucp.json"' \
-H 'Idempotency-Key: 6f1e…' \
-d '{
"line_items": [
{"item": {"id": "gid://Sessions/ActivitySession/01J…"},
"quantity": 1}
],
"buyer": {"first_name": "Ada", "email": "ada@example.com"}
}'Paying
When the total is above zero, complete needs a credential in payment.instruments[]. Mark the instrument you want charged with selected: true; with a single instrument that is implied.
The token is a Stripe payment-method id created against the connected account the manifest advertises — initialise Stripe with the manifest's publishable_key and stripe_account, tokenize there, and send the resulting id. Sessions confirms it server-side on that same account.
curl -X POST \
https://…/api/ucp/rest/checkout-sessions/{id}/complete \
-H 'Content-Type: application/json' \
-H 'UCP-Agent: profile="https://you.example/ucp.json"' \
-H 'Idempotency-Key: 9c02…' \
-d '{
"payment": {
"instruments": [{
"handler_id": "stripe",
"selected": true,
"credential": {
"type": "PAYMENT_GATEWAY",
"token": "pm_1N…"
}
}]
}
}'Status codes
A non-2xx is a protocol error with {code, content}; a 200 carrying messages is a business outcome.
200status and messages for what happened.201400404405Allow header names the ones that are.409429Retry-After.The message codes a 200 can carry are the same across both bindings. See the protocol summary