# List labels

`GET https://api.coach-platform.com/api/public/labels`

List all trainee labels (tags) defined by the coach.

- Resource: Labels
- Authentication: API key in the `Authorization: Bearer cp_live_...` header
- HTML version: https://www.coach-platform.com/docs/api/reference/get-labels
- OpenAPI spec: https://www.coach-platform.com/openapi.json

## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `page` | integer | No | Page number (1-based, default 1) Minimum: `1`. |
| `limit` | integer | No | Number of items to return (default 25, max 500) Minimum: `1`. Maximum: `500`. |

## Responses

| Status | Description |
|---|---|
| `200` OK | Successful response |
| `400` Bad Request |  |
| `401` Unauthorized |  |
| `403` Forbidden |  |
| `429` Too Many Requests |  |
| `500` Internal Server Error |  |

### 200 OK

Content type: `application/json`

| Field | Type | Description |
|---|---|---|
| `data` | object[] |   |
| `data[].id` | string |   |
| `data[].text` | string |   |
| `data[].color` | string |   |
| `data[].coachId` | string |   |
| `pagination` | object |   |
| `pagination.page` | number |   |
| `pagination.limit` | number |   |
| `pagination.total` | number \| null | Total number of matching items. null when the underlying source cannot report an exact count for this page; use hasMore to keep paging. |
| `pagination.hasMore` | boolean |   |
| `pagination.truncated` | boolean | Present and true when the result set exceeded the in-memory scan cap and was truncated. Narrow your filters to page through all items. |

Example:

```json
{
  "data": [
    {
      "id": "<string>",
      "text": "<string>",
      "color": "<string>",
      "coachId": "<string>"
    }
  ],
  "pagination": {
    "page": 123,
    "limit": 123,
    "total": 123,
    "hasMore": true,
    "truncated": true
  }
}
```

### Error responses 400, 401, 403, 429, 500

Content type: `application/json`

| Field | Type | Description |
|---|---|---|
| `error` | object |   |
| `error.code` | string |   |
| `error.message` | string |   |
| `error.fix` | string \| null |   |
| `error.details` | object \| null |   |
| `error.retryAfterMs` | number \| null |   |

Example:

```json
{
  "error": {
    "code": "<string>",
    "message": "<string>",
    "fix": "<string>",
    "details": {},
    "retryAfterMs": 123
  }
}
```

## Examples

### cURL

```bash
curl --request GET \
  --url 'https://api.coach-platform.com/api/public/labels' \
  --header 'Authorization: Bearer cp_live_...'
```

### JavaScript (fetch)

```js
const response = await fetch('https://api.coach-platform.com/api/public/labels', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer cp_live_...',
  },
});

const data = await response.json();
```

## Related endpoints

- [Add labels to a trainee](https://www.coach-platform.com/docs/api/reference/post-trainees-trainee-id-labels/index.md): `POST /api/public/trainees/{traineeId}/labels`. Add labels to a trainee.
- [Remove a label from a trainee](https://www.coach-platform.com/docs/api/reference/delete-trainees-trainee-id-labels-label-id/index.md): `DELETE /api/public/trainees/{traineeId}/labels/{labelId}`. Detach a single label from one trainee.
- [Update a label](https://www.coach-platform.com/docs/api/reference/patch-labels-label-id/index.md): `PATCH /api/public/labels/{labelId}`. Rename a label or change its color.
- [Delete a label](https://www.coach-platform.com/docs/api/reference/delete-labels-label-id/index.md): `DELETE /api/public/labels/{labelId}`. Delete a label.
- Previous: [List a trainee's personal records](https://www.coach-platform.com/docs/api/reference/get-trainees-trainee-id-personal-records/index.md): `GET /api/public/trainees/{traineeId}/personal-records`. A trainee's personal records per exercise: best weight, estimated 1RM, top-set reps, max reps, set and total volume, and max duration, each with the value achieved, the previous record and when it was set.
- Next: [Add labels to a trainee](https://www.coach-platform.com/docs/api/reference/post-trainees-trainee-id-labels/index.md): `POST /api/public/trainees/{traineeId}/labels`. Add labels to a trainee.
