v1

latestOpenAPI 3.1.1Proprietary2026-07-2687313591.4 KB
Companies

Search Companies

⚠️ This endpoint is currently in BETA

Search for Companies matching the given criteria.

Accepts an optional combination of filters, sorts, and a search term. Omitting the body is equivalent to GET /v2/companies with default pagination.

Requires the "Export All Organizations directory" permission.

Field IDs

Field IDs used in filters, sorts, and search.fieldIds follow the formats described in Working with Field Data. Use GET /v2/companies/fields to discover the available fields and their valueType.

attributeId

Some fields require an attributeId to specify which aspect to filter or sort on. The following relationship intelligence fields all use attributeId: "date-of-activity": last-email, first-email, last-contact, last-event, first-event, next-event.

Use GET /v2/companies/fields to confirm which fields require an attributeId.

Search

The search.term is always matched against the company name and primary domain. Providing search.fieldIds extends the search to those additional fields; it does not restrict matching to only those fields. Fields with a valueType of datetime are not searchable and are silently ignored if included in search.fieldIds.

Limits

  • Items per filter group (filters or nested groups): 50

  • Values per filter (e.g. options in is-any-of): 100

  • Sort criteria: 5

  • Search term minimum length: 3 characters

  • Results per page: 100

Pagination

Uses cursor-based pagination.

post/v2/companies/search

Query parameters

fieldIdsstring[]

Specific field IDs for which to return field data on each Company. Cannot be used together with fieldTypes; use one or the other. Use GET /v2/companies/fields to discover available field IDs.

fieldTypesstring[]

A category of fields for which to return field data on each Company. Cannot be used together with fieldIds; use one or the other.

cursorstring

Cursor for the next or previous page.

limitinteger

Maximum number of Companies to return per page.

totalCountboolean

When true, includes the total count of matching Companies in the pagination response. Adds additional query cost; use only when needed.

Request body

Example request

{
  "filters": {
    "filters": [
      {
        "value": [
          {
            "id": 1
          }
        ]
      }
    ]
  }
}

Response

Created

Example response

{
  "data": [
    {
      "id": 1,
      "name": "Horizon Technologies",
      "domain": "horizontech.com",
      "domains": [
        "horizontech.com"
      ],
      "isGlobal": false,
      "fields": []
    },
    {
      "id": 2,
      "name": "Crestwood Capital",
      "domain": "crestwoodcap.com",
      "domains": [
        "crestwoodcap.com"
      ],
      "isGlobal": false,
      "fields": []
    }
  ],
  "pagination": {
    "prevUrl": "https://api.affinity.co/v2/companies?cursor=ICAgICAgYmVmb3JlOjo6Nw",
    "nextUrl": "https://api.affinity.co/v2/companies?cursor=ICAgICAgIGFmdGVyOjo6NA"
  }
}