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

# Push People database to contacts

> Pushes People Database people into your contacts, from a hand-picked selection or a whole search.

> [!NOTE]
>
> Send `profileIds` to push people you picked: the `_id` of each result of [Search People database](https://developer.lemlist.com/api-reference/endpoints/people-database/search-people-database.md), up to 1,000 per call. Send `filters` to push every person a search matches: they take the same filter objects as the search, and their ids come from [GET Filters](https://developer.lemlist.com/api-reference/endpoints/people-database/get-database-filters.md). Send one of the two: both at once answer `400`.
>
> A `filters` push reads at most 10,000 people. Free-trial and freemium teams are capped at one page (100 people). When the search matches more, the response carries `matchedTotal`: narrow the search to push the rest. The `notInCrm` filter cannot be pushed as a search; push its results with `profileIds` instead.

> [!WARNING]
>
> A `filters` push spends one search of your team's 24h search quota, whatever the number of people pushed. A `profileIds` push spends none. `enrichFeatures` costs credits for each contact enriched: see [lemlist API credits](https://developer.lemlist.com/api-reference/objects-definitions/credits.md).

> [!NOTE]
>
> A `profileIds` push answers once every contact is written. A `filters` push runs in the background: it answers `202` with an `asyncOperationId`, and [Get an async operation](https://developer.lemlist.com/api-reference/endpoints/async-operations/get-async-operation.md) returns the push summary once it ends. One `filters` push per user runs at a time; a second one answers `409` and spends no search. People are de-duplicated by LinkedIn profile, so pushing someone twice never creates a second contact.


## OpenAPI

````yaml post /contacts/push-from-people-database
openapi: 3.0.0
info:
  title: lemlist API
  version: 1.0.0
  description: >-
    Welcome to the lemlist Developer Documentation.


    lemlist is very customizable and open. You'll find on this page all the API
    and integration you can do with lemlist.


    # Rate Limit


    lemlist's API rate limits requests in order to prevent abuse and overload of
    our services.  

    Rate limits are applied on all routes and per API key performing the
    request.  

    The rate limits are **20** requests per **2** seconds.  

    The response provides any information you may need about it:


    | Header | Description |

    | --- | --- |

    | Retry-After | The number of seconds in which you can retry |

    | X-RateLimit-Limit | The maximum requests in that time |

    | X-RateLimit-Remaining | The number of remaining requests you can make |

    | X-RateLimit-Reset | The date when the rate limit will reset |


    _Example of values for the rate limit headers_


    ``` json

    {
        "Retry-After": 2,
        "X-RateLimit-Limit": 20,
        "X-RateLimit-Remaining": 7,
        "X-RateLimit-Reset" : "Tue Feb 16 2021 09:02:42 GMT+0100 (Central European Standard Time)"
    }

     ```

    # Definitions


    ## Team


    A team is the entity of lemlist that can handle users and billing.


    ## Credits


    Credits are the coins a team uses to enrich emails, LinkedIn URLs, etc. via
    the enrich route. Each enrichment feature needs a certain amount of credits
    to run.


    ## User


    You use a user account to connect to lemlist and send messages via the
    connected emails or LinkedIn account.


    ## Campaign


    A campaign is the entity to automate outreach. A campaign has multiple
    sequences composed of steps.


    ## Lead


    A lead is a person that you try to contact via a campaign.


    ## Activity


    An activity is the history of all the steps.


    ## Unsubscribe


    An unsubscribe occurs when a person decides they don't want to receive
    emails from you anymore.


    # Authentication


    All API routes use the dedicated subdomain `api.lemlist.com`.


    lemlist uses API keys to allow access to the API. You can get your lemlist
    API key at our [integration
    page](https://app.lemlist.com/settings/integrations).


    You need to add the `Authorization` header using the `Basic` authentication
    type. `login:password` **where the login is always empty and the password is
    the API key**.


    ⚠️ **Don't forget to add the semicolon (**`:`**) before your API key in curl
    command.**


    > To authorize, use this code: 
      

    ``` shell

    curl https://api.lemlist.com/api/team \
      --user ":YourApiKey"

     ```

    **Make sure to replace** **`YourApiKey`** **with your API key.**


    # Give feedback


    If you want to report a bug, ask for data, or share with us a use case,
    please fill this [form](https://lemlist.typeform.com/to/mfVlkyGf). It will
    help us centralize your needs!
servers:
  - url: https://api.lemlist.com/api
security:
  - basicAuth: []
tags:
  - name: Enrichment Providers
    description: >-
      The data providers lemlist can call to find an email or a phone.


      Internal providers are paid with lemlist credits and always available.
      External providers run on your own account: connect one by saving its API
      key, and it becomes available to your waterfalls. `GET
      /enrichments/providers` is the catalog of provider ids accepted by the
      waterfall endpoints.
  - name: Enrichment Waterfalls
    description: >-
      Control which data providers lemlist calls when enriching a contact, and
      in which order.


      A waterfall is an ordered list of providers for one enrichment `type`
      (`email` or `phone`). Providers are tried one after the other until one
      returns a result.


      Every team has exactly one default waterfall per type (`isDefault: true`).
      While its `editor` is `lemlist` it follows the lemlist behaviour:
      providers you connected with your own API key are tried first, then
      internal providers in a random order. Once a team member edits its
      provider list, `editor` becomes that user's id and the list is followed as
      is; resetting it hands it back to `lemlist`.


      Custom waterfalls (`isDefault: false`) carry `conditions` on the contact
      being enriched, keyed by contact property; every key present must match.
      When a contact is enriched, lemlist runs a single waterfall: the custom
      waterfall of the requested type whose conditions match the contact, or the
      default waterfall when none does. If several match, the one with the most
      condition keys wins, then the most recently updated. Only that waterfall
      runs; when it finds nothing, the enrichment ends without falling back to
      another one.
  - name: User Groups
    description: >-
      Gather your team's users into groups (UK, FR, US…), so a manager filters
      Reports, Tasks and Campaigns by group in one click. Available on the
      Enterprise plan.


      Any member of the team reads the groups; only an admin creates, edits and
      deletes them. An API key acts on behalf of the team member who created it,
      so the write endpoints need a key created by an admin.


      A group name is unique in the team, whatever its case, and holds 1 to 60
      characters. A group holds at most 1,000 members and a team at most 100
      groups. A user can belong to several groups, and a user removed from the
      team leaves every group. Deleting a group also removes it from the
      Reports, Tasks and Campaigns filters saved on it.
paths:
  /contacts/push-from-people-database:
    post:
      tags:
        - People Database
      summary: Push People database to contacts
      description: >-
        Pushes people from the People Database into your contacts, optionally
        adding them to a static contact list. Send `profileIds` to push a
        hand-picked selection, or `filters` to push every person a search
        matches. Send one of the two: both at once answer 400
        (`PEOPLE_DATABASE_PUSH_ONE_SOURCE`).


        **Caps**: 1,000 `profileIds` per call; more are refused with a 400. A
        `filters` push reads at most the first 10,000 people the search matches.
        Free-trial and freemium teams are capped lower, at one page (100
        people), matching the search window their plan allows. When the search
        matches more people than the cap, the response carries `matchedTotal`
        and its `message` says so: narrow the search to push the rest.


        **Search quota**: a `filters` push spends one search of the team's 24h
        People Database search quota, whatever the number of people pushed,
        before any person is read. A `profileIds` push spends none. A request
        refused with a 400 or a 403 spends none either: the `notInCrm` filter, a
        dynamic `listId` and a refused enrichment are checked before the search
        is spent.


        **Duplicates**: people are matched and de-duplicated by LinkedIn
        profile, so pushing someone already in your contacts updates that
        contact rather than creating a second one.


        **Permission**: without the "Create contacts" permission on the API
        key's user, people not yet in your contacts are skipped; contacts that
        already exist are still updated.


        **Duration**: a `profileIds` push answers 200 with the summary once
        every contact is written. A `filters` push runs in the background: the
        call answers 202 with an `asyncOperationId` as soon as the push starts,
        and the summary becomes the `result` of that operation, read with [Get
        an async
        operation](/api-reference/endpoints/async-operations/get-async-operation)
        (`waitSeconds` holds the call until the push ends). One `filters` push
        per user runs at a time: a second one answers 409 and spends no search.
      operationId: pushPeopleDatabaseToContacts
      requestBody:
        required: true
        description: >-
          The people to push: `profileIds` or `filters`, plus an optional
          enrichment and target list
        content:
          application/json:
            schema:
              type: object
              properties:
                profileIds:
                  type: array
                  minItems: 1
                  maxItems: 1000
                  items:
                    type: string
                  description: >-
                    People Database people to push, 1 to 1,000 per call: the
                    `_id` of each result of `POST /database/people`. Use it for
                    a hand-picked selection; it spends no search. More than
                    1,000 ids are refused with a 400. Not combinable with
                    `filters`.
                filters:
                  type: array
                  minItems: 1
                  items:
                    $ref: '#/components/schemas/PersonaFilter'
                  description: >-
                    A People Database search, with the same filter objects as
                    `POST /database/people` (`filterId`, `in`, `out`). Every
                    person the search matches is pushed, up to the cap described
                    above, and the push spends one search of the 24h quota.
                    Filter ids come from `GET /database/filters`. The `notInCrm`
                    filter is refused with a 400: push the results of such a
                    search with `profileIds` instead. Not combinable with
                    `profileIds`.
                enrichFeatures:
                  type: array
                  items:
                    type: string
                    enum:
                      - find_email
                      - find_phone
                  description: >-
                    Enrichments to request on the pushed contacts: `find_email`,
                    `find_phone` or both. They cost credits for each contact
                    enriched, see [lemlist API
                    credits](/api-reference/objects-definitions/credits). Their
                    results are not part of this response. Refused with a 403
                    `linkedin-not-linked` when the API key's user cannot spend
                    enrichment credits, for example a free-trial user without a
                    connected LinkedIn account.
                listId:
                  type: string
                  pattern: ^clt_[a-zA-Z0-9]+$
                  description: >-
                    Static contact list to add the pushed contacts to (`clt_xxx`
                    format), from [Get contact
                    lists](/api-reference/endpoints/contacts/get-contact-lists).
                    Omit it to push into all contacts only. A dynamic list is
                    refused with a 400.
                  example: clt_ExAmPlEA1b2C3d4E5
            examples:
              Push a search:
                value:
                  filters:
                    - filterId: currentTitle
                      in:
                        - CTO
                      out: []
                    - filterId: country
                      in:
                        - France
                      out: []
                  listId: clt_ExAmPlEA1b2C3d4E5
              Push a selection:
                value:
                  profileIds:
                    - '123456789'
                    - '987654321'
                  enrichFeatures:
                    - find_email
      responses:
        '200':
          description: Push summary of a `profileIds` push
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - count
                  - insertedCount
                  - updatedCount
                  - unchangedCount
                properties:
                  message:
                    type: string
                    description: >-
                      Human-readable summary of the push. When the search
                      matched more people than the cap, it says how many were
                      pushed out of how many matched.
                  count:
                    type: integer
                    description: >-
                      Contacts written by the push: `insertedCount` +
                      `updatedCount` + `unchangedCount`. It can be lower than
                      the number of people sent: a profile that cannot be
                      imported is skipped, and so is a person not yet in your
                      contacts when the API key's user lacks the "Create
                      contacts" permission.
                  insertedCount:
                    type: integer
                    description: Contacts created
                  updatedCount:
                    type: integer
                    description: Existing contacts updated with the People Database data
                  unchangedCount:
                    type: integer
                    description: Existing contacts matched without any change
                  matchedTotal:
                    type: integer
                    description: >-
                      On a `filters` push only: how many people the search
                      matched. When it is larger than the cap, only the first
                      people up to the cap were pushed; narrow the search to
                      push the rest.
              examples:
                Selection push:
                  value:
                    message: Pushed 250 contacts from the People Database
                    count: 250
                    insertedCount: 240
                    updatedCount: 8
                    unchangedCount: 2
                Search push above the cap:
                  value:
                    message: >-
                      Pushed 1000 of 4520 matching people from the People
                      Database (cap 1000); narrow the search to capture the rest
                    count: 1000
                    insertedCount: 990
                    updatedCount: 6
                    unchangedCount: 4
                    matchedTotal: 4520
        '202':
          description: >-
            A `filters` push started in the background. Follow it with [Get an
            async
            operation](/api-reference/endpoints/async-operations/get-async-operation):
            once `done`, its `result` carries the push summary, with the same
            fields as the 200.
          content:
            application/json:
              schema:
                type: object
                required:
                  - asyncOperationId
                  - status
                properties:
                  asyncOperationId:
                    type: string
                    description: >-
                      The operation to read with `GET
                      /async-operations/{asyncOperationId}`
                  status:
                    type: string
                    enum:
                      - running
                    description: Always `running` at the start
              example:
                asyncOperationId: aop_ExAmPlE7k2M9q4R1x
                status: running
        '400':
          description: >-
            No `profileIds` and no `filters`, both at once
            (`PEOPLE_DATABASE_PUSH_ONE_SOURCE`), more than 1,000 `profileIds`,
            `filters` the search refuses, the `notInCrm` filter, a dynamic
            `listId`, or a malformed field (an `enrichFeatures` value other than
            `find_email` or `find_phone`, a `listId` without the `clt_` prefix).
            `filters` are checked strictly: a filter the API does not know
            answers `API_INVALID_FILTERS` instead of being ignored, so a
            mistyped `filterId` never pushes a wider search than you asked for.
            The same code answers a filter the leads search or the API does not
            offer, an `in` or `out` that is not an array of strings, and a beta
            filter your team has no access to. A coded error carries its code in
            `error` and a human-readable `message`; the others carry the message
            in `error` only.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              examples:
                Missing profileIds and filters:
                  value:
                    error: Provide a non-empty profileIds or filters array
                Too many profileIds:
                  value:
                    error: max-number-of-selected-ids
                    message: You cannot add more than 1000 items
                Invalid filters:
                  value:
                    error: SEARCH_FILTERS_INVALID
                    message: You have no valid filters with the current search mode
                Unknown filter:
                  value:
                    error: API_INVALID_FILTERS
                    message: Parameter filters is invalid
                notInCrm filter:
                  value:
                    error: SELECT_ALL_WITH_CRM_FILTER_UNAVAILABLE
                    message: >-
                      "Select all" is unavailable with the "Not in CRM" filter
                      to avoid making too many requests to your CRM
                Dynamic list:
                  value:
                    error: CRM_LIST_DYNAMIC_CONTACT
                    message: Cannot manually change the contacts of a dynamic list
        '401':
          description: The authentication you supplied is incorrect
          content:
            text/plain:
              example: The authentication you supplied is incorrect
        '403':
          description: >-
            `SEARCH_QUERY_LIMIT_REACHED` when the team's 24h People Database
            search quota is spent (a `filters` push only), or
            `linkedin-not-linked` when `enrichFeatures` is requested by a user
            who cannot spend enrichment credits
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              examples:
                Search quota spent:
                  value:
                    error: SEARCH_QUERY_LIMIT_REACHED
                    message: Search is limited to 2000 queries every 24 hours.
                Enrichment refused:
                  value:
                    error: linkedin-not-linked
                    message: LinkedIn account not linked
        '405':
          description: Method not allowed
          content:
            application/json:
              example:
                error: Method not allowed
        '409':
          description: >-
            `PEOPLE_DATABASE_PUSH_ALREADY_RUNNING`: a `filters` push of the same
            user is still running. Wait for its operation to end, then push
            again. No search is spent.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              example:
                error: PEOPLE_DATABASE_PUSH_ALREADY_RUNNING
                message: >-
                  A push is already running. We will let you know when it is
                  done.
        '503':
          description: >-
            `PEOPLE_DATABASE_PUSH_SHUTTING_DOWN`: the server is restarting. Send
            the same request again in a moment. No search is spent.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
              example:
                error: PEOPLE_DATABASE_PUSH_SHUTTING_DOWN
                message: The server is restarting. Start the push again in a moment.
components:
  schemas:
    PersonaFilter:
      type: object
      description: >-
        One People Database filter, as stored in a persona or a saved search.
        `in` includes matching values, `out` excludes them. There is no `type`
        property: it is derived from `filterId` server-side.
      required:
        - filterId
      properties:
        filterId:
          type: string
          description: >-
            People Database filter identifier. Use [Get Database
            Filters](/api-reference/endpoints/people-database/get-database-filters)
            to discover the valid ids.
          example: currentTitle
        in:
          type: array
          description: >-
            Values to include. For a `slider` filter, one or more `min|max`
            ranges (e.g. `2015|2024`). Create persona refuses a slider range in
            another format with `PEOPLE_DATABASE_PERSONA_API_INVALID_SLIDER`. A
            saved search stores it as is, but the search endpoints refuse it.
          items:
            type: string
          example:
            - Founder
        out:
          type: array
          description: >-
            Values to exclude. Keep it empty on a `slider` filter. Create
            persona refuses a slider `out` value with
            `PEOPLE_DATABASE_PERSONA_API_INVALID_SLIDER`. A saved search stores
            it but ignores it, and the search endpoints refuse it.
          items:
            type: string
          example: []
        exactMatch:
          type: boolean
          description: Exact-match toggle, for the text filters that support it
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.