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

# Partner API

> Read-only API for a partner to monitor the companies subscribed to its products

The Partner API lets a Jelou partner check the status of the companies subscribed to its products: which services they have, how their channels are doing, and how much they use them. It is read-only.

> [!NOTE]
>
> The partner is identified from the API key. No route takes a partner identifier, so a key can only see the subcompanies of its own partner.

## Base endpoint

```
https://gateway.jelou.ai/v1/partner
```

## Authentication

| Field | Location | Type | Required | Description |
| - | - | - | - | - |
| **x-api-key** | Header | string | Yes | API key of the partner's organization with the `partners:read` scope. |

> [!WARNING]
>
> The key must carry the `partners:read` scope explicitly. A key with the `*` wildcard is rejected with `403`.

## Resources

| Resource | What it returns |
| - | - |
| `GET /ping` | Verification of the key and the partner. |
| `GET /services` | Subcompanies with their plan, active channels and published workflows. |
| `GET /monitoring` | Channels of each subcompany by type and provider, with their status. |
| `GET /metrics` | Conversations and unique sessions over a time range. |

## Which subcompanies you see

A subcompany is listed when it is active and has an active subscription to one of the partner's products. If you query a company that is not yours, the API responds `404`, the same as if it did not exist.

## Pagination

List endpoints accept `page` (starting at 1) and `limit` (1 to 25, default 25). The response includes `page`, `limit` and `total`, which is the number of active subcompanies of the partner across all pages.

## Example

```bash theme={null}
curl --request GET \
  --url 'https://gateway.jelou.ai/v1/partner/services?page=1&limit=25' \
  --header 'x-api-key: <API_KEY>'
```

```json theme={null}
{
  "success": true,
  "statusCode": 200,
  "result": {
    "partner": "acme",
    "page": 1,
    "limit": 25,
    "total": 1,
    "subcompanies": [
      {
        "id": "1024",
        "externalId": "C-000123",
        "name": "Acme Retail",
        "plan": "SMB",
        "activeChannels": ["whatsapp"],
        "publishedWorkflows": 2
      }
    ]
  }
}
```

## Errors

The `400`, `403`, `404` and `500` responses carry `success: false` and `statusCode`; validation errors (`400`) add `error` with a code. For `401` and `429`, rely on the status code: their body is not part of the contract.

```json theme={null}
{
  "success": false,
  "statusCode": 400,
  "error": "invalid_range"
}
```

| Code | When it happens |
| - | - |
| `400` | Invalid parameter: `invalid_page`, `invalid_limit`, `invalid_range` or `invalid_company_id`. |
| `401` | The API key is missing or invalid. |
| `403` | The key lacks `partners:read`, uses the `*` wildcard, or does not belong to an active partner. |
| `404` | The resource does not exist or the company is not a subcompany of the partner. |
| `429` | You exceeded the limit of 60 requests per minute on that endpoint. |
| `500` | Unexpected error. |

## Partial metrics

In `GET /metrics`, when a metric could not be retrieved it arrives as `null` and the subcompany carries `partial: true`. The request does not fail: retry later to complete the value.


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