# Sigma Computing

> List Sigma workbooks, datasets, members and connections, and export workbooks, using OAuth2 client credentials.

Lets an agent read your Sigma Computing organization through the REST API: list workbooks, datasets, members and data connections, fetch a single workbook, and start a workbook export (CSV/PDF). The connector exchanges your client ID and secret for a bearer token automatically, then reuses it for the rest of the run.

## What it can do

| Method | What it does |
| --- | --- |
| `sigma_workbooks_list` | List workbooks with id, name, path, and owner. |
| `sigma_workbook_get` | Get a single workbook by id. |
| `sigma_workbook_export` | Start a workbook (or element/page) export, returning an export id. |
| `sigma_datasets_list` | List datasets. |
| `sigma_members_list` | List organization members. |
| `sigma_connections_list` | List data connections. |
| `sigma_request` | Generic passthrough to any endpoint for full API coverage. |

## How to get your credentials

Sigma authenticates with **OAuth2 client credentials**: a client ID and a client secret that the connector exchanges for a short-lived bearer token.

1. Sign in to Sigma as an admin.
2. Open **Administration** -> **Developer Access** ([get access token docs](https://help.sigmacomputing.com/reference/get-access-token)).
3. Click **Create**, choose the owner/role, and copy the **client ID** and **client secret** - the secret is shown only once.
4. If your organization is on a regional host, note the matching API base URL (e.g. `https://aws-api.sigmacomputing.com`). Otherwise leave the default `https://api.sigmacomputing.com`.

## Fields to fill

| FlyMyAI field | Where it comes from |
| --- | --- |
| `SIGMA_CLIENT_ID` | Administration -> Developer Access -> Create -> client ID |
| `SIGMA_CLIENT_SECRET` | Same dialog - the secret shown once (kept private) |
| `SIGMA_BASE_URL` | Optional - default `https://api.sigmacomputing.com`; use your region host if different |

## Troubleshooting

- **`401` / token exchange failed** - the client ID or secret is wrong or the credential was deleted. Re-create it under Administration -> Developer Access.
- **Calls 404 or hit the wrong org** - `SIGMA_BASE_URL` points at a different region than your organization. Set it to your region's API host.
- **`403 Forbidden`** - the credential's role lacks permission for that workbook, dataset, or admin endpoint (e.g. members). Use a credential with a higher role.
- **`sigma_workbook_export` returns only an id** - export is asynchronous; the response is an export id you poll/download with `sigma_request`.

## Links

- [Sigma API reference](https://help.sigmacomputing.com/reference)
- [Get an access token](https://help.sigmacomputing.com/reference/get-access-token)
