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

# API Introduction

> Create programmatic interactions with the Phare API.

This API lets you interact programmatically with the Phare platform, enabling integration and automation for most tasks available in the control panel.

To manage Phare as code you can use the first-party [Terraform provider](https://docs.phare.io/integrations/terraform.md).

## Create an API key

> [!NOTE]
>
> Only team members with the **Owner** or **Admin** [role](https://docs.phare.io/user-management.md#roles) can create an API key in your organization.

To access the Phare API, create an API key with the right access. This can be done in the
[control panel](https://app.phare.io/organization/api-keys).

## Choosing the right scope

[https://iframe.mediadelivery.net/embed/238508/67722b0a-5db6-4eb3-88ba-a2f9f574f388?autoplay=false\&loop=true\&muted=true\&preload=true\&responsive=true](https://iframe.mediadelivery.net/embed/238508/67722b0a-5db6-4eb3-88ba-a2f9f574f388?autoplay=false\&loop=true\&muted=true\&preload=true\&responsive=true)

### Project-scoped API keys

Project-scoped API keys are limited to a single project and are designed for setups where projects must remain clearly separated. They work best for agencies and larger organizations, where each project is owned by a different team.

* Access is restricted to one specific project
* Cannot create or manage other projects
* Cannot manage integrations and organization-wide alert rules, which belong to the whole organization
* No additional project headers are required when making API requests

### Organization-scoped API keys

Organization-scoped API keys provide access across all projects in an organization and allow full project management. They are well suited for small teams, startups, and infrastructure provisioning.

* Access to all projects in the organization
* Can create and manage projects
* Requires a [project selection header](#project-selection) on most requests

## Permissions

Permissions restrict what an API key can do, resource by resource. This helps apply the principle of least privilege and limits what a key can do if it is misused.

Each resource can be given one of the following access levels:

* **None**: The API key can't access the resource.
* **Read**: The API key can list and get the resource.
* **Write**: The API key can also create, update and delete the resource. Writing always includes reading.

![API key permissions with None, Read or Write access per resource](https://mintcdn.com/phare/41y9aOGqtf3eXiL4/images/api-reference/api-key-permissions.avif?fit=max\&auto=format\&n=41y9aOGqtf3eXiL4\&q=85\&s=0790e82a05a66398a8fc0fb9fd2d8a44)

| Resource | Access levels | Covers |
| :- | :- | :- |
| Monitors | None, Read, Write | Monitors, their report and SSL certificates |
| Reports | None, Read | The uptime report of a project |
| Incidents | None, Read, Write | Incidents, their updates and comments, writing includes editing and deleting the ones written by others |
| Maintenance windows | None, Read, Write | Maintenance windows, writing includes cancelling and completing them |
| Status pages | None, Read, Write | Status pages, their current status and badges |
| Projects | None, Read, Write | Projects, writing includes muting them and choosing their members |
| Alert rules | None, Read, Write | Alert rules, writing organization-wide alert rules requires an organization-scoped API key |
| Integrations | None, Read, Write | The integrations installed in the organization, writing requires an organization-scoped API key |
| Members | None, Read | The members of the organization and their pending invites |

Each endpoint of this reference names the permission it requires, made of the resource and the access level, like `monitors:read` or `maintenance_windows:write`.

When an API key is missing a permission, the API responds with a `403` status code naming the permission required:

```json theme={null}
{
  "message": "The monitors:write permission is required to perform this action."
}
```

> [!NOTE]
>
> You can create as many keys as necessary to fit your use case.

## Authentication

The Phare API uses Bearer Token Authentication to secure access to its endpoints. To authenticate your requests, include the API key in the Authorization header of your HTTP requests:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Project selection

If you're using an organization-scoped API key, every endpoint except `/projects` most endpoints will require you to add an HTTP header to specify which project to operate on. You can specify the project by its `ID` or `Slug`:

* **X-Phare-Project-Id**: The project's numeric ID
* **X-Phare-Project-Slug**: The project's slug

Example using the project slug:

```bash theme={null}
curl \
  -X GET "https://api.phare.io/uptime/monitors" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Phare-Project-Slug: luminous-guiding-tower"
```

Example using the project ID:

```bash theme={null}
curl \
  -X GET "https://api.phare.io/uptime/monitors" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Phare-Project-Id: 123"
```

Project-scoped API keys always act on their scoped project and do not require a project selection header.

## Rate limiting

Access to the API is currently rate limited to **100 calls per minute** across the organization. All API keys share the same limit. Calls made through the [MCP server](https://docs.phare.io/integrations/mcp.md) don't count toward this limit, they have [their own](https://docs.phare.io/integrations/mcp.md#rate-limiting).

## Security

Never share your API key publicly. If you suspect that your API key has been compromised, revoke it immediately through your control panel and generate a new one.

***

If an API endpoint is missing or a custom rate limit is needed, [contact support](mailto:support@phare.io). Phare can help find a solution that fits the use case.


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