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

# Authentication

> Send your API key as a Bearer token on every request.

Every request except the OpenAPI downloads needs this header:

```http theme={null}
Authorization: Bearer <api_key>
```

## Get a key

An organization admin opens [**Account Management → Organizations**](https://app.getriskdata.com/v1/#/pages/account-management/organizations), selects the organization, and adds a service account on its **Service Accounts** tab. Each service account has its own key, and the app shows the key once. Create one service account per integration, so you can revoke one without stopping the others.

A key acts for its organization. It can read that organization's analyses, including those of its sub-organizations. An analysis outside them answers `404 not_found`, the same as an ID that does not exist.

## Keep the key out of URLs

The API refuses a key sent anywhere except the header. A request with `api_key` in the query string or the JSON body answers `400 query_api_key_forbidden`, before the key is checked:

```json theme={null}
{
  "type": "https://api.getriskdata.com/v1/errors/query-api-key-forbidden",
  "title": "API key in query or body is not allowed",
  "status": 400,
  "code": "query_api_key_forbidden",
  "detail": "Pass the API key in the Authorization Bearer header instead of query parameters or the request body.",
  "request_id": "4f0c2a9e8d7b4c1fa6e3b2d1c0f9e8a7",
  "errors": [
    { "field": "api_key", "message": "Credentials must not be sent in query parameters or request body." }
  ]
}
```

Other credentials do not authenticate: an `X-Api-Key` header, an app session cookie or a share token answers `401 unauthorized`.

## Permissions

What a key can see follows its service account's role in the app:

* **Submitting** a location needs permission to analyze locations. Without it, `POST /analyses` answers `403 forbidden`.
* **Polling and reading** need permission to view plans. Without it, every `GET /analyses/{analysis_id}` answers `404 not_found`, even for an analysis the key created. Give the role both permissions.
* **Fields** follow the same field permissions as the app. A field the role may not see is left out of the response.

## Revoking a key

Delete the service account in the app. A revoked key can keep working for up to 90 seconds while caches expire.


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