POST
/
v2
/
profiles
/
search
Search for profiles ids
curl --request POST \
  --url https://bee.theswarm.com/v2/profiles/search \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "query": {
    "match": {
      "profile_info.job_title": {
        "query": "Data Scientist"
      }
    }
  },
  "limit": 100,
  "paginationToken": "<string>",
  "stable_pagination": false
}'
{
  "ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "totalCount": 123,
  "paginationToken": "<string>"
}
See OpenSearch Mapping for the Search endpoint. Search returns 1000 results per page.
Note: Replace "query" with your OpenSearch DSL query defining the search criteria. The response will contain a list of profile IDs matching the search criteria, that can be later used in the Fetch endpoint
{
  query {
    ids: [
      "00007d1c-a048-480a-8c14-1f33a161a3db",
      "0000ad61-2eda-4061-a20e-793d41016f03",
      "0000fdfd-98f8-4bf3-adf8-b8a18a3c64f9",
      "000103f7-79eb-412e-9839-40a4d04858c3",
      "00016158-f2ca-463d-9aa3-229fd394ed41"
    ],
    totalCount: 125867,
    paginationToken: "eyJzZWFyY2hfYWZ0ZXIiOlt7ImZpZWxkIjoiX3Njb3JlIiwidmFsdWUiOjF9LHsiZmllbGQiOiJwcm9maWxlX2luZm8uaWQiLCJ2YWx1ZSI6IjAwMDE2MTU4LWYyY2EtNDYzZC05YWEzLTIyOWZkMzk0ZWQ0MSJ9XX0="
  }
}
For more examples, refer to Examples.

Pagination

When making requests to the Search endpoint, pagination can be utilized to retrieve large sets of search results efficiently. As shown in the above API response, it will contain a pagination token that should be used in subsequent requests to fetch the next page of results. Below is an example query that will query the next 5 records using the pagination token:
{
  "query": {
    "exists": {
      "field": "profile_info.emails"
    }
  },
  "limit": 5,
  "paginationToken": "eyJzZWFyY2hfYWZ0ZXIiOlt7ImZpZWxkIjoiX3Njb3JlIiwidmFsdWUiOjF9LHsiZmllbGQiOiJwcm9maWxlX2luZm8uaWQiLCJ2YWx1ZSI6IjAwMDE2MTU4LWYyY2EtNDYzZC05YWEzLTIyOWZkMzk0ZWQ0MSJ9XX0="
}

Authorizations

x-api-key
string
header
required

Body

application/json
query
object
required

Search query in the ElasticSearch Query DSL format. Find mapping here

limit
integer
default:100

Limit the number of results. If you want to use stable_pagination this parameter must be set to 1000

Required range: x <= 1000
paginationToken
string

Pagination token received in the previous response

stable_pagination
boolean
default:false

When set to true, ensures that pagination results remain consistent, even if the underlying data changes during retrieval. This is useful for retrieving large result sets reliably across multiple requests

Response

A list of profile ids matching provided query

ids
string<uuid>[]
required

List of profile ids

totalCount
integer
required

Total number of profiles matching the query

paginationToken
string

Pagination token for the next request