API Access to COMET Data

Users of COMET Data who have been granted COMET Data API access can generate and provide an API Code to external users (e.g., website or 3rd-party app developers), which they can use to run and fetch raw report data in JSON format.

Access to the COMET Data API

An API Code allows an external party to fetch data from COMET without logging in. For this reason, the Copy API Code option is not available to all COMET Data users by default. It is shown only to users explicitly granted COMET Data API access by a Tenant Superuser.

Users without access can still run and save reports in COMET Data, but cannot share their data via the API. If a user without access tries to obtain an API code in any other way, the system rejects the request.

Grant or Revoke Access

Tenant Superusers manage access in the Admin App, under General → Integrations → DATA API Access. The tab lists all users who have been granted access.

  • To grant access, add a user from the list of available users. You can search them by first name, last name, username or email.

  • To revoke access, remove the user from the list.

image-20261119-104157.png

Only active users in your organization whose profiles in the tenant have a COMET Data role are eligible for access. If a user's COMET Data role is later removed, their API access no longer applies.

For users with profiles on several tenants, access is granted per tenant. A user can have access on one tenant but not on another.

Tenant Superusers and all users who already had an active API code for a saved report were granted access automatically when access control was introduced, so that existing integrations were not interrupted.

Revoking access does not invalidate API codes that were already generated. They keep working until the related report is deleted from My Reports. If the user is logged in when access is revoked, the Copy API Code option disappears after the page is refreshed.

Generate and Copy an API Code

First, you will need to define and Save a Report to My Reports. Essentially, a user with API access must prepare a custom report in advance, with all the details they are willing to share with an external party, and save it in their list of My reports.

Next, click on the “options” menu at the far right of your selected report and choose Copy API Code, as shown in the image below. The first time, the API Code is generated and copied to the clipboard so you can paste it into your email, browser, or any other app.

slika-20261117-100945.png
slika-20261117-100846.png

Once the API code has been generated, it is also saved in the system and can be reaccessed by the same user via the Copy API code option, which copies the code to the clipboard for use outside COMET to run and fetch data.

The Copy API Code option is available only for reports saved in My Reports. It is not available in Data Snapshots or Distribution Groups.

Copy an API URL with different filters

You can also get an API URL that uses different or extra filters, without changing the saved report.

  1. In COMET Data, go to My Reports.

  2. Click the saved report.
    The report form opens with the saved filters already filled in.

  3. Change the filters you need.

  4. Click Copy API Code.
    The copied URL contains your API key and every filter you changed compared to the saved report.

This option is only shown to users who have been granted COMET Data API access (see Access to the COMET Data API). For filter names, value formats, and troubleshooting, see Report-Specific API Parameters.

If you have prepared and sent this API code to an external user, and later you choose to delete the Report from the My Reports list, the API access will be disabled.

The maximum number of calls per second is 10.

To use data obtained via the API to feed an external system (e.g., a website or other apps), developers must save the information captured from COMET in a separate local database. Make sure this is done from the start and by design to avoid the risk of rejected calls or performance issues.

  1. The structure of the COMET data API endpoint

https://<comet-url>/data-backend/api/public/areports/<current_page>/<results_per_page>
?API_KEY=<api_key>

example
https://comet.faw.cymru/data-backend/api/public/areports/run/0/25/?API_KEY=XXXXXXXXXXX

The data fetched from the API URL is divided into one or more pages, and the user should pull it page by page.

By default URL will fetch only the first page <current_page>=0 and first 25 rows <results_per_page>=25

You can call it directly as a GET request to retrieve data. To avoid including the API KEY in the URL, send it as a header named API_KEY.

0 is the first page, 1 is the second page, 2 is the third one, etc.

The maximum value for <results_per_page> (<results_per_page>) is 1000.

We strongly recommend using single-profile users to create API Keys because authorization depends on the user’s current active profile.

2. The structure of the response (JSON)

  • columnTypes - data types of columns

    • NUMBER

    • IMAGELINK - direct public link to image/photo

    • STRING

    • DATE, DATETIME

    • AMOUNT

  • columnNames - names of columns

    • Names are translated into the language that was active at the moment of generating the REST API URL

  • data

DATE and DATETIME fields are represented in milliseconds at the UTC timezone.

  • At the end of the JSON payload, there is a summary part
    "totalSize": 185 - number of all records in the report
    "page": 0 - current page
    "pageSize": 25 - current value for results per page
    "lastPage": 7 - last possible page

Here, we have 8 pages of data in total - 0,1,2,3,4,5,6,7.

"sortField": null - if data is sorted, by which column
"sortDirection": "asc" - if data is sorted, in which direction
"locale": "en_CY" - locale of translated column names

Example

JSON
{
"reportName": "Person Registrations",
"columnTypes": [
"IMAGELINK",
"NUMBER",
"STRING",
"STRING",
"DATE"
],
"columnNames": [
"Photo",
"Person ID",
"Given names",
"Last name",
"Date of birth"
],
"columnKeys": [
"photo",
"personId",
"firstName",
"lastName",
"dateOfBirth"
],
"results": [
{
"lastName": "Rushesha",
"firstName": "Tivonge",
"photo": "https://comet.comet/resources/images/noImageAvailable.png",
"#result_id#": "1",
"dateOfBirth": 1027468800000,
"personId": 191579
},
{
"lastName": "Jenkins",
"firstName": "Kian John",
"photo": "https://comet.comet/file?id=5b621510-415b-484b-a3ae-9b1bf833a230",
"#result_id#": "2",
"dateOfBirth": 1086307200000,
"personId": 241553
},
.....
"totalSize": 185,
"page": 0,
"pageSize": 25,
"lastPage": 7,
"sortField": null,
"sortDirection": "asc",
"locale": "en_CY",
"pivot": false,
"curl": null,
"apiKeyRequestURL": "http://comet.comet/data-backend/api/public/areports/run/0/25/?API_KEY=4c01e7460ccf01118409cfd33631a16503a72b5128e2bc5a2f7da707cf93d5d8e6f3bb3d0a26b8019be60fc608a44782f2364aa515dddac209dc5b7a5a3b7f7e",
"reportTemplateID": 1074