POST
/
v1
/
monitor
Monitor AI Responses
curl --request POST \
  --url https://api.cloro.dev/v1/monitor \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "prompt": "What do you know about Acme Corp?",
  "model": "CHATGPT",
  "country": "US"
}'
{
  "success": true,
  "result": {
    "markdown": "The **best EVs** vary depending on what you value most: range, performance, price, or features...",
    "html": "<p data-start=\"0\" data-end=\"276\">The <strong>best EVs</strong> vary depending on what you value most...</p>",
    "links": [
      {
        "position": 0,
        "label": "Consumer Reports: Best Electric Cars 2025",
        "url": "https://www.consumerreports.org/cars/evs/"
      }
    ]
  }
}

Overview

The Run endpoint allows you to track and monitor what AI providers say about your brand, products, or any topic across various regions. This endpoint processes your prompts through AI models and returns their responses for analysis.

Example Response

Here’s an example response when asking about the best electric vehicles:
{
  "success": true,
  "result": {
    "markdown": "The **best EVs** vary depending on what you value most: range, performance, price, or features...",
    "html": "<p data-start=\"0\" data-end=\"276\">The <strong>best EVs</strong> vary depending on what you value most...</p>",
    "links": [
      {
        "position": 0,
        "label": "Consumer Reports: Best Electric Cars 2025",
        "url": "https://www.consumerreports.org/cars/evs/"
      },
      {
        "position": 1,
        "label": "Edmunds Review: Tesla Model 3",
        "url": "https://www.edmunds.com/tesla/model-3/"
      },
      {
        "position": 2,
        "label": "MotorTrend: Lucid Air",
        "url": "https://www.motortrend.com/cars/lucid/air/"
      }
    ]
  }
}
The response includes:
  • Markdown format: Complete response with formatting preserved, including headings, bold text, lists, and links
  • HTML format: Fully formatted HTML with data attributes for position tracking and proper styling
  • Links array: All extracted links with their positions, labels, and URLs for easy reference

Error Responses

The API returns standard HTTP status codes to indicate the success or failure of requests. All error responses follow a consistent format with an error object containing a code, message, details, and timestamp.

Status Codes

  • 200 - Success
  • 400 - Bad Request (validation error)
  • 401 - Unauthorized (authentication error)
  • 403 - Forbidden (insufficient permissions or credits)
  • 404 - Not Found (route not found)
  • 409 - Conflict (resource conflict)
  • 429 - Too Many Requests (concurrency limit exceeded)
  • 499 - Client Closed Request (request was canceled)
  • 500 - Internal Server Error
  • 502 - Bad Gateway (external service error)

Error Response Format

All error responses follow this structure:
{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {
      // Additional context-specific information
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

Common Error Responses

400 Bad Request - Validation Error

{
  "success": false,
  "error": "Request validation failed",
  "details": [
    {
      "field": "prompt",
      "message": "Prompt cannot be empty"
    }
  ]
}
Common validation errors:
  • prompt: “Prompt cannot be empty” (min 1 character)
  • prompt: “Prompt is too long (max 10,000 characters)”
  • model: “Invalid enum value” (must be “CHATGPT”)
  • country: “Invalid country code” (must be valid ISO 3166-1 alpha-2 code)

401 Unauthorized - Authentication Errors

Missing API Key
{
  "error": {
    "code": "MISSING_API_KEY",
    "message": "Missing or invalid API key",
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}
Invalid API Key Format
{
  "error": {
    "code": "INVALID_API_KEY_FORMAT",
    "message": "Invalid API key format",
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}
Invalid or Expired API Key
{
  "error": {
    "code": "INVALID_OR_EXPIRED_API_KEY",
    "message": "Invalid or expired API key",
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

403 Forbidden - Permission or Credits Error

Insufficient Permissions
{
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Insufficient permissions",
    "details": {
      "requiredScopes": ["read:monitor", "write:monitor"]
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}
Insufficient Credits
{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Insufficient credits",
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

404 Not Found - Route Error

{
  "error": {
    "code": "RESOURCE_NOT_FOUND",
    "message": "Route not found",
    "details": {
      "id": "/v1/invalid-endpoint"
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

429 Too Many Requests - Concurrent Limit Exceeded

{
  "error": {
    "code": "CONCURRENT_LIMIT_EXCEEDED",
    "message": "Concurrent limit exceeded",
    "details": {
      "limit": 10
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

499 Client Closed Request

{
  "success": false,
  "error": "Request was canceled"
}
This occurs when the client closes the connection before the request completes.

500 Internal Server Error

Maximum Retries Exceeded
{
  "success": false,
  "error": "Maximum retries exceeded"
}
Generic Internal Error
{
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "Internal server error",
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

502 Bad Gateway - External Service Error

{
  "error": {
    "code": "EXTERNAL_SERVICE_ERROR",
    "message": "External service error: OpenAI",
    "details": {
      "service": "OpenAI"
    },
    "timestamp": "2025-01-15T12:00:00.000Z"
  }
}

Concurrency Limiting

This endpoint enforces concurrent request limits to ensure optimal performance:
  • 10 concurrent requests per user
Concurrency information is included in response headers:
  • X-Concurrent-Limit: Maximum number of concurrent requests allowed
  • X-Concurrent-Current: Current number of concurrent requests
  • X-Concurrent-Remaining: Number of remaining concurrent slots available

Credits System

This endpoint uses a credit-based billing system:
  • Maximum credits: 10,000 per account
  • Cost: 1 credit per successful request (200 status only)
Credit information is included in response headers:
  • X-Credits-Remaining: Number of credits remaining in your account (out of 10,000)
  • X-Credits-Charged: Number of credits charged for this request (always 1 for successful requests)

Supported Country Codes

The API accepts ISO 3166-1 alpha-2 country codes for the country parameter. All 254 standard country codes are supported. Common Examples:
  • US - United States
  • GB - United Kingdom
  • CA - Canada
  • AU - Australia
  • DE - Germany
  • FR - France
  • JP - Japan
  • CN - China
  • IN - India
  • BR - Brazil
For the complete list of supported codes, see the official ISO 3166-1 alpha-2 reference.

Best Practices

  1. Craft Specific Prompts: Be specific about what you want to monitor for more accurate tracking
  2. Monitor Consistently: Set up regular monitoring intervals to track changes over time
  3. Compare Providers: Monitor the same prompt across different AI providers to identify variations
  4. Track Regions: Monitor responses across different regions to understand geographical variations
  5. Implement Caching: Cache responses when appropriate to reduce API calls and costs
  6. Error Handling: Implement robust error handling and retry logic for failed requests

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request parameters for monitoring AI responses

prompt
string
required

The prompt to send to the AI model

Required string length: 1 - 10000
Example:

"What do you know about Acme Corp?"

model
enum<string>
required

The AI provider to monitor

Available options:
CHATGPT
Example:

"CHATGPT"

country
string

Optional country/region code for localized monitoring

Example:

"US"

Response

Successful monitoring response

success
boolean
required
Example:

true

result
object
required

The AI provider's response data