Create Checkout Task

This API creates an asynchronous AI-powered checkout task that manages the entire purchase lifecycle — from cart assembly and shipping selection to payment processing and order confirmation — across one or many merchants in a single call.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

How it Works

This is an asynchronous API. When you call POST /checkout, it does not wait for the checkout to complete. Instead, it:

  1. Validates your request and queues the task.
  2. Returns a taskId immediately (HTTP 201).
  3. Runs the checkout in the background using CartAI's AI agents.
  4. Sends real-time status updates to your configured webhook endpoint as the task progresses.

You use the returned taskId to either poll the task status via GET /checkout/{taskId}, or listen passively via webhooks.

⚠️

Do not re-submit the same payload on success. A 201 response means the task was accepted. Resubmitting creates a duplicate checkout.


Authentication

Every request must include your API key in the request header.

x-api-key: YOUR_API_KEY_HERE

Security rules you must follow:

  • Never expose your API key in client-side code, mobile apps, or public repositories.
  • Store it using environment variables or a secrets manager on your backend.

To get your API key, generate it from the CartAI Admin Portal after your account is provisioned. Contact the CartAI Account Management Team to request access.


Request Body

The request body is a JSON object with four top-level keys:

KeyTypeRequiredDescription
customerobject✅ YesCustomer identity, addresses, payment, and shipping preference
tasksarray of objects✅ YesOne or more products to purchase
optionsobject❌ NoExecution control flags
addonsobject❌ NoOptional enhancements such as coupon codes

customer (object, required)

Contains all information CartAI needs to identify the buyer, ship the order, and process payment.

customer.contact

Personal contact details of the buyer.

FieldTypeDescription
firstNamestringBuyer's given name, as it will appear on shipping labels.
lastNamestringBuyer's surname.
emailstring (email format)Valid email address. Used by the merchant for order confirmation.
phonestringContact phone number. Supports international formats (e.g. +15555555555). Pattern: ^[+0-9\- ]{7,20}$

customer.shippingAddress

Where the order should be physically delivered.

FieldTypeDescription
addressLine1stringPrimary street address (house number + street name).
addressLine2stringOptional — apartment, suite, floor, unit, etc.
citystringCity name.
provincestringState, province, or region. Can be abbreviated (NY) or full (New York).
postalCodestringZIP or postal code. Pattern: ^[A-Za-z0-9\- ]{3,10}$
countrystringCountry name or ISO code (e.g. US or United States).

customer.billingAddress

Billing address for the payment method. Uses the exact same schema as shippingAddress.

💡

If billing and shipping addresses are the same, send identical objects for both. The API does not auto-copy them.

customer.shippingMethod

Controls how the AI agent selects a shipping option at the merchant's checkout.

FieldTypeDescription
strategystringCurrently supported: "cheapest" and "fastest" — the default agent behavior is to select the lowest-cost ie cheapest shipping option available.

customer.payment

Configures how the checkout task pays for the order. CartAI delegates payment to an external provider rather than handling raw card data directly. For that see Payment Integration section from the Guide.

But to test the execution you can use Test Cards.

FieldTypeDescription
providerstringName of the payment provider. Example: "test". Must match a provider configured in your CartAI account.
datastringThe buyer's identifier within the payment provider's system. CartAI uses this to look up their stored payment credentials.

tasks (array of objects, required)

Each item in the array represents one product to purchase. A single API call can include products from one or many merchants — CartAI groups them automatically by merchant based on the product URL.


Task object fields

FieldTypeRequiredDescription
urlstring (URI)✅ YesFull product page URL on the merchant's website. CartAI's agent uses this to identify the merchant, navigate the product page, select variants, and proceed through checkout. Must be a canonical, publicly accessible URL. Avoid shortened URLs or redirect chains — use the final destination URL.
quantityinteger✅ YesNumber of units to purchase. Minimum: 1.
selectedVariantobject❌ NoSpecifies which product variant to select during checkout. If omitted, the agent may pick the default or fail if variant selection is mandatory.

selectedVariant fields

FieldTypeDescription
colorstringColor variant label as shown on the merchant's product page (e.g. "wild poppy atlas 5530"). Match the label exactly.
sizestringSize label (e.g. "S", "M", "32x30"). Match the merchant's exact display value.
⚠️

Variant labels are case-sensitive and must match exactly what the merchant's site displays. A mismatch can cause the agent to select the wrong variant or fail the task.



options (object, optional)

Execution control flags that modify the checkout agent's behaviour.

FieldTypeDefaultDescription
allowPartialCheckoutForMultiSkubooleanfalseWhen true, if some products in the tasks array fail (e.g. out of stock), CartAI will still complete the checkout for the remaining successful items. Recommended for multi-SKU or multi-merchant carts where partial fulfillment is acceptable. When false, any single task failure aborts the entire group.

addons (object, optional)

Optional enhancements to apply during checkout, such as discount codes.

FieldTypeDescription
couponCodearray of stringsOne or more coupon or promo codes to apply at checkout (e.g. ["SUMMER15"]). CartAI's agent will attempt to apply each code in order. Invalid codes are skipped.


Body Params
customer
object
required
tasks
array of objects
required
tasks*
options
object
addons
object
Headers
string
required
Responses

400

Bad Request

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json