Create Report
POSThttps://api.confident-ai.com/v1/reports
Writes a report into your Confident AI project and returns its id and link. You supply the finished section content and it is stored and rendered as given.
curl -X POST "https://api.confident-ai.com/v1/reports" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"reportTemplateId": "REPORT-TEMPLATE-ID",
"metadata": {
"reportTitle": "Weekly Health Check",
"description": "Production health for the last week.",
"dateRange": {
"startDate": "2024-01-01T00:00:00.000Z",
"endDate": "2024-01-08T00:00:00.000Z"
}
},
"sections": [
{
"type": "STAT_CARDS",
"content": {
"cards": [
{
"label": "Error Rate",
"value": "2.10%",
"caption": "412 of 19,600 requests"
},
{
"label": "Total Cost",
"value": "$128.40"
}
]
}
},
{
"type": "CONTENT",
"heading": "Overview",
"content": {
"kind": "narrative",
"narrative": "Traffic held steady while the error rate fell by a third."
}
},
{
"type": "TABLE",
"heading": "Cost by Model",
"content": {
"headers": [
"Model",
"Total Cost"
],
"rows": [
[
"gpt-4o",
"$96.20"
],
[
"gpt-4o-mini",
"$32.20"
]
]
}
}
]
}'{
"success": true,
"data": {
"id": "REPORT-ID"
},
"link": "https://app.confident-ai.com/project/PROJECT-ID/reports/REPORT-TEMPLATE-ID?reportId=REPORT-ID",
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
reportTemplateIdstringRequiredThe report template this report belongs under. Required, since reports are read under their template.
sectionslist of objectsRequiredThe report's sections, in render order. At least one is required.
Show 4 propertiesHide 4 properties
typeenumRequiredWhat this section renders as. Determines the shape of
content.Show 5 enum valuesHide 5 enum values
CONTENTSTAT_CARDSTABLEGRAPHADMONITION
headingstringThe heading rendered above the section.
contentobject | object | object | object | objectRequiredA section's content. Its shape is determined by the section's
type— CONTENT takes narrative content, ADMONITION a callout, STAT_CARDS cards, TABLE headers and rows, and GRAPH a chart snapshot.Show 5 variantsHide 5 variants
ReportNarrativeContentobjectThe content of a CONTENT section — a block of prose.
Show 2 propertiesHide 2 properties
kindenumRequiredAlways
narrative.Show 1 enum valueHide 1 enum value
narrative
narrativestringRequiredPlain text only — no markdown headings, bold, or code fences. Do not repeat the section's heading, which renders above this text. Express a list as one item per line, each starting with "- ".
- OR
ReportAdmonitionContentobjectThe content of an ADMONITION section — a callout carrying a severity.
Show 2 propertiesHide 2 properties
severityenumRequiredHow the callout is styled.
Show 4 enum valuesHide 4 enum values
INFOSUCCESSWARNINGDANGER
textstringRequiredOne to three sentences.
- OR
ReportStatCardsContentobjectThe content of a STAT_CARDS section — a row of headline numbers.
Show 2 propertiesHide 2 properties
cardslist of objectsRequiredThree to five cards. At least one is required.
Show 3 propertiesHide 3 properties
labelstringRequiredA short Title Case phrase of 2-4 words — never a sentence or a raw column name.
valuestringRequiredA number, percentage, or short phrase, with numbers rounded to 2 decimal places.
captionstringOne short supporting line of 10 words or fewer.
highlightslist of objectsAt most three standout findings. Omit rather than padding.
Show 2 propertiesHide 2 properties
labelstringRequiredA short Title Case phrase.
valuestringRequiredThe highlighted value.
- OR
ReportTableContentobjectThe content of a TABLE section.
Show 2 propertiesHide 2 properties
headerslist of stringsRequiredThe column headers. At least one is required.
rowslist of list of stringsRequiredThe rows. Every row must contain exactly as many cells as there are headers, in the same order.
- OR
ReportGraphContentobjectThe content of a GRAPH section — a chart with its data baked in. Only this snapshot form is accepted over the API, so the chart always renders exactly the numbers you supply.
Show 6 propertiesHide 6 properties
typeenumRequiredAlways
snapshot.Show 1 enum valueHide 1 enum value
snapshot
graphTypeenumRequiredThe chart style.
Show 4 enum valuesHide 4 enum values
LINEAREABARSTACKED_BAR
categorieslist of stringsRequiredThe x-axis labels. At least one is required.
serieslist of objectsRequiredOne entry per plotted line. Every series'
valuesmust be the same length ascategories.Show 3 propertiesHide 3 properties
namestringRequiredThe series label.
valueslist of numbersRequiredOne number per category, aligned positionally with
categories.colorstringAn optional colour for the series.
xAxisLabelstringAn optional x-axis label.
yAxisLabelstringAn optional y-axis label.
startOnNewPagebooleanWhether the section starts on a new page in the exported report.
metadataobjectThe report's header information.
Show 3 propertiesHide 3 properties
reportTitlestringThe report's title. Defaults to the name of the report template it belongs to.
descriptionstringOne line on what the report covers.
dateRangeobjectThe window a report describes, shown in its header.
Show 2 propertiesHide 2 properties
startDatestringRequiredThe start of the window, as an ISO 8601 timestamp.
endDatestringRequiredThe end of the window, as an ISO 8601 timestamp.
statusenumDefaults to COMPLETED, which makes the report immediately readable. Use IN_PROGRESS to add sections over several requests.
Show 3 enum valuesHide 3 enum values
IN_PROGRESSCOMPLETEDERRORED
errorstringWhy the report failed, when creating it as ERRORED.
Response
The id of the created report, and a link to read it in Confident AI.
successbooleanIndicates if the request was successful.
dataobjectThe id of the affected report.
Show 1 propertyHide 1 property
idstringThe id of the affected report.
linkstringReturned when creating a report — the URL where a person can read it in Confident AI. Absent on delete, and once the report's template has been deleted.
deprecatedbooleanIndicates if this endpoint is deprecated.