# Find custom headcount

Count employees at a company matching title, seniority, location, or keyword filters.

**POST** `https://api.up2data.ai/v1/companies/headcount`

**Credits:** 1 credit - **Mode:** synchronous

Filters combine with AND. Several `titles` match any of them, and so do several `seniorities` or `locations`. `filters` is required but may be empty (`{}`), which counts every current employee. Seniority is matched on job titles (for example `vp` matches VP, Vice President, SVP, and EVP), and each location is resolved to LinkedIn's closest geo match.

> **Info:** Send many as batch operation items (operation companies.headcount); 1 credit per item, free when the company is not found. See the [batch endpoint](https://up2data.ai/docs/v1/api/batch-create/).

## Request

| Field | Type | Notes |
|---|---|---|
| `url` **required** | `string` | Company page URL or slug. |
| `company_url` | `string` | Deprecated alias of url, still accepted. Send url or company_url, not both. |
| `filters` **required** | `object` | May be empty. |
| `filters.titles` | `string[]` | Job titles, matched against current titles. |
| `filters.seniorities` | `string[]` | Enum per item: owner, partner, cxo, vp, director, manager, senior, entry. titles and seniorities together allow at most 6 values. |
| `filters.locations` | `string[]` | Place names, e.g. United States or London. An unknown place answers 400. |
| `filters.keywords` | `string` | Free-text keywords matched anywhere on the profile. |

## Call it

**cURL**

```bash
curl -X POST "https://api.up2data.ai/v1/companies/headcount" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "https://linkedin.com/company/anthropic",
  "filters": {
    "titles": [
      "Software Engineer"
    ],
    "locations": [
      "United States"
    ]
  }
}'
```

**Python**

```python
import requests

url = "https://api.up2data.ai/v1/companies/headcount"
headers = {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
}
payload = {
    "url": "https://linkedin.com/company/anthropic",
    "filters": {
        "titles": [
            "Software Engineer"
        ],
        "locations": [
            "United States"
        ]
    }
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

**Node**

```javascript
const url = "https://api.up2data.ai/v1/companies/headcount";
const headers = {
  "X-API-Key": "YOUR_API_KEY",
  "Content-Type": "application/json",
};
const body = {
  "url": "https://linkedin.com/company/anthropic",
  "filters": {
    "titles": [
      "Software Engineer"
    ],
    "locations": [
      "United States"
    ]
  }
};

const response = await fetch(url, {
  method: "POST",
  headers,
  body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);
```

**Go**

```go
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://api.up2data.ai/v1/companies/headcount"
	body := bytes.NewBufferString(`{
  "url": "https://linkedin.com/company/anthropic",
  "filters": {
    "titles": [
      "Software Engineer"
    ],
    "locations": [
      "United States"
    ]
  }
}`)
	req, err := http.NewRequest("POST", url, body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("X-API-Key", "YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	respBody, _ := io.ReadAll(resp.Body)
	fmt.Println(string(respBody))
}
```

## Response

**200**

```json
{
  "data": {
    "company_url": "https://linkedin.com/company/anthropic",
    "count": 142,
    "filters_applied": {"titles": ["Software Engineer"], "locations": ["United States"]},
    "scraped_at": "2026-07-08T12:00:00Z",
    "linkedin_id": "74126343"
  },
  "meta": { "creditsUsed": 1, "creditsRemaining": 98419, "billed": true, "reason": "success", "requestId": "req_example", "latencyMs": 2100 }
}
```

## Errors

| Status | Type | When | Billed |
|---|---|---|---|
| 400 | `invalid_request` | Missing url or filters, both url and company_url sent, unknown field, bad seniority value, more than 6 titles and seniorities combined, or a location that matches no place. | No |
| 401 | `invalid_api_key` | Missing, malformed, or revoked key. | No |
| 402 | `insufficient_credits` | Balance can't cover the call. | No |
| 422 | `unprocessable_target` | Company not found, private, deleted, or unreachable. | Yes |
| 429 | `rate_limited` | Over the 300 requests/min per-key limit. Honor Retry-After. | No |
| 500 | `internal_error` | Something broke on the server side. | No |
| 504 | `upstream_timeout` | The live scrape didn't complete in time. | No |

See the [Errors guide](https://up2data.ai/docs/v1/guides/errors/) for every error type this version can return.
