Companies

Search Companies

Changed on
⚠️ 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

Request

  • Base URL
    https://api.affinity.co
  • URL
    https://api.affinity.co/v2/companies/search
  • Auth
    • HTTP bearer
    • or OAuth 2
      Authorization code: https://login.affinity.co/auth/oauth2/authorize
      Token URL: https://login.affinity.co/auth/oauth2/token scopes: api.read

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"
  }
}

Changes

    • breaking

      removed the enum value quarter of the request property ///////

    • breaking

      removed the enum value quarter of the request property ///////

    • info

      the endpoint scheme security apiKeyAuth was added to the API

    • info

      the endpoint scheme security oauth2 was added to the API

    • info

      added company company-multi person person-multi dropdown dropdown-multi ranked-dropdown date number filterable-text filterable-text-multi text location location-multi discriminator mapping keys to the /// request property

    • info

      added contains does-not-contain starts-with ends-with is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added has-any-of has-none-of has-all-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added has-any-of has-none-of has-all-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added has-any-of has-none-of has-all-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added has-any-of has-none-of has-all-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added has-any-of has-none-of has-all-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-any-of is-none-of is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-equal-to is-not-equal-to is-greater-than is-greater-than-or-equal-to is-less-than is-less-than-or-equal-to is-between is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added is-on is-not-on is-before is-on-or-before is-after is-on-or-after is-between is-within-the-last is-not-within-the-last is-within-the-next is-not-within-the-next is-between-relative is-exactly-relative is-not-exactly-relative is-more-than-relative is-more-than-or-equal-to-relative is-less-than-relative is-less-than-or-equal-to-relative is-empty is-not-empty discriminator mapping keys to the //// request property

    • info

      added authentication authorization bad-request conflict method-not-allowed not-acceptable not-found not-implemented rate-limit server timeout unprocessable-entity unsupported-media-type validation discriminator mapping keys to the / response property for the response status

    • info

      added bad-request validation discriminator mapping keys to the / response property for the response status

    • info

      added chat-message email meeting call discriminator mapping keys to the /////// response property for the response status

    • info

      added company company-multi datetime dropdown dropdown-multi number number-multi filterable-text filterable-text-multi formula-number interaction location location-multi person person-multi ranked-dropdown text discriminator mapping keys to the //// response property for the response status

    • info

      removed the hidden enum value from the //// response property for the response status