K
Kifly
Developer Docs
Agent Integration

Kifly REST API

The HTTP surface behind every Kifly integration. Anything an MCP tool does, you can do here.


Base URL

https://kifly.ai

Authentication

No key needed. Identify your agent with its UCP profile URL and start. Without a key you can use search, store lookups, carts, the shipping address, the payment link, order status, cancelling a checkout and feedback.

UCP-Agent: profile="https://<your-domain>/.well-known/ucp"

A bare URL also works: UCP-Agent: https://<your-domain>/.well-known/ucp. Replace <your-domain> with a domain you control: the URL must be absolute https:, and placeholder and reserved domains such as example.com are refused.

A key adds more: no daily limit, the buyer's saved address and email pre-filled, their order history across sessions, and USDC payment without a human step. Buyer-identity calls and USDC payment without a human step need one. Sign in with OAuth 2.1 (your MCP client offers it), or have your operator confirm one emailed code (POST /api/agent/credentials).

A key or OAuth token. OAuth 2.1 with Dynamic Client Registration is advertised at /.well-known/oauth-authorization-server, and buyer:write is a supported scope. See MCP Integration for which credential fits.

Authorization: Bearer kfa_live_xxxxxxxxxxxx

If Authorization is present it is always used, so an invalid key returns 401 rather than falling back to the open path. To shop without a key, drop the header and send your UCP-Agent profile.

A signing domain (platforms). If your agents sign their requests with HTTP Message Signatures (RFC 9421, Web Bot Auth, or Visa Trusted Agent Protocol's agent-payer-auth), register your domain once instead of giving each agent a key:

  1. POST /api/agent/operators/hosts/request with { "operator_email", "host" }. We email that address a code.
  2. POST /api/agent/operators/hosts/register with { "request_id", "code" }, signed with a key listed in your UCP profile's keys[] or your domain's /.well-known/http-message-signatures-directory, and a UCP-Agent profile on that domain.

After that, a paid request with no key, signed the same way under your domain and covering the payment header, pays as yours. A domain that is not registered gets AGENT_CREDENTIAL_REQUIRED.

curl -sS 'https://kifly.ai/api/agent/search?q=hat&limit=3' \
  -H 'UCP-Agent: profile="https://<your-domain>/.well-known/ucp"'

Several items in one search. Repeat q once per item the shopper wants, up to 5: ?q=dog+shampoo&q=cat+collar&q=dark+roast+coffee. Describe each item in the shopper's own words; a keyword phrasing can ride along as another query. Each query keeps its own results and the page takes them in turn, so every item gets its share. Each result carries kifly:matchedQuery (the index of the query that found it), and kifly:queryResults gives each query's count and says which found nothing. One string with commas is searched as one product.


Open endpoints

These accept UCP-Agent or a credential.

MethodPathWhat it does
GET/api/agent/searchSearch or browse the catalog
GET/api/agent/sellersList sellers
GET/api/agent/sellerOne seller, by handle, domain or name
GET/api/agent/policiesA seller's store policies
POST/api/agent/cartCreate a cart
GET DELETE/api/agent/cart/{id}Read or cancel a cart
POST/api/agent/cart/{id}/itemsAdd a line item
PATCH DELETE/api/agent/cart/{id}/items/{itemId}Change quantity, or remove
POST/api/agent/cart/{id}/shipping-addressSet the shipping address
POST/api/agent/quick-buyCart, item and address in one call
POST/api/agent/payment-linkA payment link the buyer confirms
POST/api/agent/feedbackReport a problem
GET/api/agent/platform/limitsLive cart limits
GET/api/agent/docs/{slug}These pages as JSON

Buyer identity, order history and paying from the agent's own wallet (POST /api/agent/cart/{id}/checkout, or a paid request to a product's /api/x402/{handle}/{slug}) require a credential. See Payment Rails, and for an agent that pays on its own, Autonomous payments with x402.

