# List stages

The organization's own pipeline stages, in order, with how many people (`leads`) and companies are in each. A row in Leads or Companies carries at most one stage (`stage` on POST /tables/* and PATCH), next to its `status`: the status is what mySDR acts on (the check before sending, the agenda), the stage is the team's own pipeline ("MQL → SQL → Demo booked"). A stage stops nothing and changes no status. The user sees it as the Stage column on Leads and Companies, in this order, and `?stage=` opens the table on one.

POST /stages sets the list. Agree the stages with the user first: the whole team sees them.

## Authentication

Send `Authorization: Bearer gtk_…`. Create the key under **Connect assistant → API keys**. Every `gtk_` key can call these routes, also while the Signals API is closed. A missing, invalid or revoked key is **401**.

## Response

- **`object`** `string` · **required** — Always `list`. One of: `list`.
- **`data`** `object[]` · **required** — In pipeline order: `key`, `label`, `position` (from 1), `leads` and `companies` (rows in that stage).
- **`dashboard_url`** `string` · **required** — Leads in mySDR.

## Credits

Free. This call never uses credits.

## Errors

- **503** `service_unavailable` — Stages are not available in this environment yet.
- **409** `invalid_state` — The key has no user behind it, so mySDR cannot record who did it.
- **401** `authentication_error` — The Authorization header is missing, or the key is unknown or revoked.
- **403** `permission_error` — API access is not part of your plan, or your account is suspended.
- **429** `rate_limit_error` — More than 60 requests per minute, or more than 3 at the same time, on one key. Wait for the Retry-After header.
- **503** `service_unavailable` — The API is temporarily unavailable. Retry later.
- **500** `internal_error` — Something went wrong on our side.

## Example

### cURL

```bash
curl "https://mysdr.app/api/v1/stages" \
  -H "Authorization: Bearer $MYSDR_API_KEY"
```

### JavaScript

```javascript
const response = await fetch('https://mysdr.app/api/v1/stages', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.MYSDR_API_KEY}`
  }
});
const body = await response.json();
```

### Python

```python
import json
import os
import urllib.request

request = urllib.request.Request(
    "https://mysdr.app/api/v1/stages",
    headers={
    "Authorization": f"Bearer {os.environ['MYSDR_API_KEY']}"
    },
    method="GET",
)
with urllib.request.urlopen(request) as response:
    body = json.load(response)
```

### Example response

```json
{
  "object": "list",
  "data": [
    {
      "key": "new_lead",
      "label": "New lead",
      "position": 1,
      "leads": 42,
      "companies": 12
    },
    {
      "key": "mql",
      "label": "MQL",
      "position": 2,
      "leads": 9,
      "companies": 4
    },
    {
      "key": "demo_booked",
      "label": "Demo booked",
      "position": 3,
      "leads": 2,
      "companies": 1
    }
  ],
  "dashboard_url": "https://mysdr.app/en/gtm/leads"
}
```
