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

# 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](/pages/external-api-v2/permissions).

### Field IDs

Field IDs used in `filters`, `sorts`, and `search.fieldIds` follow the formats described in [Working with Field Data](/pages/data-model/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.




## OpenAPI

````yaml /schema/temp/publish.yml post /v2/companies/search
openapi: 3.1.1
info:
  version: 0.0.1
  x-affinity-api-version: '2024-01-01'
  contact:
    email: support@affinity.co
    name: Affinity Support
    url: https://support.affinity.co
  description: >
    # Introduction


    Welcome to Affinity API v2! This API provides a RESTful interface for
    building internal apps,

    automated workflows, 3rd party integrations, and for connecting Affinity to
    the rest of your tech

    stack.


    The legacy Affinity v1 API can be found at
    [api-docs.affinity.co](https://api-docs.affinity.co/).

    The v2 API is not at feature parity with v1 - we are continuing to develop
    new v2 APIs to support

    all v1 functionality over time.


    **The Affinity APIs are only available on select license types.** See

    [this Help Center
    article](https://support.affinity.co/hc/en-us/articles/5563700459533-Getting-started-with-the-Affinity-API-FAQs)

    or contact your Customer Success Manager for more information.


    # Getting Started


    All Affinity API endpoints use the base URL `https://api.affinity.co`. All
    v2 endpoint paths start

    with `/v2`. Requests must be sent over HTTPS.


    The first few sections of these docs cover general information on the API.
    Each subsequent section

    covers a set of API endpoints.


    Each endpoint is documented with its accepted request parameters, expected
    response shapes, and a

    sample request and response. The shape of a given response can vary
    depending on what "type" of

    object or data is being returned. When this is the case, the response
    documentation will include a

    dropdown that can be used to select the "type" for which to display the
    response shape.


    ## Authentication


    Affinity API v2 uses API keys and **bearer authentication**.


    To generate an API key, navigate to the Manage Apps Page in your Affinity
    Settings. You will need

    the "Generate an API key" role-based permission controlled by your Affinity
    admin. See

    [this Help Center
    article](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key)

    for full instructions on API key generation, and

    [this
    article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions)

    for more information on role-based permissions in Affinity.


    Provide your API key as your bearer authentication token to start making
    calls to Affinity API v2.


    You can create multiple API keys and provide a name and description for
    each. Your API key is able

    to read data and perform actions in Affinity on your behalf, so keep it safe
    as you would a

    password. To further secure an API key, you can define an IP Allowlist to
    limit which IP addresses

    or ranges can make API calls using that key.


    ## Permissions


    ### Overall Requirements


    You must have the "Generate an API key" permission to be able to work with
    the Affinity API. Most

    users in Affinity have this by default — Contact your Affinity admin if you
    are not able to generate

    an API key, and see

    [this
    article](https://support.affinity.co/hc/en-us/articles/360015976732-Account-Level-Permissions)

    for more information on role-based permissions in Affinity.


    ### Resource-Level Permissions


    The Affinity API respects sharing permissions that are set in-product. For
    example, if a given user

    does not have access to a list, note, or interaction in-product, they will
    not be able to see or

    modify it via API.


    ### Endpoint-Level Permissions


    Many API endpoints require endpoint-specific permissions in-product. These
    permissions, along with

    the "Generate an API key" permission, are managed by your Affinity admin in
    the Settings page. In

    the description of each endpoint you will see the required permissions
    needed.


    ## Rate Limits


    The Affinity API sets a limit on the number of calls that a user can make
    per minute, and that all

    the users on an account can make per month. It also sets a reasonable limit
    on the number of

    concurrent requests it will support from an account at one time.


    Requests to **both** Affinity API versions will count toward the one pool of
    requests allowed for a

    user or account. Once a per-minute, monthly, or concurrent rate limit is
    hit, subsequent requests

    will return an error code of 429. **We highly recommend designing your
    application to handle 429

    errors.**


    ### Per-Minute Limits (User-Level)


    To help protect our systems, API requests will be halted at **900 per user,
    per minute.** We may

    also lower this limit on a temporary basis to manage API availability.


    ### Concurrent Request Limits (Account-Level)


    To protect our systems and manage availability across customers, we set a
    reasonable limit on

    concurrent requests at the account level. Customers should not expect to hit
    this limit unless they

    are hitting the API with heavy operations from many concurrent threads at
    once.


    ### Monthly Plan Tier Limits (Account-Level)


    The overall number of requests you can make per month will depend on your
    account's plan tier.

    **This monthly account-level limit resets at the end of each calendar
    month.** Current rate limits

    by plan tier are:


    | Plan Tier  | Calls Per Month |

    | ---------- | --------------- |

    | Essentials | None            |

    | Scale      | 100k            |

    | Advanced   | 100k            |

    | Enterprise | Unlimited\*     |


    \*Per-Minute and Concurrent Request Limits still apply.


    ### Rate Limit Headers


    All API calls will return the following response headers with information
    about per-minute and

    monthly limits:


    | Header                           |
    Description                                             |

    | -------------------------------- |
    ------------------------------------------------------- |

    | x-ratelimit-limit-user           | Number of requests allowed per minute
    for the user      |

    | x-ratelimit-limit-user-remaining | Number of requests remaining for the
    user               |

    | x-ratelimit-limit-user-reset     | Time in seconds before the limit resets
    for the user    |

    | x-ratelimit-limit-org            | Number of requests allowed per month
    for the account    |

    | x-ratelimit-limit-org-remaining  | Number of requests remaining for the
    account            |

    | x-ratelimit-limit-org-reset      | Time in seconds before the limit resets
    for the account |


    ## Pagination


    When an endpoint is expected to return multiple results, we break the
    results into pages to make

    them easier to handle. To cycle forward through multiple pages of data, look
    for the `nextUrl`

    property in the `pagination` portion of an API response, and use it for your
    next request. See

    endpoint documentation for more information.


    ## Filtering


    Some endpoints support a filtering language for flexible and powerful
    queries. This allows for the

    creation of complex filter expressions using different operators and boolean
    logic in a single

    filter string. The description of each endpoint will contain information on
    which filter properties

    and operators are supported.


    ### Rules


    - Spaces are insignificant by default. For example, `field = hello` and
    `field=hello` are both
      valid.
    - If spaces are significant, they need to be inside double quotes, for
    example,
      `field = "hello world"`
    - Special characters need to be escaped with a backslash: `field="hello\"
    world"` <br> Full list of
      special characters: `\ * ~ ! & = > < $ ^ | " ' ( ) ] [ /`
    - Use `&` and `|` for boolean operations: `foo = 1 | baz = 2 & bar = 3`.
    Boolean Algebra Logic is
      assumed: `&` takes precedence over `|`. When evaluating the condition above, `baz = 2 & bar = 3`
      will be computed first, and then the result will be `or`'ed with `foo=1`
    - Parentheses can be used to specify the order of operations. In the example
    above, to make sure
      that `foo = 1 | baz = 2` is evaluated first, parentheses must be placed
      `(foo = 1 | baz = 2) & bar = 3`

    ### Grammar


    #### Simple Types


    | Definition               | Property
    Type                                        | Operator |
    Example                                                                                  
    |

    | ------------------------ |
    ---------------------------------------------------- | -------- |
    -----------------------------------------------------------------------------------------
    |

    | exact match              |
    all                                                  | =        | content =
    “hello world” <br>
    content=hello                                                |

    | starts with              |
    text                                                 | =^       | content =^
    he                                                                            
    |

    | ends with                |
    text                                                 | =$       | content =$
    llo                                                                           
    |

    | contains                 |
    text                                                 | =~       | content =~
    lo                                                                            
    |

    | greater than             | int32, int64, float, double, decimal, date,
    datetime | \>       | count >
    1                                                                                
    |

    | greater than or equal to | int32, int64, float, double, decimal, date,
    datetime | \>=      | content >=
    1                                                                             
    |

    | less than                | int32, int64, float, double, decimal, date,
    datetime | \<       | count <
    1                                                                                
    |

    | less than or equal to    | int32, int64, float, double, decimal, date,
    datetime | \<=      | content <=
    1                                                                             
    |

    | is NULL                  |
    all                                                  | != \*    | content !=
    \*                                                                            
    |

    | is not NULL              |
    all                                                  | =\*      | content =
    \*                                                                             
    |

    | is empty                 |
    text                                                 | =""      | content =
    ""                                                                             
    |

    | negation                 |
    all                                                  | !        | content !=
    ”hello world” <br> !(content = ”hello world”) <br> !(content =^ “hello
    world”) |


    #### Collections (all types)


    | Definition                | Operator |
    Example                              |

    | ------------------------- | -------- |
    ------------------------------------ |

    | exact match with ordering | =        | industries =
    [Healthcare,Fintech]    |

    | contains all              | =~       | industries =~
    [Healthcare,Fintech]   |

    | empty                     | =[]      | industries
    =[]                       |

    | negation                  | !        | !(industries =
    [Healthcare,Fintech]) |


    ## Error Codes


    Here is a list of the error codes the API will return if something goes
    wrong (see endpoint

    documentation for endpoint-specific errors):


    | Error Code |
    Meaning                                                                                                                                                                                                    
    |

    | ---------- |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    |

    | 400        | Bad Request — See endpoint documentation for more
    information.                                                                                                                                             
    |

    | 401        | Unauthorized — Your API key is
    invalid.                                                                                                                                                                    
    |

    | 403        | Forbidden — Insufficient rights to a
    resource.                                                                                                                                                             
    |

    | 404        | Not Found — Requested resource does not exist. See endpoint
    documentation for more
    information.                                                                                                            
    |

    | 405        | Method Not Allowed — The method being used is not supported
    for this
    resource.                                                                                                                             
    |

    | 422        | Unprocessable Entity — Malformed parameters supplied. This
    can also happen in cases the parameters supplied logically cannot complete
    the request. In this case, an appropriate error message is delivered. |

    | 429        | Too Many Requests — You have exceeded the rate
    limit.                                                                                                                                                      
    |

    | 500        | Internal Server Error — We had a problem with our server. Try
    again
    later.                                                                                                                                 
    |

    | 503        | Service Unavailable — This shouldn't generally happen.
    Contact us if you encounter this
    error.                                                                                                             
    |


    ## Versioning


    Versioning in Affinity’s API ensures that your integrations remain stable as
    updates are introduced.

    Within API v2, minor versions identify releases that may include breaking or
    behavior-changing

    modifications, and they allow you to target the exact API behavior your
    integration depends on.


    When you create an API key in the Settings page, you'll select a **Default
    API Version** for that

    key. The current available versions are:


    - **2024-01-01** - The current stable version of the v2 API


    As new minor versions of Affinity API v2 are introduced, they will appear in
    this list. You’ll be

    able to create new keys using those versions or update an existing key to
    use a newer version.


    ## Beta Endpoints


    You’ll notice in our documentation that some endpoints will be marked as
    BETA. These endpoints are

    newly released and will eventually progress to General Availability (GA).
    While an endpoint is in

    BETA there are some important things to consider:


    - The development of this endpoint may still be in progress. This means new
    capabilities, request
      parameters, response data, and performance improvements may be adjusted over time. Because of
      this, breaking changes may occur to the endpoint WITHOUT notice or versioning.
    - As this is an early release, bug fixes may still be ongoing as well, and
    we encourage you to
      report bugs to [support@affinity.co](mailto:support@affinity.co).
    - In addition, your feedback around the capabilities of the endpoint are
    highly valuable, please
      reach out to your CSM to provide feedback to our product team.

    # Data Model


    ## The Basics


    The three top-level objects in Affinity are **Persons, Companies, and
    Opportunities**. (Note:

    Companies are called Organizations in the Affinity web app.) These have
    profiles in the Affinity web

    app and can be added to Lists.


    A **List** is a spreadsheet-like collection of rows tied to Persons,
    Companies, or Opportunities.


    - Each row on a List is a **List Entry**. A List Entry contains data and
    metadata about a given
      Person, Company, or Opportunity in the context of a List. This includes list-specific field data,
      and information about who added the row to the List and when.
    - A given entity can be added to a List more than once. These List Entries
    can have different
      List-specific field data and List Entry-level metadata.

    Each column on a List maps to a **Field**. Fields show up within Affinity
    profile pages, extensions,

    and integrations. There are two categories of fields:


    - **List-specific fields** are scoped to a single List. In the API, their
    data can only be accessed
      through the List Entry resource.
    - **Global fields** belong to entities directly. These can include default
    fields, fields created by
      you, enrichment fields, or relationship intelligence fields. They can be accessed through the
      Person/Company/Opportunity resources and the List Entry resource.

    ## Working with Field Data


    ### Field Types and IDs


    Here is a deeper look at the types of Fields in Affinity, differentiated by
    the scope and source of

    their data:


    | Field&nbsp;Type             |
    Description                                                                                                                                                 
    | Example
    Fields                                                                                                                                             
    | Field ID
    Pattern                                                                                                                            
    |

    | --------------------------- |
    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    |
    --------------------------------------------------------------------------------------------------------------------------------------------
    |

    | `enriched`                  | Firmographic, funding, and people Fields
    populated by Affinity. These can be "Affinity Data" Fields or come from
    distinct data partners.                     | "Affinity Data: Description",
    "Dealroom: Number of
    Employees"                                                                                              
    | A string representing the enrichment source, followed by the field name,
    e.g. `affinity-data-description` or `dealroom-number-of-employees`. |

    | `list`                      | Fields that are specific to the context of a
    given list. These can only be accessed through `*/list-entries` endpoints in
    this version of the API.           | Default "Status" and "Amount" columns,
    custom columns that pertain to a given List of deals or
    founders                                                     | `field-`,
    followed by a unique integer, e.g.
    `field-1234`                                                                                   
    |

    | `global`                    | Fields that persist across an Affinity
    account and are not
    list-specific.                                                                                   
    | "My Firm's Founder Scoring
    Column"                                                                                                                         
    | `field-`, followed by a unique integer, e.g.
    `field-1234`                                                                                   
    |

    | `relationship-intelligence` | Fields populated by Affinity from users'
    email and calendar data that provide insight into your firm's relationship
    with a given Person/Company/Opportunity. | "Source of Introduction", "First
    Email", "Last Email", "First Event", "Last Event", "Next Event", "First Chat
    Message", "Last Chat Message", "Last Contact" | A string similar to the
    field's name in-product, e.g.
    `source-of-introduction`                                                              
    |


    ### Field Value Types


    Field data can take a variety of shapes. These value types are described in
    the Affinity Help Center

    [creating columns in
    lists](https://support.affinity.co/hc/en-us/articles/115001608232-How-to-create-a-new-column-in-a-list).

    Here is a list of the same value types, as represented in this API. Notice
    how array types end with

    `-multi`:


    | Single Type         | Array Type                |

    | ------------------- | ------------------------- |

    | `text`              | Not supported in Affinity |

    | `number`            | `number-multi`            |

    | `datetime`          | Not supported in Affinity |

    | `location`          | `location-multi`          |

    | `dropdown`          | `dropdown-multi`          |

    | `ranked-dropdown`   | Not supported in Affinity |

    | `person`            | `person-multi`            |

    | `company`           | `company-multi`           |

    | `filterable-text`\* | `filterable-text-multi`\* |


    \*Note that `filterable-text` and `filterable-text-multi` are special types
    that operate similarly

    to `dropdown` and `dropdown-multi`. They are reserved for Affinity-populated
    Fields, and users

    cannot create Fields with these types.


    When an array-typed value has no data in it, the API will return `null`
    (rather than an empty

    array).


    ### Retrieving Field Data


    To retrieve field data on companies, persons, or opportunities, call GET
    `/v2/companies`, GET

    `/v2/persons`, or one of our GET `*/list-entries` endpoints. (Note that
    Opportunities only have

    list-specific Fields, so all their field data will live on the
    `*/list-entries` endpoints.) For most

    of these endpoints, you will need to specify the Fields for which you want
    data returned via the

    `fieldIds` or `fieldTypes` parameter — Otherwise, entities will be returned
    without any field data

    attached.


    The GET `/v2/companies` and `/v2/persons` endpoints can return entities with
    enriched, global, and

    relationship intelligence field data attached, but do not support
    list-specific field data. **To get

    comprehensive field data including list-specific field data on Companies and
    Persons, use the GET

    `*/list-entries` endpoints.**


    ### Specifying Desired Fields (Field Selection)


    As mentioned above, you will need to specify the Fields (either by ID or by
    Type) for which you want

    data returned when using the following endpoints:


    - GET `/v2/companies`

    - GET `/v2/companies/{id}`

    - GET `/v2/persons`

    - GET `/v2/persons/{id}`

    - GET `/v2/lists/{listId}/list-entries`


    Each of these endpoints has a `fieldIds` parameter that accepts an array of
    Field IDs, and a

    `fieldTypes` parameter that accepts an array of Field Types. Use the GET
    `*/fields` endpoints to get

    Field IDs, Field Types, and other Field-level metadata:


    - Call GET `/v2/companies/fields` and `/v2/persons/fields` to get a list of
    the enriched, global,
      and relationship intelligence (AKA non-list-specific) Fields that exist on Companies and Persons,
      respectively. These are the Fields whose values are available to pull via GET `/v2/companies`, GET
      `/v2/companies/{id}`, GET `/v2/persons`, and `/v2/persons/{id}`.
    - Call GET `/v2/lists/{listId}/fields` to get a list of the enriched,
    global, relationship
      intelligence, **and list-specific** Fields for a given List. These are the Fields whose values are
      available to pull via GET `/v2/lists/{listId}/list-entries`.

    The following endpoints don't require field selection:


    - GET `/v2/lists/{listId}/saved-views/{viewId}/list-entries` — See below.
    This endpoint returns just
      the field data that has been pulled into the given Saved View via UI.
    - GET `/v2/companies/{id}/list-entries` and GET
    `/v2/persons/{id}/list-entries` — These endpoints
      return comprehensive field data for the given person or company in the context of each List Entry.

    ### Saved Views


    A Saved View allows a user to configure the Fields they want to see in the
    UI for a given List, and

    set filters and sorts on the rows on that List. A List can have multiple
    Saved Views. In the context

    of this API, Saved Views can be useful for specifying the exact Fields for
    which data is needed. The

    `*/saved-views/{viewId}/list-entries` endpoint also respects the filters
    that have been set on the

    given Saved View in the Affinity web app. (It does not, however, respect
    sorts just yet.)


    ### Partner Data Restrictions


    This API supports pulling data from

    [Affinity
    Data](https://support.affinity.co/hc/en-us/articles/360058255052-Affinity-Data)
    fields and

    select

    [Dealroom
    fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22SVH7TJR3DJV3NQDE9HQ).

    Due the agreements we have with some of our data partners, the API does not
    expose data from the

    following sources:


    - Crunchbase, including Crunchbase UUID

    - Pitchbook

    - [Dealroom "exclusive"
    fields](https://support.affinity.co/hc/en-us/articles/6106558518797-Dealroom-co-data-in-Affinity#h_01G2N22YEAZJ5TC1X9ENKZFWF5)


    ## Nested Associations


    Some GET endpoints return "association" data under `fields`. For example,
    the Persons GET endpoints

    return data about which Companies a Person is associated with in Affinity.
    The Opportunities GET

    endpoints return similar data about associated Companies and Persons. The
    List Entries GET endpoints

    also return this data for Person and Opportunity List Entries.


    The API truncates these nested arrays of Persons or Companies **at 100
    entries**. For example, if an

    Opportunity is associated with 200 Persons in Affinity, only 100 of those
    Persons will be returned

    by the GET `/opportunities` or `/opportunities/{id}` endpoint.


    # Changelog


    ## January 30th, 2026


    - The following endpoints are no longer in BETA:


    | Method | URL                                         |
    Summary                                        |

    | ------ | ------------------------------------------- |
    ---------------------------------------------- |

    | GET    | `/v2/notes`                                 | Get all
    Notes                                  |

    | GET    | `/v2/notes/{noteId}`                        | Get a Note with a
    given id                     |

    | GET    | `/v2/notes/{noteId}/attached-companies`     | Get directly
    attached companies for a Note     |

    | GET    | `/v2/notes/{noteId}/attached-opportunities` | Get directly
    attached opportunities for a Note |

    | GET    | `/v2/notes/{noteId}/attached-persons`       | Get directly
    attached persons for a Note       |

    | GET    | `/v2/notes/{noteId}/replies`                | Get reply notes for
    a given Note               |


    ## January 26th, 2026


    - Added the following endpoints in BETA:


    | Method | URL                                        |
    Summary                              |

    | ------ | ------------------------------------------ |
    ------------------------------------ |

    | GET    | `/v2/transcripts`                          | Get All
    Transcripts                  |

    | GET    | `/v2/transcripts/{transcriptId}`           | Get
    Transcript                       |

    | GET    | `/v2/transcripts/{transcriptId}/fragments` | Get Fragments on a
    single Transcript |


    ## January 14th, 2026


    - Rate limit response headers have been updated to use lowercase formatting.
    This change affects all
      API endpoints. The new lowercase headers are:

    | Header                           |
    Description                                             |

    | -------------------------------- |
    ------------------------------------------------------- |

    | x-ratelimit-limit-user           | Number of requests allowed per minute
    for the user      |

    | x-ratelimit-limit-user-remaining | Number of requests remaining for the
    user               |

    | x-ratelimit-limit-user-reset     | Time in seconds before the limit resets
    for the user    |

    | x-ratelimit-limit-org            | Number of requests allowed per month
    for the account    |

    | x-ratelimit-limit-org-remaining  | Number of requests remaining for the
    account            |

    | x-ratelimit-limit-org-reset      | Time in seconds before the limit resets
    for the account |


    ## January 1st, 2026


    - API Change: Handling timestamps for date fields. Affinity is standardizing
    how dates are
      represented across the platform to ensure consistency between the application and the API.
      Starting January 1st, 2026, the API will change how it handles timestamps for date fields. Today,
      timestamps sent to date fields over the API are not visible to users in any CRM interface. After
      this change, the API will ignore any time information included in requests, storing and returning
      values at midnight Pacific Time (PT) on the submitted date.

      **Example:**
      - API request includes: `2024-04-01T15:30:00Z`
      - Affinity will store and return: `2024-04-01T07:00:00.000Z` (equivalent to midnight PT)

      Any existing date field values that currently include timestamps will also be updated to reflect
      midnight PT on their stored date. No action is required unless your integration depends on time
      data within date fields.

    ## September 25th, 2025


    - Added the following endpoints in BETA:


    | Method | URL                                 |
    Summary                      |

    | ------ | ----------------------------------- |
    ---------------------------- |

    | GET    | `/v2/company-merges`                | Get All Company Merge
    status |

    | POST   | `/v2/company-merges`                | Initiate Company
    Merge       |

    | GET    | `/v2/company-merges/{mergeId}`      | Get Company Merge
    status     |

    | GET    | `/v2/tasks/company-merges`          | Get All Company Merge
    Tasks  |

    | GET    | `/v2/tasks/company-merges/{taskId}` | Get Company Merge
    Task       |


    ## July 30th, 2025


    - Added the following endpoints in BETA:


    | Method | URL                                         |
    Summary                                        |

    | ------ | ------------------------------------------- |
    ---------------------------------------------- |

    | GET    | `/v2/person-merges`                         | Get All Person
    Merge status                    |

    | POST   | `/v2/person-merges`                         | Initiate Person
    Merge                          |

    | GET    | `/v2/person-merges/{mergeId}`               | Get Person Merge
    status                        |

    | GET    | `/v2/tasks/person-merges`                   | Get All Person
    Merge Tasks                     |

    | GET    | `/v2/tasks/person-merges/{taskId}`          | Get Person Merge
    Task                          |

    | GET    | `/v2/notes`                                 | Get all
    Notes                                  |

    | GET    | `/v2/notes/{noteId}`                        | Get a Note with a
    given id                     |

    | GET    | `/v2/notes/{noteId}/attached-companies`     | Get directly
    attached companies for a Note     |

    | GET    | `/v2/notes/{noteId}/attached-opportunities` | Get directly
    attached opportunities for a Note |

    | GET    | `/v2/notes/{noteId}/attached-persons`       | Get directly
    attached persons for a Note       |

    | GET    | `/v2/notes/{noteId}/replies`                | Get reply notes for
    a given Note               |


    ## May 14th, 2025


    - Renamed all path parameters named simply "id" to a more descriptive name
    (eg. "personId"). This
      will not have any effect on the API at runtime, but may impact code relying on the OpenAPI spec
      doing type generation.

    ## April 9th, 2025


    - The following endpoints are no longer in BETA:


    | Method | URL                                                             
    | Summary                                           |

    | ------ | ----------------------------------------------------------------
    | ------------------------------------------------- |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}`                 
    | Get a single List Entry on a List                 |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}/fields`          
    | Get field values on a single List Entry           |

    | PATCH  | `/v2/lists/{listId}/list-entries/{listEntryId}/fields`          
    | Perform batch operations on a list entry's fields |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}/fields/{fieldId}`
    | Get a single field value                          |

    | POST   | `/v2/lists/{listId}/list-entries/{listEntryId}/fields/{fieldId}`
    | Update a single field value on a List Entry       |


    ## March 31st, 2025


    - The following beta endpoints now support updating association fields.


    | Method | URL                                                             
    | Summary                                           |

    | ------ | ----------------------------------------------------------------
    | ------------------------------------------------- |

    | PATCH  | `/v2/lists/{listId}/list-entries/{listEntryId}/fields`          
    | Perform batch operations on a list entry's fields |

    | POST   | `/v2/lists/{listId}/list-entries/{listEntryId}/fields/{fieldId}`
    | Update a single field value on a List Entry       |


    ## February 28th, 2025


    - Added the following endpoints in BETA:


    | Method | URL                                                             
    | Summary                                           |

    | ------ | ----------------------------------------------------------------
    | ------------------------------------------------- |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}`                 
    | Get a single List Entry on a List                 |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}/fields`          
    | Get field values on a single List Entry           |

    | PATCH  | `/v2/lists/{listId}/list-entries/{listEntryId}/fields`          
    | Perform batch operations on a list entry's fields |

    | GET    | `/v2/lists/{listId}/list-entries/{listEntryId}/fields/{fieldId}`
    | Get a single field value                          |

    | POST   | `/v2/lists/{listId}/list-entries/{listEntryId}/fields/{fieldId}`
    | Update a single field value on a List Entry       |


    ## January 17th, 2025


    - Document `X-Ratelimit` headers in the schema for all endpoints.


    ## January 15th, 2025


    - Add default responses to all endpoints to document all possible error
    codes that can be returned
      by the API.
    - Updated 400 error responses to correctly include the `bad-request` error
    code as a possible error.


    ## December 3rd, 2024


    - Properly document `listId` property on `CompanyListEntry`,
    `PersonListEntry`, and
      `OpportunityListEntry` schemas.

    ## September 25th, 2024


    - Upgrade schema to OpenAPI 3.1


    ## August 5, 2024


    - Correct `opp` to `opportunity` to match documentation for the `List`
    `type` property.


    ## July 24, 2024


    - More accurate documentation for response properties that are enums — Enums
    with `null` as a
      possible value will have it listed as one.

    ## March 25, 2024


    - Added the ability to retrieve the date and other details of your firm's
    "First Email", "Last
      Email", "First Event", "Last Event", "Next Event", "First Chat Message", "Last Chat Message", and
      "Last Contact" with a given entity. Use these timestamps to add relationship context to your
      applications, and to identify founders and companies that need investors' attention.
    - Endpoints that previously required a `fieldIds` parameter to return field
    data, now accept either
      `fieldIds` or `fieldTypes`, and will return field data accordingly. See the
      [Specifying Desired Fields (Field Selection)](/pages/data-model/working-with-field-data) section
      of these docs for more information. The new `fieldTypes` parameter should make field data
      retrieval easier for users looking to pull data from many similar Fields at a time.

    ## January 4, 2023


    - Most endpoints that return field data now require the user to use the
    `fieldIds` parameter to
      specify which Fields they want data for. Without `fieldIds` specified, these endpoints will return
      basic entity data but not field data.

    ## December 12, 2023


    - Added the ability to retrieve metadata (e.g. ID, name, type, enrichment
    source, and data type) on
      Fields. See the [Retrieving Field Metadata](/pages/data-model/working-with-field-data) section of
      these docs for more information.
  license:
    name: Proprietary
    url: https://www.affinity.co/legal/terms-of-use
  termsOfService: https://www.affinity.co/legal/terms-of-use
  title: Affinity API v2
  x-logo:
    url: https://assets.affinity.co/img/logos/full-color-svg.svg
    altText: Affinity logo
servers:
  - url: https://api.affinity.co
security:
  - bearerAuth: []
tags:
  - description: Operations about Auth
    name: Auth
  - description: Operations about Calls
    name: Calls
  - description: Operations about chat messages
    name: Chat Messages
  - description: Operations about companies
    name: Companies
  - description: Operations about company merges
    name: Company Merges
  - description: Operations about emails
    name: Emails
  - description: Operations about feedback
    name: Feedback
  - description: Operations about field value changes
    name: Field Value Changes
  - description: Operations about files
    name: Files
  - description: Operations about inferred connections
    name: Inferred Connections
  - description: Operations about lists
    name: Lists
  - description: Operations about meetings
    name: Meetings
  - description: Operations about notes
    name: Notes
  - description: Operations about opportunities
    name: Opportunities
  - description: Operations about person merges
    name: Person Merges
  - description: Operations about persons
    name: Persons
  - description: Operations about reminders
    name: Reminders
  - description: Operations about semantic searches
    name: Semantic Search
  - description: Operations about transcripts
    name: Transcripts
  - description: Operations about users
    name: Users
paths:
  /v2/companies/search:
    post:
      tags:
        - Companies
      summary: Search Companies
      description: >
        | ⚠️  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](/pages/external-api-v2/permissions).


        ### Field IDs


        Field IDs used in `filters`, `sorts`, and `search.fieldIds` follow the
        formats described in [Working with Field
        Data](/pages/data-model/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.
      operationId: v2_companies_search__POST
      parameters:
        - name: fieldIds
          description: >-
            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.
          in: query
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
          example:
            - field-1234
            - affinity-data-employees-current
        - name: fieldTypes
          description: >-
            A category of fields for which to return field data on each Company.
            Cannot be used together with `fieldIds`; use one or the other.
          in: query
          style: form
          explode: true
          schema:
            type: array
            items:
              type: string
              enum:
                - enriched
                - global
                - relationship-intelligence
        - name: cursor
          description: Cursor for the next or previous page.
          in: query
          schema:
            type: string
        - name: limit
          description: Maximum number of Companies to return per page.
          in: query
          schema:
            type: integer
            format: int32
            minimum: 1
            maximum: 100
            default: 100
        - name: totalCount
          description: >-
            When `true`, includes the total count of matching Companies in the
            pagination response. Adds additional query cost; use only when
            needed.
          in: query
          schema:
            type: boolean
            default: false
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchCriteria'
            examples:
              filter-by-dropdown:
                $ref: '#/components/examples/filter-by-dropdown'
              filter-and-sort:
                $ref: '#/components/examples/filter-and-sort'
              grouped-filter:
                $ref: '#/components/examples/grouped-filter'
              search-with-filter:
                $ref: '#/components/examples/search-with-filter'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyPaged'
          headers:
            x-ratelimit-limit-user:
              $ref: '#/components/headers/X-Ratelimit-Limit-User'
            x-ratelimit-limit-user-remaining:
              $ref: '#/components/headers/X-Ratelimit-Limit-User-Remaining'
            x-ratelimit-limit-user-reset:
              $ref: '#/components/headers/X-Ratelimit-Limit-User-Reset'
            x-ratelimit-limit-org:
              $ref: '#/components/headers/X-Ratelimit-Limit-Org'
            x-ratelimit-limit-org-remaining:
              $ref: '#/components/headers/X-Ratelimit-Limit-Org-Remaining'
            x-ratelimit-limit-org-reset:
              $ref: '#/components/headers/X-Ratelimit-Limit-Org-Reset'
        '400':
          $ref: '#/components/responses/400'
        '403':
          $ref: '#/components/responses/403'
        default:
          $ref: '#/components/responses/default'
components:
  schemas:
    SearchCriteria:
      title: SearchCriteria
      description: >-
        Search criteria for filtering, sorting, and searching. All fields are
        optional — omitting the body returns all results with default
        pagination.
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/FilterGroup'
          description: >-
            A tree of filter conditions to apply. Supports nested AND/OR
            grouping. Use the relevant fields endpoint for your resource type to
            discover available fields, their `valueType`, and supported
            operators.
        sorts:
          description: >-
            One or more sort criteria, applied in order. Supports up to 5 sort
            items. Use the relevant fields endpoint for your resource type to
            discover sortable fields.
          type: array
          items:
            $ref: '#/components/schemas/SearchSort'
          minItems: 1
          maxItems: 5
        search:
          $ref: '#/components/schemas/SearchTerm'
          description: >-
            An optional keyword to match against field values. Results must
            satisfy both the search term AND any provided filters
            (intersection). Only one search object may be provided. The term is
            always matched against the entity name and primary identifier;
            providing `fieldIds` extends the search to additional fields rather
            than replacing the identity match.
      additionalProperties: false
    CompanyPaged:
      title: CompanyPaged
      description: CompanyPaged model
      type: object
      properties:
        data:
          description: A page of Company results
          type: array
          items:
            $ref: '#/components/schemas/Company'
          maxItems: 100
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
      additionalProperties: false
      example:
        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
    FilterGroup:
      title: FilterGroup
      description: >-
        A logical group of filters combined with AND or OR. Groups can be nested
        to build complex filter trees. Each group may contain up to 50 items.
        Items can be individual filters or nested filter groups.
      type: object
      properties:
        operator:
          description: The logical operator applied to all filters in this group
          type: string
          enum:
            - and
            - or
        filters:
          description: A list of filters or nested filter groups.
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ValueFilter'
              - $ref: '#/components/schemas/FilterGroup'
          minItems: 0
          maxItems: 50
      required:
        - operator
        - filters
      additionalProperties: false
    SearchSort:
      title: SearchSort
      description: >-
        A single sort criterion. Up to 5 sorts may be specified and are applied
        in order. Use the relevant fields endpoint for your resource type to
        discover sortable fields and valid `attributeId` values.
      type: object
      properties:
        fieldId:
          description: The ID of the field to sort on
          type: string
          minLength: 1
        attributeId:
          description: >-
            The ID of the attribute to sort on. Required for some fields such as
            relationship intelligence fields. Use the relevant fields endpoint
            for your resource type to discover which fields require an
            `attributeId` and what values are valid.
          type: string
          minLength: 1
        direction:
          description: The sort direction
          type: string
          enum:
            - asc
            - desc
      required:
        - fieldId
        - direction
      additionalProperties: false
    SearchTerm:
      title: SearchTerm
      description: >-
        A single keyword or phrase to match against field values. Multiple terms
        or comma-separated values are not supported; use a single search string.
      type: object
      properties:
        term:
          description: The text to search for. Minimum 3 characters.
          type: string
          minLength: 3
        fieldIds:
          description: >-
            The IDs of additional fields to match the term against, extending
            the default identity search. Use the relevant fields endpoint for
            your resource type to discover available field IDs. Supports up to
            100 field IDs.


            Fields with a `valueType` of `datetime` are not searchable and are
            silently ignored if included.
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 100
      required:
        - term
      additionalProperties: false
    Company:
      title: Company
      description: Company model
      type: object
      properties:
        id:
          description: The company's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        name:
          description: The company's name
          type: string
          example: Horizon Technologies
        domain:
          description: The company's primary domain
          type:
            - string
            - 'null'
          format: hostname
          example: horizontech.com
        domains:
          description: All of the company's domains
          type: array
          items:
            type: string
            format: hostname
          example:
            - horizontech.com
        isGlobal:
          description: Whether or not the company is tenant specific
          type: boolean
          example: true
        fields:
          description: The fields associated with the company
          type: array
          items:
            $ref: '#/components/schemas/Field'
      required:
        - domain
        - domains
        - id
        - isGlobal
        - name
      additionalProperties: false
    Pagination:
      title: Pagination
      type: object
      properties:
        prevUrl:
          description: URL for the previous page
          type:
            - string
            - 'null'
          format: uri
          example: https://api.affinity.co/v2/foo?cursor=ICAgICAgYmVmb3JlOjo6Nw
        nextUrl:
          description: URL for the next page
          type:
            - string
            - 'null'
          format: uri
          example: https://api.affinity.co/v2/foo?cursor=ICAgICAgIGFmdGVyOjo6NA
    BadRequestError:
      title: BadRequestError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: bad-request
          example: bad-request
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    ValidationError:
      title: ValidationError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: validation
          example: validation
        message:
          description: Error message
          type: string
        param:
          description: Param the error refers to
          type: string
          example: limit
      required:
        - code
        - message
        - param
      additionalProperties: false
    AuthorizationErrors:
      title: AuthorizationErrors
      description: AuthorizationErrors model
      type: object
      properties:
        errors:
          description: AuthorizationError errors
          type: array
          items:
            $ref: '#/components/schemas/AuthorizationError'
      required:
        - errors
      additionalProperties: false
    Errors:
      title: Errors
      type: object
      properties:
        errors:
          description: Errors
          type: array
          items:
            $ref: '#/components/schemas/Error'
      required:
        - errors
      additionalProperties: false
    ValueFilter:
      title: ValueFilter
      description: >-
        A filter applied to a single field value. The `valueType` determines
        which filter variant applies and what operators and `value` shapes are
        valid.

        Each filter requires `fieldId`, `valueType`, and `operator`. The `value`
        field is required for most operators and absent for `is-empty` and
        `is-not-empty`. Some fields also require an `attributeId` — use the
        relevant fields endpoint for your resource type to discover available
        fields, their `valueType`, supported operators, and required
        `attributeId` values.
      anyOf:
        - $ref: '#/components/schemas/CompanyFilter'
        - $ref: '#/components/schemas/CompaniesFilter'
        - $ref: '#/components/schemas/PersonFilter'
        - $ref: '#/components/schemas/PersonsFilter'
        - $ref: '#/components/schemas/DropdownFilter'
        - $ref: '#/components/schemas/DropdownsFilter'
        - $ref: '#/components/schemas/RankedDropdownFilter'
        - $ref: '#/components/schemas/DateFilter'
        - $ref: '#/components/schemas/NumberFilter'
        - $ref: '#/components/schemas/FilterableTextFilter'
        - $ref: '#/components/schemas/FilterableTextsFilter'
        - $ref: '#/components/schemas/TextFilter'
        - $ref: '#/components/schemas/LocationFilter'
        - $ref: '#/components/schemas/LocationsFilter'
      discriminator:
        propertyName: valueType
        mapping:
          company:
            $ref: '#/components/schemas/CompanyFilter'
          company-multi:
            $ref: '#/components/schemas/CompaniesFilter'
          person:
            $ref: '#/components/schemas/PersonFilter'
          person-multi:
            $ref: '#/components/schemas/PersonsFilter'
          dropdown:
            $ref: '#/components/schemas/DropdownFilter'
          dropdown-multi:
            $ref: '#/components/schemas/DropdownsFilter'
          ranked-dropdown:
            $ref: '#/components/schemas/RankedDropdownFilter'
          date:
            $ref: '#/components/schemas/DateFilter'
          number:
            $ref: '#/components/schemas/NumberFilter'
          filterable-text:
            $ref: '#/components/schemas/FilterableTextFilter'
          filterable-text-multi:
            $ref: '#/components/schemas/FilterableTextsFilter'
          text:
            $ref: '#/components/schemas/TextFilter'
          location:
            $ref: '#/components/schemas/LocationFilter'
          location-multi:
            $ref: '#/components/schemas/LocationsFilter'
    Field:
      title: Field
      type: object
      properties:
        id:
          description: The field's unique identifier
          type: string
          example: affinity-data-location
        name:
          description: The field's name
          type: string
          example: Location
        type:
          description: The field's type
          type: string
          enum:
            - enriched
            - global
            - list
            - relationship-intelligence
          example: enriched
        enrichmentSource:
          description: The source of the data in this Field (if it is enriched)
          type:
            - string
            - 'null'
          enum:
            - affinity-data
            - dealroom
            - eventbrite
            - mailchimp
            - null
          example: affinity-data
        value:
          $ref: '#/components/schemas/FieldValue'
      required:
        - enrichmentSource
        - id
        - name
        - type
        - value
      additionalProperties: false
    AuthorizationError:
      title: AuthorizationError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: authorization
          example: authorization
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    Error:
      title: Error
      oneOf:
        - $ref: '#/components/schemas/AuthenticationError'
        - $ref: '#/components/schemas/AuthorizationError'
        - $ref: '#/components/schemas/BadRequestError'
        - $ref: '#/components/schemas/ConflictError'
        - $ref: '#/components/schemas/MethodNotAllowedError'
        - $ref: '#/components/schemas/NotAcceptableError'
        - $ref: '#/components/schemas/NotFoundError'
        - $ref: '#/components/schemas/NotImplementedError'
        - $ref: '#/components/schemas/RateLimitError'
        - $ref: '#/components/schemas/ServerError'
        - $ref: '#/components/schemas/TimeoutError'
        - $ref: '#/components/schemas/UnprocessableEntityError'
        - $ref: '#/components/schemas/UnsupportedMediaTypeError'
        - $ref: '#/components/schemas/ValidationError'
      discriminator:
        propertyName: code
        mapping:
          authentication:
            $ref: '#/components/schemas/AuthenticationError'
          authorization:
            $ref: '#/components/schemas/AuthorizationError'
          bad-request:
            $ref: '#/components/schemas/BadRequestError'
          conflict:
            $ref: '#/components/schemas/ConflictError'
          method-not-allowed:
            $ref: '#/components/schemas/MethodNotAllowedError'
          not-acceptable:
            $ref: '#/components/schemas/NotAcceptableError'
          not-found:
            $ref: '#/components/schemas/NotFoundError'
          not-implemented:
            $ref: '#/components/schemas/NotImplementedError'
          rate-limit:
            $ref: '#/components/schemas/RateLimitError'
          server:
            $ref: '#/components/schemas/ServerError'
          timeout:
            $ref: '#/components/schemas/TimeoutError'
          unprocessable-entity:
            $ref: '#/components/schemas/UnprocessableEntityError'
          unsupported-media-type:
            $ref: '#/components/schemas/UnsupportedMediaTypeError'
          validation:
            $ref: '#/components/schemas/ValidationError'
    CompanyFilter:
      title: CompanyFilter
      description: Filter for single-company fields
      oneOf:
        - $ref: '#/components/schemas/CompanyFilterMultiValues'
        - $ref: '#/components/schemas/CompanyFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/CompanyFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/CompanyFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/CompanyFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/CompanyFilterNoValue'
    CompaniesFilter:
      title: CompaniesFilter
      description: Filter for multi-company fields
      oneOf:
        - $ref: '#/components/schemas/CompaniesFilterMultiValues'
        - $ref: '#/components/schemas/CompaniesFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          has-any-of:
            $ref: '#/components/schemas/CompaniesFilterMultiValues'
          has-none-of:
            $ref: '#/components/schemas/CompaniesFilterMultiValues'
          has-all-of:
            $ref: '#/components/schemas/CompaniesFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/CompaniesFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/CompaniesFilterNoValue'
    PersonFilter:
      title: PersonFilter
      description: Filter for single-person fields
      oneOf:
        - $ref: '#/components/schemas/PersonFilterMultiValues'
        - $ref: '#/components/schemas/PersonFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/PersonFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/PersonFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/PersonFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/PersonFilterNoValue'
    PersonsFilter:
      title: PersonsFilter
      description: Filter for multi-person fields
      oneOf:
        - $ref: '#/components/schemas/PersonsFilterMultiValues'
        - $ref: '#/components/schemas/PersonsFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          has-any-of:
            $ref: '#/components/schemas/PersonsFilterMultiValues'
          has-none-of:
            $ref: '#/components/schemas/PersonsFilterMultiValues'
          has-all-of:
            $ref: '#/components/schemas/PersonsFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/PersonsFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/PersonsFilterNoValue'
    DropdownFilter:
      title: DropdownFilter
      description: Filter for dropdown fields
      oneOf:
        - $ref: '#/components/schemas/DropdownFilterMultiValues'
        - $ref: '#/components/schemas/DropdownFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/DropdownFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/DropdownFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/DropdownFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/DropdownFilterNoValue'
    DropdownsFilter:
      title: DropdownsFilter
      description: Filter for multi-dropdown fields
      oneOf:
        - $ref: '#/components/schemas/DropdownsFilterMultiValues'
        - $ref: '#/components/schemas/DropdownsFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          has-any-of:
            $ref: '#/components/schemas/DropdownsFilterMultiValues'
          has-none-of:
            $ref: '#/components/schemas/DropdownsFilterMultiValues'
          has-all-of:
            $ref: '#/components/schemas/DropdownsFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/DropdownsFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/DropdownsFilterNoValue'
    RankedDropdownFilter:
      title: RankedDropdownFilter
      description: Filter for ranked-dropdown fields
      oneOf:
        - $ref: '#/components/schemas/RankedDropdownFilterMultiValues'
        - $ref: '#/components/schemas/RankedDropdownFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/RankedDropdownFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/RankedDropdownFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/RankedDropdownFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/RankedDropdownFilterNoValue'
    DateFilter:
      title: DateFilter
      description: Filter for date fields
      oneOf:
        - $ref: '#/components/schemas/DateFilterOneValue'
        - $ref: '#/components/schemas/DateFilterRange'
        - $ref: '#/components/schemas/DateFilterRelative'
        - $ref: '#/components/schemas/DateFilterRelativeDate'
        - $ref: '#/components/schemas/DateFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-on:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-not-on:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-before:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-on-or-before:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-after:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-on-or-after:
            $ref: '#/components/schemas/DateFilterOneValue'
          is-between:
            $ref: '#/components/schemas/DateFilterRange'
          is-within-the-last:
            $ref: '#/components/schemas/DateFilterRelative'
          is-not-within-the-last:
            $ref: '#/components/schemas/DateFilterRelative'
          is-within-the-next:
            $ref: '#/components/schemas/DateFilterRelative'
          is-not-within-the-next:
            $ref: '#/components/schemas/DateFilterRelative'
          is-between-relative:
            $ref: '#/components/schemas/DateFilterRelative'
          is-exactly-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-not-exactly-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-more-than-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-more-than-or-equal-to-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-less-than-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-less-than-or-equal-to-relative:
            $ref: '#/components/schemas/DateFilterRelativeDate'
          is-empty:
            $ref: '#/components/schemas/DateFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/DateFilterNoValue'
    NumberFilter:
      title: NumberFilter
      description: Filter for number fields
      oneOf:
        - $ref: '#/components/schemas/NumberFilterOneValue'
        - $ref: '#/components/schemas/NumberFilterRange'
        - $ref: '#/components/schemas/NumberFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-equal-to:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-not-equal-to:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-greater-than:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-greater-than-or-equal-to:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-less-than:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-less-than-or-equal-to:
            $ref: '#/components/schemas/NumberFilterOneValue'
          is-between:
            $ref: '#/components/schemas/NumberFilterRange'
          is-empty:
            $ref: '#/components/schemas/NumberFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/NumberFilterNoValue'
    FilterableTextFilter:
      title: FilterableTextFilter
      description: >-
        Filter for filterable-text fields (single-value structured text with
        predefined options)
      oneOf:
        - $ref: '#/components/schemas/FilterableTextFilterMultiValues'
        - $ref: '#/components/schemas/FilterableTextFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/FilterableTextFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/FilterableTextFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/FilterableTextFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/FilterableTextFilterNoValue'
    FilterableTextsFilter:
      title: FilterableTextsFilter
      description: >-
        Filter for filterable-text-multi fields (multi-value structured text
        with predefined options)
      oneOf:
        - $ref: '#/components/schemas/FilterableTextsFilterMultiValues'
        - $ref: '#/components/schemas/FilterableTextsFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          has-any-of:
            $ref: '#/components/schemas/FilterableTextsFilterMultiValues'
          has-none-of:
            $ref: '#/components/schemas/FilterableTextsFilterMultiValues'
          has-all-of:
            $ref: '#/components/schemas/FilterableTextsFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/FilterableTextsFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/FilterableTextsFilterNoValue'
    TextFilter:
      title: TextFilter
      description: Filter for free-text fields
      oneOf:
        - $ref: '#/components/schemas/TextFilterOneValue'
        - $ref: '#/components/schemas/TextFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          contains:
            $ref: '#/components/schemas/TextFilterOneValue'
          does-not-contain:
            $ref: '#/components/schemas/TextFilterOneValue'
          starts-with:
            $ref: '#/components/schemas/TextFilterOneValue'
          ends-with:
            $ref: '#/components/schemas/TextFilterOneValue'
          is-empty:
            $ref: '#/components/schemas/TextFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/TextFilterNoValue'
    LocationFilter:
      title: LocationFilter
      description: Filter for single-location fields
      oneOf:
        - $ref: '#/components/schemas/LocationFilterMultiValues'
        - $ref: '#/components/schemas/LocationFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          is-any-of:
            $ref: '#/components/schemas/LocationFilterMultiValues'
          is-none-of:
            $ref: '#/components/schemas/LocationFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/LocationFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/LocationFilterNoValue'
    LocationsFilter:
      title: LocationsFilter
      description: Filter for multi-location fields
      oneOf:
        - $ref: '#/components/schemas/LocationsFilterMultiValues'
        - $ref: '#/components/schemas/LocationsFilterNoValue'
      discriminator:
        propertyName: operator
        mapping:
          has-any-of:
            $ref: '#/components/schemas/LocationsFilterMultiValues'
          has-none-of:
            $ref: '#/components/schemas/LocationsFilterMultiValues'
          has-all-of:
            $ref: '#/components/schemas/LocationsFilterMultiValues'
          is-empty:
            $ref: '#/components/schemas/LocationsFilterNoValue'
          is-not-empty:
            $ref: '#/components/schemas/LocationsFilterNoValue'
    FieldValue:
      title: FieldValue
      oneOf:
        - $ref: '#/components/schemas/CompaniesValue'
        - $ref: '#/components/schemas/CompanyValue'
        - $ref: '#/components/schemas/DateValue'
        - $ref: '#/components/schemas/DropdownsValue'
        - $ref: '#/components/schemas/DropdownValue'
        - $ref: '#/components/schemas/FloatsValue'
        - $ref: '#/components/schemas/FloatValue'
        - $ref: '#/components/schemas/FormulaValue'
        - $ref: '#/components/schemas/InteractionValue'
        - $ref: '#/components/schemas/LocationsValue'
        - $ref: '#/components/schemas/LocationValue'
        - $ref: '#/components/schemas/PersonsValue'
        - $ref: '#/components/schemas/PersonValue'
        - $ref: '#/components/schemas/RankedDropdownValue'
        - $ref: '#/components/schemas/TextsValue'
        - $ref: '#/components/schemas/TextValue'
      discriminator:
        propertyName: type
        mapping:
          company:
            $ref: '#/components/schemas/CompanyValue'
          company-multi:
            $ref: '#/components/schemas/CompaniesValue'
          datetime:
            $ref: '#/components/schemas/DateValue'
          dropdown:
            $ref: '#/components/schemas/DropdownValue'
          dropdown-multi:
            $ref: '#/components/schemas/DropdownsValue'
          number:
            $ref: '#/components/schemas/FloatValue'
          number-multi:
            $ref: '#/components/schemas/FloatsValue'
          filterable-text:
            $ref: '#/components/schemas/TextValue'
          filterable-text-multi:
            $ref: '#/components/schemas/TextsValue'
          formula-number:
            $ref: '#/components/schemas/FormulaValue'
          interaction:
            $ref: '#/components/schemas/InteractionValue'
          location:
            $ref: '#/components/schemas/LocationValue'
          location-multi:
            $ref: '#/components/schemas/LocationsValue'
          person:
            $ref: '#/components/schemas/PersonValue'
          person-multi:
            $ref: '#/components/schemas/PersonsValue'
          ranked-dropdown:
            $ref: '#/components/schemas/RankedDropdownValue'
          text:
            $ref: '#/components/schemas/TextValue'
    AuthenticationError:
      title: AuthenticationError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: authentication
          example: authentication
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    ConflictError:
      title: ConflictError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: conflict
          example: conflict
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    MethodNotAllowedError:
      title: MethodNotAllowedError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: method-not-allowed
          example: method-not-allowed
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    NotAcceptableError:
      title: NotAcceptableError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: not-acceptable
          example: not-acceptable
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    NotFoundError:
      title: NotFoundError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: not-found
          example: not-found
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    NotImplementedError:
      title: NotImplementedError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: not-implemented
          example: not-implemented
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    RateLimitError:
      title: RateLimitError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: rate-limit
          example: rate-limit
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    ServerError:
      title: ServerError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: server
          example: server
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    TimeoutError:
      title: TimeoutError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: timeout
          example: timeout
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    UnprocessableEntityError:
      title: UnprocessableEntityError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: unprocessable-entity
          example: unprocessable-entity
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    UnsupportedMediaTypeError:
      title: UnsupportedMediaTypeError
      type: object
      properties:
        code:
          description: Error code
          type: string
          const: unsupported-media-type
          example: unsupported-media-type
        message:
          description: Error message
          type: string
      required:
        - code
        - message
      additionalProperties: false
    CompanyFilterMultiValues:
      title: CompanyFilterMultiValues
      description: Filter for single-company fields matching against one or more companies
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: company
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more companies to match against
          type: array
          items:
            $ref: '#/components/schemas/CompanyReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    CompanyFilterNoValue:
      title: CompanyFilterNoValue
      description: Filter for single-company fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: company
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    CompaniesFilterMultiValues:
      title: CompaniesFilterMultiValues
      description: Filter for multi-company fields matching against one or more companies
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: company-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - has-any-of
            - has-none-of
            - has-all-of
        value:
          description: One or more companies to match against
          type: array
          items:
            $ref: '#/components/schemas/CompanyReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    CompaniesFilterNoValue:
      title: CompaniesFilterNoValue
      description: Filter for multi-company fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: company-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    PersonFilterMultiValues:
      title: PersonFilterMultiValues
      description: Filter for single-person fields matching against one or more persons
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: person
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more persons to match against
          type: array
          items:
            $ref: '#/components/schemas/PersonReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    PersonFilterNoValue:
      title: PersonFilterNoValue
      description: Filter for single-person fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: person
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    PersonsFilterMultiValues:
      title: PersonsFilterMultiValues
      description: Filter for multi-person fields matching against one or more persons
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: person-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - has-any-of
            - has-none-of
            - has-all-of
        value:
          description: One or more persons to match against
          type: array
          items:
            $ref: '#/components/schemas/PersonReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    PersonsFilterNoValue:
      title: PersonsFilterNoValue
      description: Filter for multi-person fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: person-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    DropdownFilterMultiValues:
      title: DropdownFilterMultiValues
      description: Filter for dropdown fields matching against one or more dropdown options
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: dropdown
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more dropdown options to match against
          type: array
          items:
            $ref: '#/components/schemas/DropdownReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DropdownFilterNoValue:
      title: DropdownFilterNoValue
      description: Filter for dropdown fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: dropdown
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    DropdownsFilterMultiValues:
      title: DropdownsFilterMultiValues
      description: >-
        Filter for multi-dropdown fields matching against one or more dropdown
        options
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: dropdown-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - has-any-of
            - has-none-of
            - has-all-of
        value:
          description: One or more dropdown options to match against
          type: array
          items:
            $ref: '#/components/schemas/DropdownReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DropdownsFilterNoValue:
      title: DropdownsFilterNoValue
      description: Filter for multi-dropdown fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: dropdown-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    RankedDropdownFilterMultiValues:
      title: RankedDropdownFilterMultiValues
      description: >-
        Filter for ranked-dropdown fields matching against one or more ranked
        dropdown options
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: ranked-dropdown
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more ranked dropdown options to match against
          type: array
          items:
            $ref: '#/components/schemas/RankedDropdownReference'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    RankedDropdownFilterNoValue:
      title: RankedDropdownFilterNoValue
      description: >-
        Filter for ranked-dropdown fields based on presence or absence of a
        value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: ranked-dropdown
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    DateFilterOneValue:
      title: DateFilterOneValue
      description: Filter for date fields relative to or matching a single date
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: date
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-on
            - is-not-on
            - is-before
            - is-on-or-before
            - is-after
            - is-on-or-after
        value:
          description: The date to filter against
          type: string
          format: date
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DateFilterRange:
      title: DateFilterRange
      description: Filter for date fields within an absolute date range (inclusive)
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: date
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          const: is-between
        value:
          description: >-
            Two dates defining the inclusive range, start date first, end date
            second
          type: array
          items:
            type: string
            format: date
          minItems: 2
          maxItems: 2
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DateFilterRelative:
      title: DateFilterRelative
      description: Filter for date fields within a relative date window
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: date
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-within-the-last
            - is-not-within-the-last
            - is-within-the-next
            - is-not-within-the-next
            - is-between-relative
        value:
          $ref: '#/components/schemas/RelativeDates'
          description: The relative date window definition, specifying an amount and unit
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DateFilterRelativeDate:
      title: DateFilterRelativeDate
      description: Filter for date fields using a single relative duration threshold
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: date
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - 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
        value:
          $ref: '#/components/schemas/RelativeDate'
          description: The relative duration threshold
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    DateFilterNoValue:
      title: DateFilterNoValue
      description: Filter for date fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: date
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    NumberFilterOneValue:
      title: NumberFilterOneValue
      description: Filter for number fields comparing against a single numeric value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: number
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - 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
        value:
          description: The number to compare against
          type: number
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    NumberFilterRange:
      title: NumberFilterRange
      description: Filter for number fields within a numeric range (inclusive)
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: number
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          const: is-between
        value:
          description: >-
            Exactly two numbers defining the inclusive range (lower bound first,
            upper bound second)
          type: array
          items:
            type: number
          minItems: 2
          maxItems: 2
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    NumberFilterNoValue:
      title: NumberFilterNoValue
      description: Filter for number fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: number
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    FilterableTextFilterMultiValues:
      title: FilterableTextFilterMultiValues
      description: >-
        Filter for filterable-text fields matching against one or more text
        values
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: filterable-text
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more text values to match against
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    FilterableTextFilterNoValue:
      title: FilterableTextFilterNoValue
      description: >-
        Filter for filterable-text fields based on presence or absence of a
        value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: filterable-text
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    FilterableTextsFilterMultiValues:
      title: FilterableTextsFilterMultiValues
      description: >-
        Filter for filterable-text-multi fields matching against one or more
        text values
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: filterable-text-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - has-any-of
            - has-none-of
            - has-all-of
        value:
          description: One or more text values to match against
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    FilterableTextsFilterNoValue:
      title: FilterableTextsFilterNoValue
      description: >-
        Filter for filterable-text-multi fields based on presence or absence of
        a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: filterable-text-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    TextFilterOneValue:
      title: TextFilterOneValue
      description: Filter for free-text fields using a string match against a single value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: text
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - contains
            - does-not-contain
            - starts-with
            - ends-with
        value:
          description: The text string to match against
          type: string
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    TextFilterNoValue:
      title: TextFilterNoValue
      description: Filter for free-text fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: text
        fieldId:
          description: The ID of the field to filter on
          type: string
        attributeId:
          description: >-
            The ID of the attribute to filter on. Required for some fields such
            as relationship intelligence fields. Use `GET
            /v2/lists/{listId}/fields?includes=filterability` to discover which
            fields require an `attributeId` and what values are valid.
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    LocationFilterMultiValues:
      title: LocationFilterMultiValues
      description: >-
        Filter for single-location fields matching against one or more location
        values
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: location
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-any-of
            - is-none-of
        value:
          description: One or more locations to match against
          type: array
          items:
            $ref: '#/components/schemas/LocationFilterValue'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    LocationFilterNoValue:
      title: LocationFilterNoValue
      description: >-
        Filter for single-location fields based on presence or absence of a
        value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: location
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    LocationsFilterMultiValues:
      title: LocationsFilterMultiValues
      description: >-
        Filter for multi-location fields matching against one or more location
        values
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: location-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - has-any-of
            - has-none-of
            - has-all-of
        value:
          description: One or more locations to match against
          type: array
          items:
            $ref: '#/components/schemas/LocationFilterValue'
          minItems: 1
          maxItems: 100
      required:
        - valueType
        - fieldId
        - operator
        - value
      additionalProperties: false
    LocationsFilterNoValue:
      title: LocationsFilterNoValue
      description: Filter for multi-location fields based on presence or absence of a value
      type: object
      properties:
        valueType:
          description: The type of the field value
          type: string
          const: location-multi
        fieldId:
          description: The ID of the field to filter on
          type: string
        operator:
          description: The filter operator
          type: string
          enum:
            - is-empty
            - is-not-empty
      required:
        - valueType
        - fieldId
        - operator
      additionalProperties: false
    CompaniesValue:
      title: CompaniesValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: company-multi
        data:
          description: The values for many companies
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/CompanyData'
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: company-multi
        data:
          - id: 1
            name: Horizon Technologies
            domain: horizontech.com
          - id: 2
            name: Crestwood Capital
            domain: crestwoodcap.com
    CompanyValue:
      title: CompanyValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: company
        data:
          oneOf:
            - $ref: '#/components/schemas/CompanyData'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: company
        data:
          id: 1
          name: Horizon Technologies
          domain: horizontech.com
    DateValue:
      title: DateValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: datetime
        data:
          description: The value for a date
          type:
            - string
            - 'null'
          format: date-time
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: datetime
        data: '2023-01-01T00:00:00Z'
    DropdownsValue:
      title: DropdownsValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: dropdown-multi
        data:
          description: The value for many dropdown items
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Dropdown'
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: dropdown-multi
        data:
          - dropdownOptionId: 1
            text: Option 1
          - dropdownOptionId: 2
            text: Option 2
    DropdownValue:
      title: DropdownValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: dropdown
        data:
          oneOf:
            - $ref: '#/components/schemas/Dropdown'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: dropdown
        data:
          dropdownOptionId: 1
          text: Option 1
    FloatsValue:
      title: FloatsValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: number-multi
        data:
          description: The value for many numbers
          type:
            - array
            - 'null'
          items:
            type: number
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: number-multi
        data:
          - 100
          - 200
          - 300
    FloatValue:
      title: FloatValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: number
        data:
          description: The value for a number
          type:
            - number
            - 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: number
        data: 100
    FormulaValue:
      title: FormulaValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: formula-number
        data:
          oneOf:
            - $ref: '#/components/schemas/FormulaNumber'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: formula-number
        data:
          calculatedValue: 100
    InteractionValue:
      title: InteractionValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: interaction
        data:
          oneOf:
            - $ref: '#/components/schemas/Interaction'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: interaction
        data:
          id: 1
          type: meeting
          title: Defective Products
          allDay: false
          startTime: '2020-01-02T00:00:00Z'
          endTime: '2020-01-02T01:00:00Z'
          attendees:
            - emailAddress: alex.rivera@horizontech.com
              person:
                id: 1
                firstName: Alex
                lastName: Rivera
                primaryEmailAddress: alex.rivera@horizontech.com
                type: internal
            - emailAddress: jordan.lee@crestwoodcap.com
              person:
                id: 2
                firstName: Jordan
                lastName: Lee
                primaryEmailAddress: jordan.lee@crestwoodcap.com
                type: external
    LocationsValue:
      title: LocationsValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: location-multi
        data:
          description: The values for many locations
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Location'
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: location-multi
        data:
          - streetAddress: 1 Main Street
            city: San Francisco
            state: California
            country: United States
            continent: North America
          - streetAddress: 1600 Pennsylvania Avenue NW
            city: Washington
            state: DC
            country: United States
            continent: North America
    LocationValue:
      title: LocationValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: location
        data:
          oneOf:
            - $ref: '#/components/schemas/Location'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: location
        data:
          streetAddress: 1 Main Street
          city: San Francisco
          state: California
          country: United States
          continent: North America
    PersonsValue:
      title: PersonsValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: person-multi
        data:
          description: The values for many persons
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/PersonData'
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: person-multi
        data:
          - id: 1
            firstName: Alex
            lastName: Rivera
            primaryEmailAddress: alex.rivera@horizontech.com
            type: internal
          - id: 2
            firstName: Jordan
            lastName: Lee
            primaryEmailAddress: jordan.lee@crestwoodcap.com
            type: external
    PersonValue:
      title: PersonValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: person
        data:
          oneOf:
            - $ref: '#/components/schemas/PersonData'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: person
        data:
          id: 1
          firstName: Alex
          lastName: Rivera
          primaryEmailAddress: alex.rivera@horizontech.com
          type: internal
    RankedDropdownValue:
      title: RankedDropdownValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: ranked-dropdown
        data:
          oneOf:
            - $ref: '#/components/schemas/RankedDropdown'
            - type: 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: ranked-dropdown
        data:
          dropdownOptionId: 1
          text: Option 1
          rank: 1
          color: gray
    TextsValue:
      title: TextsValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          const: filterable-text-multi
        data:
          description: The value for many strings
          type:
            - array
            - 'null'
          items:
            type: string
          maxItems: 100
        totalCount:
          description: >-
            The total number of values for this field. When totalCount exceeds
            the length of data, additional values can be retrieved using the
            field values endpoint.
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: filterable-text-multi
        data:
          - A text value
          - Another text value
    TextValue:
      title: TextValue
      type: object
      properties:
        type:
          description: The type of value
          type: string
          enum:
            - filterable-text
            - text
          example: filterable-text
        data:
          description: The value for a string
          type:
            - string
            - 'null'
      required:
        - data
        - type
      additionalProperties: false
      example:
        type: text
        data: Some new text
    CompanyReference:
      title: CompanyReference
      type: object
      properties:
        id:
          description: The company's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
      required:
        - id
      additionalProperties: false
    PersonReference:
      title: PersonReference
      type: object
      properties:
        id:
          description: The persons's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
      required:
        - id
      additionalProperties: false
    DropdownReference:
      title: DropdownReference
      type: object
      properties:
        dropdownOptionId:
          description: Dropdown item's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
      required:
        - dropdownOptionId
      additionalProperties: false
    RankedDropdownReference:
      title: RankedDropdownReference
      type: object
      properties:
        dropdownOptionId:
          description: Ranked Dropdown item's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
      required:
        - dropdownOptionId
      additionalProperties: false
    RelativeDates:
      title: RelativeDates
      type: object
      properties:
        amount:
          description: >-
            The number of units for the relative date window. Provide one value
            (e.g. `[30]` means 30 days). For a range, provide two values where
            the first is the start offset and the second is the end offset from
            today (e.g. `[7, 30]` means between 7 and 30 days ago).
          type: array
          items:
            type: integer
            format: int32
            minimum: 0
            maximum: 2147483647
          minItems: 1
          maxItems: 2
        unit:
          description: The unit for the relative date filter
          type: string
          enum:
            - minute
            - hour
            - day
            - week
            - month
            - year
      required:
        - amount
        - unit
      additionalProperties: false
    RelativeDate:
      title: RelativeDate
      description: A single relative duration, specifying an amount and unit
      type: object
      properties:
        amount:
          description: The number of units
          type: integer
          format: int32
          minimum: 0
          maximum: 2147483647
        unit:
          description: The time unit for the duration
          type: string
          enum:
            - minute
            - hour
            - day
            - week
            - month
            - year
      required:
        - amount
        - unit
      additionalProperties: false
    LocationFilterValue:
      title: LocationFilterValue
      type: object
      properties:
        streetAddress:
          description: Street address
          type: string
        city:
          description: City
          type: string
        state:
          description: State
          type: string
        country:
          description: Country
          type: string
        continent:
          description: Continent
          type: string
      additionalProperties: false
    CompanyData:
      title: CompanyData
      type: object
      properties:
        id:
          description: The company's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        name:
          description: The company's name
          type: string
          example: Horizon Technologies
        domain:
          description: The company's primary domain
          type:
            - string
            - 'null'
          format: hostname
          example: horizontech.com
      required:
        - domain
        - id
        - name
      additionalProperties: false
    Dropdown:
      title: Dropdown
      type: object
      properties:
        dropdownOptionId:
          description: Dropdown item's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        text:
          description: Dropdown item text
          type: string
          example: first
      required:
        - dropdownOptionId
        - text
      additionalProperties: false
    FormulaNumber:
      title: FormulaNumber
      type: object
      properties:
        calculatedValue:
          description: Calculated value
          type:
            - number
            - 'null'
      additionalProperties: false
    Interaction:
      title: Interaction
      oneOf:
        - $ref: '#/components/schemas/ChatMessage'
        - $ref: '#/components/schemas/Email'
        - $ref: '#/components/schemas/Meeting'
        - $ref: '#/components/schemas/PhoneCall'
      discriminator:
        propertyName: type
        mapping:
          chat-message:
            $ref: '#/components/schemas/ChatMessage'
          email:
            $ref: '#/components/schemas/Email'
          meeting:
            $ref: '#/components/schemas/Meeting'
          call:
            $ref: '#/components/schemas/PhoneCall'
    Location:
      title: Location
      type: object
      properties:
        streetAddress:
          description: Street address
          type:
            - string
            - 'null'
          example: 1 Main Street
        city:
          description: City
          type:
            - string
            - 'null'
          example: San Francisco
        state:
          description: State
          type:
            - string
            - 'null'
          example: California
        country:
          description: Country
          type:
            - string
            - 'null'
          example: United States
        continent:
          description: Continent
          type:
            - string
            - 'null'
          example: North America
      required:
        - city
        - continent
        - country
        - state
        - streetAddress
      additionalProperties: false
    PersonData:
      title: PersonData
      type: object
      properties:
        id:
          description: The persons's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        firstName:
          description: The person's first name
          type:
            - string
            - 'null'
          example: Jane
        lastName:
          description: The person's last name
          type:
            - string
            - 'null'
          example: Doe
        primaryEmailAddress:
          description: The person's primary email address
          type:
            - string
            - 'null'
          format: email
          example: jane.smith@northpointvc.com
        type:
          description: >-
            The person's type. `internal` - people who are users within your
            Affinity instance. `collaborator` - individuals outside of your
            company who have read-only access to specified Affinity list views
            and stay updated on your firm's activities. `external` - people who
            are not internal nor collaborators.
          type: string
          enum:
            - internal
            - collaborator
            - external
          example: internal
      required:
        - firstName
        - id
        - lastName
        - primaryEmailAddress
        - type
      additionalProperties: false
    RankedDropdown:
      title: RankedDropdown
      type: object
      properties:
        dropdownOptionId:
          description: Dropdown item's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        text:
          description: Dropdown item text
          type: string
          example: first
        rank:
          description: Dropdown item rank
          type: integer
          format: int64
          minimum: 0
          maximum: 9007199254740991
          example: 0
        color:
          description: Dropdown item color
          type:
            - string
            - 'null'
          example: white
      required:
        - color
        - dropdownOptionId
        - rank
        - text
      additionalProperties: false
    ChatMessage:
      title: ChatMessage
      type: object
      properties:
        type:
          description: The type of interaction
          type: string
          const: chat-message
          example: chat-message
        id:
          description: The chat message's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        direction:
          description: The direction of the chat message
          type: string
          enum:
            - received
            - sent
          example: sent
        sentAt:
          description: The time the chat message was sent
          type: string
          format: date-time
          example: '2023-01-01T00:00:00Z'
        manualCreator:
          $ref: '#/components/schemas/PersonData'
        participants:
          description: The participants of the chat
          type: array
          items:
            $ref: '#/components/schemas/PersonData'
      required:
        - direction
        - id
        - manualCreator
        - participants
        - sentAt
        - type
      additionalProperties: false
      example:
        type: chat-message
        id: 1
        direction: sent
        sentAt: '2023-01-01T00:00:00Z'
        manualCreator:
          id: 1
          firstName: Alex
          lastName: Rivera
          primaryEmailAddress: alex.rivera@horizontech.com
          type: internal
        participants:
          - id: 2
            firstName: Jordan
            lastName: Lee
            primaryEmailAddress: jordan.lee@crestwoodcap.com
            type: external
    Email:
      title: Email
      type: object
      properties:
        type:
          description: The type of interaction
          type: string
          const: email
          example: email
        id:
          description: The email's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        subject:
          description: The subject of the email
          type:
            - string
            - 'null'
          example: Horizon Technologies Upsell $10k
        sentAt:
          description: The time the email was sent
          type: string
          format: date-time
          example: '2023-01-01T00:00:00Z'
        from:
          $ref: '#/components/schemas/Attendee'
        to:
          description: The recipients of the email
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
        cc:
          description: The cc recipients of the email
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
      required:
        - cc
        - from
        - id
        - sentAt
        - subject
        - to
        - type
      additionalProperties: false
      example:
        type: email
        id: 1
        subject: Horizon Technologies Upsell $10k
        sentAt: '2023-01-01T00:00:00Z'
        from:
          emailAddress: alex.rivera@horizontech.com
          person:
            id: 1
            firstName: Alex
            lastName: Rivera
            primaryEmailAddress: alex.rivera@horizontech.com
            type: internal
        to:
          - emailAddress: jordan.lee@crestwoodcap.com
            person:
              id: 2
              firstName: Jordan
              lastName: Lee
              primaryEmailAddress: jordan.lee@crestwoodcap.com
              type: external
        cc: []
    Meeting:
      title: Meeting
      type: object
      properties:
        type:
          description: The type of interaction
          type: string
          const: meeting
          example: meeting
        id:
          description: The meeting's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        title:
          description: The meeting's title
          type:
            - string
            - 'null'
          example: Horizon Technologies Upsell $10k
        allDay:
          description: Whether the meeting is an all-day event
          type: boolean
          example: false
        startTime:
          description: The meeting start time
          type: string
          format: date-time
          example: '2023-02-03T04:00:00Z'
        endTime:
          description: The meeting end time
          type:
            - string
            - 'null'
          format: date-time
          example: '2023-02-03T05:00:00Z'
        attendees:
          description: People attending the meeting
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
      required:
        - allDay
        - attendees
        - endTime
        - id
        - startTime
        - title
        - type
      additionalProperties: false
      example:
        type: meeting
        id: 1
        title: Defective Products
        allDay: false
        startTime: '2020-01-02T00:00:00Z'
        endTime: '2020-01-02T01:00:00Z'
        attendees:
          - emailAddress: alex.rivera@horizontech.com
            person:
              id: 1
              firstName: Alex
              lastName: Rivera
              primaryEmailAddress: alex.rivera@horizontech.com
              type: internal
          - emailAddress: jordan.lee@crestwoodcap.com
            person:
              id: 2
              firstName: Jordan
              lastName: Lee
              primaryEmailAddress: jordan.lee@crestwoodcap.com
              type: external
    PhoneCall:
      title: PhoneCall
      type: object
      properties:
        type:
          description: The type of interaction
          type: string
          const: call
          example: call
        id:
          description: The phone call's unique identifier
          type: integer
          format: int64
          minimum: 1
          maximum: 9007199254740991
          example: 1
        startTime:
          description: The call start time
          type: string
          format: date-time
          example: '2023-02-03T04:00:00Z'
        attendees:
          description: People attending the call
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
      required:
        - attendees
        - id
        - startTime
        - type
      additionalProperties: false
      example:
        type: call
        id: 1
        startTime: '2023-02-03T04:00:00Z'
        attendees:
          - emailAddress: alex.rivera@horizontech.com
            person:
              id: 1
              firstName: Alex
              lastName: Rivera
              primaryEmailAddress: alex.rivera@horizontech.com
              type: internal
    Attendee:
      title: Attendee
      type: object
      properties:
        emailAddress:
          description: The email addresses of the attendee
          type:
            - string
            - 'null'
          format: email
          example: john.smith@contoso.com
        person:
          oneOf:
            - $ref: '#/components/schemas/PersonData'
            - type: 'null'
      required:
        - emailAddress
        - person
      additionalProperties: false
  examples:
    filter-by-dropdown:
      summary: Filter by a dropdown field value
      description: >-
        Filter companies where a dropdown field matches specific options. Use
        `GET /v2/companies/fields` to discover field IDs, valueTypes, and
        dropdown option IDs.
      value:
        filters:
          operator: and
          filters:
            - fieldId: field-4574182
              valueType: dropdown
              operator: is-any-of
              value:
                - dropdownOptionId: 1
                - dropdownOptionId: 2
    filter-and-sort:
      summary: Filter by last email date and sort
      description: >-
        Filter companies to those with a last email within the past 30 days,
        sorted by employee count. The `attributeId` is required for interaction
        fields like `last-email` — use `GET /v2/companies/fields` to confirm
        which fields require an `attributeId`.
      value:
        filters:
          operator: and
          filters:
            - fieldId: last-email
              attributeId: date-of-activity
              valueType: date
              operator: is-within-the-last
              value:
                amount:
                  - 30
                unit: day
        sorts:
          - fieldId: affinity-data-employees-current
            direction: desc
    grouped-filter:
      summary: Nested AND/OR filter group
      description: >-
        Filter companies matching a dropdown value AND (an employee count
        condition OR an is-empty condition). Filter groups can be nested to
        arbitrary depth to build complex boolean logic.
      value:
        filters:
          operator: and
          filters:
            - fieldId: field-4574182
              valueType: dropdown
              operator: is-any-of
              value:
                - dropdownOptionId: 1
            - operator: or
              filters:
                - fieldId: affinity-data-employees-current
                  valueType: number
                  operator: is-greater-than
                  value: 100
                - fieldId: affinity-data-employees-current
                  valueType: number
                  operator: is-empty
    search-with-filter:
      summary: Keyword search combined with a filter
      description: >-
        Search for companies matching the keyword "Acme" AND where a dropdown
        field is not empty. Results must satisfy both the search term and the
        filter conditions (intersection).
      value:
        search:
          term: Acme
        filters:
          operator: and
          filters:
            - fieldId: field-4574182
              valueType: dropdown
              operator: is-not-empty
  headers:
    X-Ratelimit-Limit-User:
      description: Number of requests allowed per minute for the user
      schema:
        type: integer
    X-Ratelimit-Limit-User-Remaining:
      description: Number of requests remaining for the user
      schema:
        type: integer
    X-Ratelimit-Limit-User-Reset:
      description: Time in seconds before the limit resets for the user
      schema:
        type: integer
    X-Ratelimit-Limit-Org:
      description: Number of requests allowed per month for the account
      schema:
        type: integer
    X-Ratelimit-Limit-Org-Remaining:
      description: Number of requests remaining for the account
      schema:
        type: integer
    X-Ratelimit-Limit-Org-Reset:
      description: Time in seconds before the limit resets for the account
      schema:
        type: integer
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            title: responses.400
            type: object
            properties:
              errors:
                type: array
                items:
                  oneOf:
                    - $ref: '#/components/schemas/BadRequestError'
                    - $ref: '#/components/schemas/ValidationError'
                  discriminator:
                    propertyName: code
                    mapping:
                      bad-request:
                        $ref: '#/components/schemas/BadRequestError'
                      validation:
                        $ref: '#/components/schemas/ValidationError'
            required:
              - errors
            additionalProperties: false
      headers:
        x-ratelimit-limit-user:
          $ref: '#/components/headers/X-Ratelimit-Limit-User'
        x-ratelimit-limit-user-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Remaining'
        x-ratelimit-limit-user-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Reset'
        x-ratelimit-limit-org:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org'
        x-ratelimit-limit-org-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Remaining'
        x-ratelimit-limit-org-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Reset'
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthorizationErrors'
      headers:
        x-ratelimit-limit-user:
          $ref: '#/components/headers/X-Ratelimit-Limit-User'
        x-ratelimit-limit-user-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Remaining'
        x-ratelimit-limit-user-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Reset'
        x-ratelimit-limit-org:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org'
        x-ratelimit-limit-org-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Remaining'
        x-ratelimit-limit-org-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Reset'
    default:
      description: Errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
      headers:
        x-ratelimit-limit-user:
          $ref: '#/components/headers/X-Ratelimit-Limit-User'
        x-ratelimit-limit-user-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Remaining'
        x-ratelimit-limit-user-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-User-Reset'
        x-ratelimit-limit-org:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org'
        x-ratelimit-limit-org-remaining:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Remaining'
        x-ratelimit-limit-org-reset:
          $ref: '#/components/headers/X-Ratelimit-Limit-Org-Reset'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````