Synchronous Requests
All cloro API monitoring endpoints follow a consistent request and response structure.Request structure
All monitoring endpoints follow a consistent request structure:Common parameters
All monitoring endpoints share these core parameters:| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The query to send to the AI provider (1-10,000 characters) |
country | string | No | ISO 3166-1 alpha-2 country code for localized results. Defaults to "US" |
include | object | No | Optional flags for additional response formats |
Country codes
The API supports country-specific monitoring. Common examples areUS (United States) and GB (United Kingdom).
For a complete list, see the Countries endpoint.
Response structure
All successful responses follow this base structure:Common response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Always true for successful responses |
result.text | string | The AI provider’s response text |
result.sources | array | Array of sources referenced in the response |
result.html | string | Response formatted in HTML (included when include.html is true) |
Sources array structure
Each source in thesources array follows this format:
Optional response formats
Most endpoints support additional response formats through theinclude parameter:
HTML format
- Parameter:
include.html - Type: boolean
- Default:
false - Description: Include response formatted in HTML
- Cost: Varies by endpoint (usually +0 credits)
Markdown format
- Parameter:
include.markdown - Type: boolean
- Default:
false - Description: Include response formatted in Markdown
- Cost: Varies by endpoint (usually +0 credits)
Endpoint-specific formats
Different endpoints offer unique formats. See individual endpoint documentation for specific options and features available for each monitoring endpoint. See Pricing for endpoint costs and credit information.Request examples
Asynchronous Requests
Think of an asynchronous (async) request like sending a package with a tracking number. Instead of waiting at the post office until the package is delivered (a synchronous process), you hand it over, get ataskId (your tracking number), and are free to do other things. You can then either receive a delivery notification (a webhook) or check the tracking status online yourself (polling).
Our async API works the same way. You submit a task, we give you a taskId, and we process your request in the background.
When to use async requests
This approach is ideal when:- Your application, especially if it’s running in a serverless environment, has short execution time limits.
- You want to submit a large number of requests quickly without waiting for each one to complete.
- You need to build a more resilient system that isn’t dependent on a single, long-running connection.
How it works: a two-step process
The entire process involves two simple steps: making a request and then fetching the result.Step 1: make an API request
First, you send an API request. If you include awebhook.url, we’ll notify you when the job is done. If you omit it, you will need to poll for the result.
Identifying your requests with
idempotencyKeyYou can optionally include an idempotencyKey in your request. This is a unique string you create that allows you to easily identify and reference your requests in your own system.taskId.
taskId and wait for the results.
Step 2: receive the results
You have two options for retrieving the results of your task.Option A: Webhooks (Recommended)
A webhook is an automated message sent from our servers to yours when your task is complete. If you provided awebhook.url in your request, we will send an HTTP POST request to that URL containing the full result.
2xx status code (e.g., 200 OK). If we don’t receive a successful response, we’ll try again.
We will attempt to deliver a webhook up to 5 times with an exponential backoff strategy. If an attempt fails, the next one will be scheduled for:
- Attempt 2: ~2 minutes later
- Attempt 3: ~4 minutes later
- Attempt 4: ~8 minutes later
- Attempt 5: ~16 minutes later
Option B: Polling
If you don’t provide a webhook URL, you can periodically check for the result yourself. This is called “polling.” You can make aGET request to our Get task status endpoint using the taskId you received in Step 1. Once the task is complete, the response will contain the full result.
Understanding Limits
The asynchronous system has a two-step process for handling limits to provide both flexibility and fairness.1. Task Submission Limits
When you submit a task, we only check two things:- Credit Limit: We verify you have enough credits for the task.
- Queue Limit: Your organization can have a maximum of 100,000 tasks waiting in the queue. If you exceed this, you will receive a
429 Too Many Requestserror. Please contact our team if you need this limit increased.
2. Task Processing Limits
Once your task is in the queue, our scheduler picks it up for processing. This is where your subscription’s concurrency limit is enforced. For example, if your plan allows 10 concurrent requests, our scheduler will process up to 10 of your tasks in parallel. Tasks are processed in the order they were received (FIFO).For practical concurrency patterns and examples, see our
concurrency documentation.