---
title: "People Data Labs / Search companies with SQL or a query"
description: "People Data Labs tool people-data-labs-company-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' company 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 company records. Priced per record returned.

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

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | integer | no | An offset value for pagination, 0 to 9999. Pagination can go up to 10,000 records per query; use the response's total field to see how many records exist for this query. |
| `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. |
| `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 company WHERE XXX, where XXX is a standard SQL boolean query involving PDL's company fields. Any column selection or LIMIT keyword is ignored by PDL. Provide either this or query, not plain text. |
| `titlecase` | boolean | no | Setting titlecase to true will titlecase any records returned. |

## Output

Shape of the run's `result`, checked against 1 real answer:

```txt
{ data: { id, sic: { sic_code, major_group, industry_group, industry_sector }[], name, size, tags: string[], type, naics: { sector, naics_code, sub_sector, industry_group, naics_industry, national_industry }[], ticker, founded, summary, website, headline, industry, location: { geo, name, metro, region, country, locality, continent, postal_code, address_line_2, street_address }, profiles: string[], industry_v2, linkedin_id, twitter_url, display_name, facebook_url, linkedin_url, mic_exchange, linkedin_slug, employee_count, funding_stages: string[], dataset_version, alternative_names: string[], l... ...
```

The shape is cut here. Signed in, `looot inspect people-data-labs-company-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-company-search-get","input":{"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-company-search-get",
    input: {
      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-company-search-get",
        "input": {
            "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:company.search` as `endpointId`; see [the job page](/reference/jobs/company-search).
