Get Interactive Status

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.

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

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.

ScenarioDescription
Polling instead of webhooksYour system can't receive checkout task webhooks yet. Poll this endpoint to find out when the agent needs input.
Missed or delayed webhookA webhook with requiredInputs didn't arrive or your handler failed. Poll to pick up the pending request.
Building your own UIRead inputSchema to build a form, then send the answer with Send Interactive Inputs.
📌

Only for interactive checkouts. If the task was created without allowInteraction: true, the agent never pauses for input and this endpoint always returns an empty data array.


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.

ParameterLocationTypeRequiredDescription
taskIdPathstring (UUID)✅ YesThe taskId returned by Create Checkout Task or Create Search Checkout Task.
x-api-keyHeaderstring✅ YesYour 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"
}
📌

status is not the task status. The top-level status ("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

FieldTypeDescription
statusstring"SUCCESS" when the request succeeded.
messagestring"No input pending" when data is empty, otherwise "Interactive status retrieved successfully".
dataarrayPending input requests. Empty when the agent isn't waiting for anything.
data[].idstring (UUID)Unique ID of this input request. Use it to make sure you answer each request only once. See Answer each request once.
data[].requireInputsarrayThe inputs the agent needs for this request.
data[].requireInputs[].typestringHow 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[].intentstringWhy the agent needs the input, for example confirmation before placing the order or mfa-request when the merchant asks for an OTP.
data[].requireInputs[].requiredbooleanWhether the agent needs this input to continue the checkout.
data[].requireInputs[].valuestringFor hosted-screen, the URL of the CartAI-hosted screen. Empty for input.
data[].requireInputs[].inputSchemaobjectA 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 id you have answered, against the taskId.
  • Before answering, skip any id you have already stored.
  • Store the id before 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:

StatusMeaning
COMPLETEDThe order went through. Terminal success state.
FAILEDThe checkout couldn't be completed, for example because the merchant rejected a code. Terminal failure state.
CANCELLEDThe 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 the requiredInputs array of checkout task webhooks. If you use both, share one store of answered IDs so a request is never answered twice.


Error Reference

HTTP StatusCauseWhat to do
200Interactive status retrieved successfullyRead data to decide the next step
400Invalid taskIdCheck that the taskId is a valid UUID returned by Create Checkout Task
401Missing or invalid x-api-keyVerify the header name and that you are using the correct key
404The task wasn't foundCheck that the taskId is correct
429Rate limitedPoll less often and retry after a delay
5xxCartAI server errorRetry with exponential backoff; contact support if it persists
Path Params
uuid
required

The taskId returned by Create Checkout Task or Create Search Checkout Task

Headers
string
required
Responses

400

Bad Request

404

The task wasn't found

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