---
title: "People Data Labs / Search people with SQL or a query"
description: "People Data Labs tool people-data-labs-person-search-get on looot: input fields, $0.28 per result, output shape, and code to run it with curl, JavaScript or Python."
sidebar:
  hidden: true
---

{/* Generated by scripts/generate-api-reference.mjs from data/api-reference.json. Do not edit. */}

Structured search over People Data Labs' person index, not free text. Send exactly one of sql (a WHERE clause) or query (an Elasticsearch query as JSON); size sets how many records. Returns data, full person records. Priced per record returned.

- **Tool id:** `people-data-labs-person-search-get`
- **Provider:** [People Data Labs](/providers/people-data-labs)
- **Job:** [Find people matching a filter](/reference/jobs/people-search) (`people.search`)
- **Price:** $0.28 per result. A call that fails at the provider costs $0.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `data_include` | string | no | A comma-separated string of fields the response should include. Begin the string with - to exclude those fields instead. Use data_include="" to exclude all data. Example: "full_name,emails.address" |
| `dataset` | string | no | The dataset category to return records from. Can be multiple comma-separated categories, or 'all'. |
| `pretty` | boolean | no | Whether the output should have human-readable indentation. |
| `query` | string | no | An Elasticsearch (v7.7) query object, as a JSON string. Provide either this or sql, not plain text. See PDL's Elasticsearch mapping reference for the full field list. Example: "\{\"query\": \{\"term\": \{\"job_company_name\": \"people data labs\"\}\}\}" |
| `scroll_token` | string | no | An offset key for paginating between batches. Each search response returns a scroll_token that fetches the next `size` records. |
| `size` | integer | no | The number of matched records to return, between 1 and 100 at PDL, capped at 3 here per this seed's request-size limit. |
| `sql` | string | no | A SQL query of the format: SELECT * FROM person WHERE XXX, where XXX is a standard SQL boolean query involving PDL's person fields. Provide either this or query, not plain text. Example: "SELECT * FROM person WHERE job_company_name='people data labs'" |
| `titlecase` | boolean | no | Setting titlecase to true will titlecase any records returned. |

## Output

Shape of the run's `result`, the expected shape, not yet checked against real answers:

```txt
{ data: { id, sex, emails, skills: string[], regions, industry, profiles: { id, url, network, username }[], countries: string[], education: { gpa, majors: string[], minors: unknown[], school: { ... },... ...
```

The shape is cut here. Signed in, `looot inspect people-data-labs-person-search-get` prints all of it.

## Run it

Every call needs your API token in `LOOOT_TOKEN`; [Sign in](/get-started/sign-in#use-the-token-in-scripts-and-agents) shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With `wait: 30` the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll `GET /v1/runs/<runId>`.

Example input with placeholder values:

<CodeGroup>

```bash curl
curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"people-data-labs-person-search-get","input":{"sql":"SELECT * FROM person WHERE job_company_name='\''people data labs'\''","query":"{\"query\": {\"term\": {\"job_company_name\": \"people data labs\"}}}","data_include":"full_name,emails.address","scroll_token":"<scroll_token>"},"wait":30}'
```

```js JavaScript
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "people-data-labs-person-search-get",
    input: {
      sql: "SELECT * FROM person WHERE job_company_name='people data labs'",
      query: "{\"query\": {\"term\": {\"job_company_name\": \"people data labs\"}}}",
      data_include: "full_name,emails.address",
      scroll_token: "<scroll_token>",
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
```

```python Python
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "people-data-labs-person-search-get",
        "input": {
            "sql": "SELECT * FROM person WHERE job_company_name='people data labs'",
            "query": "{\"query\": {\"term\": {\"job_company_name\": \"people data labs\"}}}",
            "data_include": "full_name,emails.address",
            "scroll_token": "<scroll_token>",
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))
```

</CodeGroup>

To let looot pick among every provider of this job instead, send `job:people.search` as `endpointId`; see [the job page](/reference/jobs/people-search).
