Returns any input a checkout task is waiting for. Poll this endpoint while an interactive checkout (allowInteraction: true) runs. An empty data array means the agent isn't waiting. Each pending request has an id; answer it once with Send Interactive Inputs, and keep polling until the task reaches a terminal status.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Returns any input a checkout task is waiting for, by sending a GET request with the taskId in the path. Poll this endpoint while an interactive checkout (allowInteraction: true) runs to find out when the agent needs something from the customer.
When to Use This Endpoint
When a checkout task is created with options.allowInteraction: true, the agent pauses whenever the merchant asks for something it does not have, such as a login code or an order confirmation. This endpoint tells you whether the agent is waiting right now and what it needs.
| Scenario | Description |
|---|---|
| Polling instead of webhooks | Your system can't receive checkout task webhooks yet. Poll this endpoint to find out when the agent needs input. |
| Missed or delayed webhook | A webhook with requiredInputs didn't arrive or your handler failed. Poll to pick up the pending request. |
| Building your own UI | Read inputSchema to build a form, then send the answer with Send Interactive Inputs. |
Only for interactive checkouts. If the task was created withoutallowInteraction: true, the agent never pauses for input and this endpoint always returns an emptydataarray.
Authentication
Every request must include your API key in the request header.
x-api-key: YOUR_API_KEY_HERE- Always call this endpoint from your backend. Never expose your API key in client-side code.
Request
GET /checkout/{taskId}/status/interactive
No request body is required. Pass the taskId as a path parameter.
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
taskId | Path | string (UUID) | ✅ Yes | The taskId returned by Create Checkout Task or Create Search Checkout Task. |
x-api-key | Header | string | ✅ Yes | Your CartAI API key. |
Full Request Example
curl --location 'https://api.cartai.ai/checkout/01a1f857-0a68-7233-abf2-faec6856e343/status/interactive' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY_HERE'Response
A successful request returns HTTP 200. The shape of data tells you whether the agent is waiting.
No input pending
The agent doesn't need anything from the customer. data is an empty array.
{
"status": "SUCCESS",
"data": [],
"message": "No input pending"
}Input pending
The agent is paused and waiting. Each entry in data is one request for input, identified by its id.
{
"status": "SUCCESS",
"data": [
{
"id": "f0d811e0-f11c-4412-b0c3-7f18b1fe9552",
"requireInputs": [
{
"type": "input",
"intent": "confirmation",
"required": true,
"value": "",
"inputSchema": {
"type": "object",
"properties": {
"confirm": {
"type": "boolean",
"title": "Place the order"
},
"reason": {
"type": "string",
"title": "Reason",
"maxLength": 500
}
},
"required": ["confirm"]
}
}
]
}
],
"message": "Interactive status retrieved successfully"
}
statusis not the task status. The top-levelstatus("SUCCESS") describes the API call. This endpoint doesn't return the checkout task's own status. Use Get Checkout Task to find out whether the task has finished.
Response Fields
| Field | Type | Description |
|---|---|---|
status | string | "SUCCESS" when the request succeeded. |
message | string | "No input pending" when data is empty, otherwise "Interactive status retrieved successfully". |
data | array | Pending input requests. Empty when the agent isn't waiting for anything. |
data[].id | string (UUID) | Unique ID of this input request. Use it to make sure you answer each request only once. See Answer each request once. |
data[].requireInputs | array | The inputs the agent needs for this request. |
data[].requireInputs[].type | string | How the input can be collected. input means you collect it in your own UI. hosted-screen means CartAI provides a ready-made screen at the URL in value. |
data[].requireInputs[].intent | string | Why the agent needs the input, for example confirmation before placing the order or mfa-request when the merchant asks for an OTP. |
data[].requireInputs[].required | boolean | Whether the agent needs this input to continue the checkout. |
data[].requireInputs[].value | string | For hosted-screen, the URL of the CartAI-hosted screen. Empty for input. |
data[].requireInputs[].inputSchema | object | A JSON Schema describing the answer the agent needs: field names, types, titles and validation rules such as maxLength. Every field in the schema's required array must be sent. |
For the example above, you would ask the customer to confirm the order (confirm, a boolean labelled Place the order) and optionally give a reason of up to 500 characters (reason).
Guide: Poll, Answer, Repeat Until the Task Finishes
The agent can pause more than once in a single checkout, for example for a login code and then for order confirmation. Keep polling for the whole life of the task, not just until the first request.
POST /checkout → returns taskId (allowInteraction: true)
loop:
GET /checkout/{taskId}/status/interactive → data[] not empty?
for each new data[].id:
ask the customer, using inputSchema
POST /checkout/{taskId}/{intent} → Send Interactive Inputs
remember data[].id as answered
GET /checkout/{taskId} → stop when COMPLETED, FAILED or CANCELLED
wait a few seconds
Step 1 — Poll for pending input
Call this endpoint every few seconds. If data is empty, the agent isn't waiting; check again after a short delay.
Step 2 — Collect the answer from the customer
For each entry in data, read requireInputs[].inputSchema and build a form from it. Each key in properties is a field. title gives the label, type the data type, and rules such as minLength and maxLength the validation. If an input's type is hosted-screen, you can show the customer the URL in value instead; the hosted screen submits the answer for you.
Step 3 — Send the answer
Send the customer's answer with Send Interactive Inputs (POST /checkout/{taskId}/{intent}). The request body must match inputSchema.
Answer each request once
Each request for input has its own data[].id. The same request can appear in more than one poll response, including a poll made right after you sent the answer.
- Store every
idyou have answered, against thetaskId. - Before answering, skip any
idyou have already stored. - Store the
idbefore you start sending, so a slow request and the next poll don't both send it. - If Send Interactive Inputs returns
409, the answer was already submitted. Don't resend it.
A new request from the agent always arrives with a new id, so storing answered IDs never hides a request you still need to answer.
Step 4 — Stop on a terminal status
This endpoint doesn't tell you when the checkout is over. Check the task with Get Checkout Task on each loop, and stop polling once its status is one of the terminal states:
| Status | Meaning |
|---|---|
COMPLETED | The order went through. Terminal success state. |
FAILED | The checkout couldn't be completed, for example because the merchant rejected a code. Terminal failure state. |
CANCELLED | The task was cancelled. Terminal state. |
Example
const API = "https://api.cartai.ai";
const TERMINAL = ["COMPLETED", "FAILED", "CANCELLED"];
async function runInteractiveCheckout(taskId, apiKey, { intervalMs = 3000, timeoutMs = 30 * 60 * 1000 } = {}) {
const headers = { "x-api-key": apiKey, "Content-Type": "application/json" };
const answered = new Set(); // data[].id values already handled (persist these in production)
const deadline = Date.now() + timeoutMs;
while (Date.now() < deadline) {
// 1. Is the agent waiting for input?
const pending = await fetch(`${API}/checkout/${taskId}/status/interactive`, { headers });
if (!pending.ok) throw new Error(`Interactive status failed: HTTP ${pending.status}`);
const { data = [] } = await pending.json();
for (const request of data) {
if (answered.has(request.id)) continue; // ✅ never answer the same request twice
answered.add(request.id); // mark before sending
for (const input of request.requireInputs) {
// 2. Ask the customer, using the JSON Schema to build the form
const answer = await askCustomer(taskId, input.intent, input.inputSchema);
// 3. Send the answer with Send Interactive Inputs
const res = await fetch(`${API}/checkout/${taskId}/${toPathIntent(input.intent)}`, {
method: "POST",
headers,
body: JSON.stringify(answer), // e.g. { "confirm": true } for the example above
});
if (res.status === 409) continue; // already submitted; don't resend
if (!res.ok) throw new Error(`Sending input failed: HTTP ${res.status}`);
}
}
// 4. Has the checkout finished?
const task = await fetch(`${API}/checkout/${taskId}`, { headers }).then((r) => r.json());
if (TERMINAL.includes(task.status)) return task;
await new Promise((r) => setTimeout(r, intervalMs));
}
throw new Error("Timed out waiting for the checkout task to finish");
}
// Maps the intent in requireInputs to the {intent} path segment of Send Interactive Inputs.
function toPathIntent(intent) {
const map = { "mfa-request": "mfa" };
return map[intent] ?? intent;
}
Polling tips: Poll every few seconds (for example every 3 seconds). Login and verification codes expire quickly, so the sooner you see a request, the more likely the customer's code is still valid. Set an overall timeout that suits your checkout experience.
Webhooks work too. The same requests arrive in therequiredInputsarray of checkout task webhooks. If you use both, share one store of answered IDs so a request is never answered twice.
Error Reference
| HTTP Status | Cause | What to do |
|---|---|---|
200 | Interactive status retrieved successfully | Read data to decide the next step |
400 | Invalid taskId | Check that the taskId is a valid UUID returned by Create Checkout Task |
401 | Missing or invalid x-api-key | Verify the header name and that you are using the correct key |
404 | The task wasn't found | Check that the taskId is correct |
429 | Rate limited | Poll less often and retry after a delay |
5xx | CartAI server error | Retry with exponential backoff; contact support if it persists |
400Bad Request
404The task wasn't found