> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cimento.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Analytics API

> Read Cimento's phishing, training and AutoPhish data from your own systems over HTTPS: what the API is for, who can set it up, and how a request works.

The Analytics API lets your own systems read your organization's phishing, training and AutoPhish data as JSON over HTTPS. Use it to feed a BI tool, a SIEM or a script without exporting files by hand.

The API is read-only. Every route is a `GET`, and nothing you send can change your campaigns, your people or your settings.

## How it works

**1. Create a service account**

An admin creates a service account in Cimento and chooses what it can read. Cimento gives it a client ID and a client secret. See [Service accounts](https://docs.cimento.ai/api/service-accounts.md).

**2. Get an access token**

Your system sends the client ID and client secret to the token URL and gets back an access token that lasts an hour. See [Authentication](https://docs.cimento.ai/api/authentication.md).

**3. Call the API**

Your system sends the access token with each request. See [Making requests](https://docs.cimento.ai/api/making-requests.md).

## At a glance

| | |
| - | - |
| Base URL | `https://api.cimento.app` |
| Token URL | `https://api.cimento.app/oauth2/token` |
| Authentication | OAuth 2.0 client credentials. Send the access token as `Authorization: Bearer <token>`. |
| Access token lifetime | One hour. There are no refresh tokens: ask for a new token when one expires. |
| Format | JSON. Every route is a `GET`. |
| Rate limit | A short burst, then about one request a second for each service account. See [Rate limits](https://docs.cimento.ai/api/errors-and-rate-limits.md#rate-limits). |
| OpenAPI document | `https://api.cimento.app/v1/openapi.json` |

## In this guide

> [card] [Service accounts](https://docs.cimento.ai/api/service-accounts.md)
>
> Create a service account, choose its scopes and copy its client ID and client secret.

> [card] [Authentication](https://docs.cimento.ai/api/authentication.md)
>
> Exchange the client ID and client secret for an access token, and send it with a request.

> [card] [Making requests](https://docs.cimento.ai/api/making-requests.md)
>
> A worked request, how to write parameters, and how to page through a list.

> [card] [Scopes](https://docs.cimento.ai/api/scopes.md)
>
> What each scope lets a service account read, and which routes need it.

> [card] [Errors and rate limits](https://docs.cimento.ai/api/errors-and-rate-limits.md)
>
> What each error means, what to do about it, and how fast you can call.

> [card] [Rotating secrets](https://docs.cimento.ai/api/rotating-secrets.md)
>
> Replace a client secret without downtime, and cut off one that has leaked.

The [API reference](https://docs.cimento.ai/api-reference/phishing/query-phishing-analytics.md) lists every route with its parameters and what it returns.

## Before you start

* **A Cimento admin.** People in the **Admin** permission group can create and manage service accounts, under **Admin → Integrations → API access**. If you were just added to that group, sign out and back in.
* **The permissions you want to hand out.** A service account can be given only the scopes its creator holds. See [Scopes](https://docs.cimento.ai/api/scopes.md#how-scopes-reach-an-access-token).
* **Somewhere safe to keep a secret.** A client secret is shown once. Store it in a secrets manager or your tool's credential store, not in source code.

## What you can read

| Area | What the API returns |
| - | - |
| Phishing | Figures across campaigns, such as failure rate by month, department or template. Campaigns and their participants. Templates. |
| Training | Courses and training campaigns. |
| AutoPhish | The program's settings, rounds, rates, trend, delivery health and recent activity, and one person's history. |

What a service account can read depends on its [scopes](https://docs.cimento.ai/api/scopes.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.