> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getedulead.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getedulead.com/_mcp/server.

# SearchHeadcounts

GET https://api.getedulead.com/v4/headcounts/search

SearchHeadcounts counts the people matching every condition at each of their accounts
 (the district of a public school, else the school), by account id, 500 a page by default.
 It returns no person, so it counts nothing toward the revealed contacts. With beaconIds
 (and radiusMiles) it counts the people at those beacons' institutions, or within the radius
 of them.

Reference: https://docs.getedulead.com/api-reference/headcounts/search

## Authentication

- `Authorization` header (bearer token, required) — A team API key, sent as `Authorization: Bearer <key>`.
- `Authorization` header (bearer token, required) — The Cognito access token of a signed-in Edulead user (`edulead auth login`), sent as `Authorization: Bearer <token>`.

## Request

### Query parameters

- `conditions` (string, optional) — The conditions, as SearchPeopleRequest's: beaconIds (\{"operator": "in", "value": \["\<beacon id>", ...]}) with radiusMiles (\{"operator": "equals", "value": 25}) stand for the people at the team's beacons' institutions, or within the miles of them. The grammar: [https://docs.getedulead.com/search-conditions](https://docs.getedulead.com/search-conditions)
- `page_size` (integer, optional) — Number of items per page, at most the maximum shown. Omitted or 0 means the RPC's default page size.
- `page_token` (string, optional) — Opaque token from a previous response; empty for the first page.
- `order_by` (enum, optional) — Sort order: a sortable field name, optionally followed by " desc". The allowed values are listed.
  - Allowed values: ``, `account_id`

## Response

### 200

Success

- `items` (list of edulead.v4.Headcount, optional) — The page of results, in the requested order.
- `next_page_token` (string, optional) — Token for the next page; empty when this is the last page.
- `total_size` (string, optional) — How many accounts match, approximate past 40,000.
- `person_total` (string, optional) — How many people match over every account.

## Types

### edulead.v4.Headcount

Headcount is one account of the matching people, how many of them it has and where they are.

- `account_id` (string, optional) — The account's institution id: the district of a public school, else the school.
- `person_count` (string, optional) — How many of the matching people are at the account.
- `latitude` (double, optional) — Where the account is: its institution's location (a public school's district, else the school), so a map can be fitted to the accounts. Both 0 when it has none.
- `longitude` (double, optional)

## Examples

**Response**

```json
{
  "items": [
    {
      "account_id": "string",
      "person_count": "string",
      "latitude": 1.1,
      "longitude": 1.1
    }
  ],
  "next_page_token": "string",
  "total_size": "string",
  "person_total": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.getedulead.com/v4/headcounts/search"

headers = {"Authorization": "Bearer <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.getedulead.com/v4/headcounts/search';
const options = {method: 'GET', headers: {Authorization: 'Bearer <apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.getedulead.com/v4/headcounts/search"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.getedulead.com/v4/headcounts/search")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.getedulead.com/v4/headcounts/search")
  .header("Authorization", "Bearer <apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.getedulead.com/v4/headcounts/search', [
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.getedulead.com/v4/headcounts/search");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getedulead.com/v4/headcounts/search")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```