# Grain

> Read Grain call recordings - recordings, highlights, views, transcripts - via the public API.

Lets an agent read your Grain call recordings through the public API: list and get recordings (optionally with highlights and the transcript), list highlights, and list views. Useful for pulling sales / customer-call context into a workflow.

## What it can do

| Method | What it does |
| --- | --- |
| `grain_recordings_list` | List recordings (paginated). |
| `grain_recording_get` | Get one recording, optionally with highlights / transcript. |
| `grain_highlights_list` | List highlight clips across recordings. |
| `grain_views_list` | List views (saved groupings of recordings). |
| `grain_request` | Generic passthrough to any endpoint (incl. the v2 POST endpoints). |

## How to get your token

Grain authenticates with a **Personal Access Token** sent as the `Authorization: Bearer <token>` header. A PAT has the same access as the user who created it.

1. Sign in to Grain.
2. Open **Settings -> Integrations -> API** ([grain.com/app/settings/integrations?tab=api](https://grain.com/app/settings/integrations?tab=api)).
3. Create a Personal Access Token and copy it.
4. Paste it into FlyMyAI.

## Fields to fill

| FlyMyAI field | Where it comes from |
| --- | --- |
| `GRAIN_TOKEN` | Grain -> Settings -> Integrations -> API (Personal Access Token) |

## Troubleshooting

- **`401 Unauthorized`** - the token is wrong or revoked. Create a new Personal Access Token under Settings -> Integrations -> API.
- **`403 Forbidden`** - the Grain public API is gated to select partners / plans; confirm your account has API access.
- **`404 Not Found`** - the recording ID is wrong; list recordings first with `grain_recordings_list`.
- **Missing highlights / transcript** - pass `include_highlights` / `include_transcript` to `grain_recording_get`.

## Links

- [Grain API documentation](https://developers.grain.com/)
- [Grain API settings](https://grain.com/app/settings/integrations?tab=api)
