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

# Pipeline Stats

> Get deal counts grouped by stage

## Request

### Query Parameters

<ParamField query="pipeline" type="string">Filter by pipeline name</ParamField>
<ParamField query="tags" type="string">Filter by tag</ParamField>

### Headers

```
Authorization: Bearer wbk_your_api_key_here
```

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="stages" type="object">
      Object with stage names as keys and deal counts as values
    </ResponseField>

    <ResponseField name="total" type="integer">Total deals</ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```bash cURL theme={null}
  curl https://data.leadlex.com/functions/v1/api-gateway/v1/stats/pipeline \
    -H "Authorization: Bearer wbk_your_api_key_here"
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "wbk_your_api_key_here"
  BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"

  headers = {"Authorization": f"Bearer {API_KEY}"}
  response = requests.get(f"{BASE_URL}/v1/stats/pipeline", headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://data.leadlex.com/functions/v1/api-gateway/v1/stats/pipeline',
    { headers: { 'Authorization': 'Bearer wbk_your_api_key_here' } }
  );
  const { data } = await response.json();
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "data": {
    "stages": {
      "Lead": 15,
      "Proposal": 8,
      "Negotiation": 4,
      "Won": 12,
      "Lost": 6
    },
    "total": 45
  }
}
```

## Errors

| Status | Code                       | Description                     |
| ------ | -------------------------- | ------------------------------- |
| 403    | `insufficient_permissions` | Missing `deals:read` permission |
