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

# Reference - Person Search API

The Person Search API is perfect for finding specific segments of people that you need to power your projects and products. It gives you direct access to our full [Person Dataset](https://docs.peopledatalabs.com/docs/datasets#api-dataset) and provides many degrees of freedom, which allow you to find any kind of person(s) with a single query.

# Endpoint

The endpoint for the Person Search API is `https://api.peopledatalabs.com/v5/person/search`.

# Person Search API Access and Billing

We charge **per record retrieved**. Each person record in the `data` array of the response counts as a single credit against your total package.

# Requests

See [Authentication](https://docs.peopledatalabs.com/docs/authentication) and [Requests](https://docs.peopledatalabs.com/docs/requests) to learn how to input requests. We recommend using a JSON object to capture request parameters and will do so in the examples.

# Rate Limiting

The current default rate limit is 10 requests per minute.

# Input Parameters

> 📘 For more details, see [Input Parameters - Person Search API](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api)
>
> You can also click on the individual parameter names in the table below to view more information on them.

<Table>
  <thead>
    <tr>
      <th>
        Parameter Name
      </th>

      <th>
        Description
      </th>

      <th>
        Default
      </th>

      <th>
        Example
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        [`query`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#query)
      </td>

      <td>
        An [Elasticsearch (v7.7) query](https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl.html). See our underlying [Elasticsearch mapping](#full-field-mapping) for reference.
      </td>

      <td />

      <td>
        `{"query": {"term": {"job_company_name": "people data labs"}}}`
      </td>
    </tr>

    <tr>
      <td>
        [`sql`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#sql)
      </td>

      <td>
        An SQL query of the format: `SELECT * FROM person WHERE XXX`, where XXX is a standard SQL boolean query involving our [person fields](https://docs.peopledatalabs.com/docs/fields). We will ignore any use of column selections or the LIMIT keyword.
      </td>

      <td />

      <td>
        `SELECT * FROM person WHERE job_company_name='people data labs'`
      </td>
    </tr>

    <tr>
      <td>
        [`size`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#size)
      </td>

      <td>
        The batch size or the maximum number of matched records to return for this query if they exist, which must be between `1` and `100`.
      </td>

      <td>
        `1`
      </td>

      <td>
        `100`
      </td>
    </tr>

    <tr>
      <td>
        [`from`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#from)
      </td>

      <td>
        * \* Person  The `from` field is not recommended for use and will not be supported long term. Use the `scroll_token` field instead\*\*An offset value for paginating between batches, which can be a number between`0` and `9999`. You can execute pagination for a maximum of 10,000 records per query. \*\*NOTE: YOU CANNOT USE `FROM` WITH `SCROLL_TOKEN` IN THE SAME REQUEST\*\*.
      </td>

      <td>
        `0`
      </td>

      <td>
        `0`, `100`, `200` ...
      </td>
    </tr>

    <tr>
      <td>
        [`scroll_token`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#scroll_token)
      </td>

      <td>
        An offset key for paginating between batches. Unlike the legacy `from` parameter, you can use this parameter for any number of records. Each Person Search API response returns a `scroll_token`, which you can use to fetch the next `size` records.
      </td>

      <td>
        `None`
      </td>

      <td>
        `104$14.278746`
      </td>
    </tr>

    <tr>
      <td>
        [`dataset`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#dataset)
      </td>

      <td>
        Specifies which [dataset](https://docs.peopledatalabs.com/docs/datasets) the API should search against. You can input multiple datasets by separating them with a comma. Valid names are `resume`, `email`, `phone`, `mobile_phone`, `street_address`, `consumer_social`, `developer` and `all`. You can also exclude datasets by using `-` as the first character.
      </td>

      <td>
        `resume`
      </td>

      <td>
        `all`
      </td>
    </tr>

    <tr>
      <td>
        [`titlecase`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#titlecase)
      </td>

      <td>
        All text in the data of API responses returns as lowercase by default. Setting `titlecase` to `true` will titlecase any records returned.
      </td>

      <td>
        `false`
      </td>

      <td>
        `true`
      </td>
    </tr>

    <tr>
      <td>
        [`pretty`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#pretty)
      </td>

      <td>
        Whether the output should have [human-readable](http://jsonprettyprint.net/) indentation.
      </td>

      <td>
        `false`
      </td>

      <td>
        `true`
      </td>
    </tr>

    <tr>
      <td>
        [`api_key`](https://docs.peopledatalabs.com/docs/input-parameters-person-search-api#api_key)
      </td>

      <td>
        Your secret API key. <br /> <br /> **Note**: you can also provide this in the request header instead, as shown on the [Authentication](https://docs.peopledatalabs.com/docs/authentication) page.
      </td>

      <td />

      <td />
    </tr>
  </tbody>
</Table>

# Output Response

The API will return an HTTP response code of `200` for any valid request, regardless of whether it found records for your query or not. For that reason, pay close attention to the `total` value in your response object to understand query success. Each person record in the `data` array of the response counts as a single credit against your total package. The responses in the output are sorted by profile completeness.

## Response Fields

> 📘 For more details, see [Output Response - Person Search API](https://docs.peopledatalabs.com/docs/output-response-person-search-api)
>
> You can also click the field names in the table below to view more information on them.

| Field                                                                                                 | Description                                                                                                   | Type             |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------- |
| [`status`](https://docs.peopledatalabs.com/docs/output-response-person-search-api#status)             | The API response code (see a description of our [error codes](https://docs.peopledatalabs.com/docs/errors)).                                   | `Integer`        |
| [`data`](https://docs.peopledatalabs.com/docs/output-response-person-search-api#data)                 | The person response objects that match the input query (see the [example person record](https://docs.peopledatalabs.com/docs/example-record)). | `Array (Object)` |
| [`total`](https://docs.peopledatalabs.com/docs/output-response-person-search-api#total)               | The number of records matching a given `query` or `sql` input.                                                | `Integer`        |
| [`scroll_token`](https://docs.peopledatalabs.com/docs/output-response-person-search-api#scroll_token) | The scroll token to use to fetch the next batch of results for the query.                                     | `String`         |

## Response Data Structure

The response from the Person Search API will be in this format:

```json
{
    "status": 200,
    "data": [
        {
            "id": "qEnOZ5Oh0poWnQ1luFBfVw_0000",
            "full_name": "sean thorne",
            ...
        },
        ...
    ],
    "scroll_token": "1117$12.176522",
    "total": 99
}
```

See [Example Person Record](https://docs.peopledatalabs.com/docs/example-record) for a full example of the fields included in the `data` object.

## Errors

If the request encounters an error, it will instead return an Error Response in the format described in [Errors](https://docs.peopledatalabs.com/docs/errors).

# Elasticsearch Field Mapping

See [Elasticsearch Mapping](https://docs.peopledatalabs.com/docs/elasticsearch-mapping).

# All Data Field Descriptions

See the [Person Schema](https://docs.peopledatalabs.com/docs/fields).