Documentation Index
Fetch the complete documentation index at: https://docs.klayrai.com/llms.txt
Use this file to discover all available pages before exploring further.
Reports
The Reports API lets you generate structured performance reports and retrieve them in JSON, PDF, or Markdown format. Reports combine campaign metrics with AI-generated analysis and recommendations.List reports
Retrieve a paginated list of generated reports.Query parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
campaignId | string | No | — | Filter by campaign ID |
accountId | string | No | — | Filter by ad account ID |
status | string | No | — | Filter by status: pending, generating, completed, failed |
format | string | No | — | Filter by format: json, pdf, markdown |
from | string | No | — | Start date for report creation (ISO 8601) |
to | string | No | — | End date for report creation (ISO 8601) |
page | integer | No | 1 | Page number |
page_size | integer | No | 20 | Results per page (max 100) |
Request
Response
Generate a report
Trigger the generation of a new performance report. Reports are generated asynchronously and typically take 10-20 seconds.Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | The Meta ad account ID |
title | string | Yes | Report title |
date_start | string | Yes | Start date in YYYY-MM-DD format |
date_end | string | Yes | End date in YYYY-MM-DD format |
Request
Response
Poll
GET /v1/reports to check for completion. The downloadUrl field will be populated once the report status is completed.Download a report
ThedownloadUrl returned on completed reports is a signed URL valid for 7 days. Send a GET request to download the file directly:
Error codes
| Status | Code | Description |
|---|---|---|
400 | invalid_request | Missing or invalid parameters |
400 | too_many_campaigns | More than 20 campaign IDs provided |
401 | authentication_error | Invalid or missing API key |
403 | plan_insufficient | API access requires the Agency plan |
403 | white_label_not_available | White-label requires the Agency plan |
404 | not_found | One or more campaign IDs not found |
429 | rate_limit_error | Rate limit exceeded |
500 | api_error | Internal server error |

