Reports Cookbook

This doc provides recipes for running reports via API. Note that reports can also be run from the Persona dashboard.

Learn more in the Reports API documentation

Run your first report

Create your first report by creating a POST request to the reports resource:

curl
1API_KEY=YOUR_API_KEY_HERE
2curl -X POST -H 'Content-Type: application/json' \
3 -H "Authorization: Bearer $API_KEY" -d'{
4 "data": {
5 "attributes": {
6 "report-template-id": YOUR_TEMPLATE_ID,
7 }
8 }
9}' https://withpersona.com/api/v1/reports

After you submit the request, your report is processed as soon as possible. This usually happens within a second.

The HTTP response will include a report ID that you can use to poll for the report result:

json
1{
2 "data": {
3 "type": "report/watchlist",
4 "id": "rep_yourfirstreportid",
5 "attributes": {
6 "status": "pending",
7 "..." : "..."
8 }
9 }
10}

Get the results of a report

Fetch the results of a report using the report ID:

curl
1API_KEY=YOUR_API_KEY_HERE
2curl -X GET -H 'Content-Type: application/json' \
3 -H "Authorization: Bearer $API_KEY" \
4 https://withpersona.com/api/v1/reports/YOUR_REPORT_ID_HERE

Once the report status is ready, the results will be available in the response:

json
1{
2 "data": {
3 "type: "report/watchlist",
4 "id": "rep_yourfirstreportid",
5 "attributes": {
6 "status": "ready",
7 ...
8 }
9 }
10}