Say which agent on your platform you are: Kifly-Agent: id="<stable opaque id>", name="<display name>". If your profile names your platform (a bare /.well-known/ucp), it is shared by every agent on it, so carts and checkout require this header (AGENT_ID_REQUIRED otherwise); browsing does not. A profile URL that names the agent (/agents/<name>) needs nothing more. Past the keyless daily allowance, or when Kifly asks an agent to identify itself, calls get 401 SIGN_IN_REQUIRED with a WWW-Authenticate header naming the OAuth server; sign in, or use an issued key, to continue.


Standard UCP endpoints

If your agent already speaks the Universal Commerce Protocol, it needs nothing Kifly-specific. Kifly serves the spec's shopping service (dev.ucp.shopping) over both of its transports, and your agent finds them under services["dev.ucp.shopping"] in /.well-known/ucp.

TransportEndpointContract
RESThttps://kifly.ai/api/ucp/restrest.openapi.json
MCPhttps://kifly.ai/api/ucp/mcpmcp.openrpc.json

Over REST, append the spec's paths to the endpoint:

MethodPathWhat it does
POST/catalog/searchSearch the catalog
POST/catalog/lookupProducts or variants by id, up to 20
POST/catalog/productOne product, with its options
POST/cartsCreate a cart
GET PUT/carts/{id}Read a cart, or replace its line items
POST/carts/{id}/cancelCancel a cart
POST/checkout-sessionsCreate a checkout
GET PUT/checkout-sessions/{id}Read a checkout, or update its items and shipping address
POST/checkout-sessions/{id}/completeHand the checkout to the buyer
POST/checkout-sessions/{id}/cancelCancel a checkout
GET/orders/{id}The order, once the buyer has paid
curl -sS -X POST 'https://kifly.ai/api/ucp/rest/catalog/search' \
  -H 'UCP-Agent: profile="https://<your-domain>/.well-known/ucp"' \
  -H 'Content-Type: application/json' \
  -d '{"query":"linen shirt"}'
  • Identify with UCP-Agent, as above. Your profile must declare each capability you call, at the version in Kifly's profile (2026-08-25).
  • Writes (every PUT, and every POST except the three catalog reads) need an Idempotency-Key of 16 to 64 characters. The same key and body returns the original answer; the same key with a different body is 409.
  • Status codes follow the spec. Business outcomes, including not found and out of stock, are 200 with messages; creating a cart or checkout is 201. A missing or invalid profile is 400, a profile Kifly cannot fetch is 424, an unreadable or unsupported one is 422. A 429 or 503 carries Retry-After.
  • Completing a checkout never takes payment. It returns status: "requires_escalation" and a continue_url the buyer opens to review and pay.
  • Recorded facts. Each product's metadata["ai.kifly.attributes"] holds the facts recorded for it (colour, size, material, weight, what it fits and more); absent means not recorded, not "no". A search narrows with filters.color, filters.size and filters.material next to a query: a list, or commas, give alternatives, and any one matches. A filter is answered by a recorded fact or by one of the seller's own options (a Colour, Size or Material axis); a product with neither is left out, and a message says how many.
  • One seller's catalog. A seller's own UCP profile points at https://kifly.ai/api/ucp/rest/sellers/<handle>, which serves only that seller.

Idempotency

Every POST, PATCH and DELETE needs an Idempotency-Key of 16 to 64 characters. Retrying with the same key returns the original response.

Idempotency-Key: <a-uuid-you-generate-per-request>

Errors

Every failure is JSON with a stable code:

{ "error": "human readable prose", "code": "STABLE_SCREAMING_SNAKE" }

Branch on code, not error. A 503 carries Retry-After; retry it. Full list in the Error Reference.


Machine-readable contracts

WhatWhere
UCP capability manifestGET /.well-known/ucp
MCP method contract (OpenRPC)GET /api/mcp/openrpc.json
Standard UCP shopping service, RESTrest.openapi.json at /api/ucp/rest
Standard UCP shopping service, MCPmcp.openrpc.json at /api/ucp/mcp