Skip to content

Commit 4f52ab2

Browse files
yaniv-golangithub-actions[bot]
authored andcommitted
chore: sync Affinity API docs
1 parent 688e476 commit 4f52ab2

1 file changed

Lines changed: 72 additions & 26 deletions

File tree

docs/v1/affinity_api_docs.md

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This markdown version of the Affinity API v1 documentation was generated automat
2121
- **Direct raw access**
2222

2323
**Source:** Extracted from the live Affinity API documentation at https://api-docs.affinity.co/
24-
**Documentation Version:** This copy is based on the official documentation as it appeared on **November 06, 2025 at 16:49:04 UTC** (Last updated: 11/06/2025 16:49:04 UTC).
24+
**Documentation Version:** This copy is based on the official documentation as it appeared on **April 28, 2026 at 15:46:17 UTC** (Last updated: 04/28/2026 15:46:17 UTC).
2525
**Raw Markdown URL:** `https://raw.githubusercontent.com/yaniv-golan/affinity-api-docs/main/docs/v1/affinity_api_docs.md`
2626

2727
> **⚠️ Use at Your Own Risk**
@@ -38,7 +38,7 @@ This markdown version of the Affinity API v1 documentation was generated automat
3838

3939
## Table of Contents
4040

41-
- [Introduction](#introduction)
41+
- [Introduction to API V1](#introduction-to-api-v1)
4242
- [Getting Started](#getting-started)
4343
- [Authentication](#authentication)
4444
- [Requests & Responses](#requests--responses)
@@ -61,7 +61,6 @@ This markdown version of the Affinity API v1 documentation was generated automat
6161
- [Getting Field Value Changes for Status Fields](#getting-field-value-changes-for-status-fields)
6262
- [Getting the Strongest Relationship Strength Connection to an Organization on a List](#getting-the-strongest-relationship-strength-connection-to-an-organization-on-a-list)
6363
- [Useful Resources](#useful-resources)
64-
- [Partner With Us](#partner-with-us)
6564
- [Lists](#lists)
6665
- [The List Resource](#the-list-resource)
6766
- [List Types](#list-types)
@@ -191,9 +190,9 @@ This markdown version of the Affinity API v1 documentation was generated automat
191190
- [The Rate Limit Resource](#the-rate-limit-resource)
192191
- [Get Rate Limit Information](#get-rate-limit-information)
193192
- [Changelog](#changelog)
194-
# Introduction
193+
# Introduction to API V1
195194

196-
Welcome to the Affinity API! This API provides a RESTful interface for performing operations on the different objects that make up Affinity. If you are trying to accomplish an action through this API and are not sure on what endpoints to use, or if you have ideas on more endpoints we could create to make your workflow easier, please do not hesitate to contact us at [support@affinity.co](mailto:support@affinity.co).
195+
Welcome to the Affinity V1 API! This API provides a RESTful interface for performing operations on the different objects that make up Affinity. The latest Affinity API (v2) can be found at https://developer.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.
197196

198197
# Getting Started
199198

@@ -211,7 +210,7 @@ curl "https://api.affinity.co/api_endpoint" -u :$APIKEY
211210
curl "https://api.affinity.co/api_endpoint" -H "Authorization: Bearer ${APIKEY}"
212211
```
213212

214-
To use the API, you will need to generate an API secret key. This can be done easily through the Settings Panel that is accessible through the left sidebar on the Affinity web app. For more support, visit the [How to obtain your API Key](https://support.affinity.co/hc/en-us/articles/360032633992-How-to-obtain-your-API-Key) article in our Help Center.
213+
To use the API, you will need to generate an API secret key. This can be done easily through the Manage Apps Page in Affinity Settings. For more support, visit the [How to obtain your API Key](https://support.affinity.co/s/article/How-to-Create-and-Manage-API-Keys) article in our Help Center.
215214

216215
Requests are authenticated using one of the following:
217216

@@ -220,7 +219,9 @@ Requests are authenticated using one of the following:
220219
| [HTTP Basic Auth](http://en.wikipedia.org/wiki/Basic_access_authentication) | Provide your API key as the basic auth password. You do not need to provide a username. |
221220
| [HTTP Bearer Auth](https://swagger.io/docs/specification/v3_0/authentication/bearer-authentication/) | Provide your API key as the bearer token. |
222221

223-
Currently, we support one key per user on your team. Once you have generated a key, you will need to pass in the key with every API request for us to process it successfully. Otherwise, an error with a code of `401` will be returned.
222+
Once you have generated a key, you will need to pass in the key with every API request for us to process it successfully. Otherwise, an error with a code of `401` will be returned.
223+
224+
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.
224225

225226
#### Note
226227

@@ -240,7 +241,7 @@ Here is a list of all the error codes the Affinity API returns in case something
240241
| 403 | Forbidden -- Insufficient rights to a resource. |
241242
| 404 | Not Found -- Requested resource does not exist. |
242243
| 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. |
243-
| 429 | Too Many Requests -- You have exceed the rate limit. |
244+
| 429 | Too Many Requests -- You have exceeded the rate limit. |
244245
| 500 | Internal Server Error -- We had a problem with our server. Try again later. |
245246
| 503 | Service Unavailable -- This shouldn't generally happen. Either a deploy is in process, or Affinity services are down. |
246247

@@ -276,7 +277,7 @@ Your account plan tier will limit the overall number of requests you can make pe
276277
277278
#### Note
278279

279-
> Professional tier customers who signed up for Affinity before July 5, 2023 are alotted 40,000 calls per month.
280+
> Professional tier customers who signed up for Affinity before July 5, 2023 are allotted 40,000 calls per month.
280281
281282
This monthly account-level limit resets at the end of each calendar month.
282283

@@ -377,7 +378,7 @@ Use the common use cases below to learn how Affinity API endpoints work.
377378

378379
#### Helpful Tips
379380

380-
> - To reduce API calls, create any initial backfills with the REST API then use [Webhooks](#webhooks) to keep data synced. You may want to schedule occasional syncs via the REST API to fixed any inconsistencies
381+
> - To reduce API calls, create any initial backfills with the REST API then use [Webhooks](#webhooks) to keep data synced. You may want to schedule occasional syncs via the REST API to fix any inconsistencies
381382
> - Your instance may contain multiple fields with the same name (e.g. Last Funding Date). To confirm the field ID, manually make an edit to the field in question and inspect the request payload for the bulk request. The field ID will be listed as `entityAttributeId` ![](https://api-docs.affinity.co/images/request-payload-1136ff0a.png)
382383
> - The ID for a list, person, organization and opportunity can be found via the URL in the CRM. For a list `affinity.affinity.co/lists/[list_id]` and for a company profile `affinity.affinity.co/companies/[company_id]`
383384
> - For large lists, use `page_size` and `page_token` parameters in the [`GET /lists/list_id}/list-entries`](#get-all-list-entries) endpoint to improve performance
@@ -701,10 +702,6 @@ GET /relationships-strengths Response:
701702
- [Affinity Zapier Integrations](https://zapier.com/apps/affinity/integrations)
702703
- [Affinity Tray Connectors](https://tray.io/documentation/connectors/service/affinity)
703704

704-
# Partner With Us
705-
706-
If you're a developer interested in building an integration with Affinity's relationship intelligence platform for your customers, please [get in touch here](https://53mt2d9of77.typeform.com/to/LhEs2tzU).
707-
708705
# Lists
709706

710707
Lists are the primary data structure that you can interact with in Affinity. Each list manages a collection of either people, organizations or opportunities. We call people, organizations and opportunities "entities".
@@ -1823,7 +1820,7 @@ The action type specified below corresponds to the `action_type` of a field valu
18231820
"primary_email": "jane@gmail.com",
18241821
"emails": ["jane@gmail.com"]
18251822
},
1826-
"changed_at": "2020-04-11T15:46:50.963-07:00",
1823+
"changed_at": "2020-04-11T22:46:50.963241Z",
18271824
"value": {
18281825
"id": 1607859,
18291826
"text": "New",
@@ -1836,28 +1833,34 @@ The action type specified below corresponds to the `action_type` of a field valu
18361833

18371834
`GET /field-value-changes`
18381835

1839-
Returns all field values changes attached to a specific field. Field value changes can be filtered by `action_type`, `person`, `organization`, `opportunity` or `list_entry` by passing in the appropriate parameter.
1836+
Returns all field values changes attached to a specific field. Field value changes can be filtered by `action_type`, `person`, `organization`, `opportunity`, `list_entry`, `changed_after`, `order_by`, `after_id`, and `limit` by passing in the appropriate parameter.
18401837

18411838
### Query Parameters
18421839

18431840
| Parameter | Type | Required | Description |
18441841
| --- | --- | --- | --- |
18451842
| field_id | integer | true | A unique ID that represents a field object whose field values changes are to be retrieved. |
18461843
| action_type | integer | false | An integer that filters field value changes that were created with this specific action type (see above). |
1847-
| person_id | integer | custom* | A unique ID that represents a person object whose field value changes are to be retrieved. |
1848-
| organization_id | integer | custom* | A unique ID that represents an organization object whose field value changes are to be retrieved. |
1849-
| opportunity_id | integer | custom* | A unique ID that represents an opportunity object whose field value changes are to be retrieved. |
1850-
| list_entry_id | integer | custom* | A unique ID that represents a list entry object whose field value changes are to be retrieved. |
1844+
| person_id | integer | false | A unique ID that represents a person object whose field value changes are to be retrieved. |
1845+
| organization_id | integer | false | A unique ID that represents an organization object whose field value changes are to be retrieved. |
1846+
| opportunity_id | integer | false | A unique ID that represents an opportunity object whose field value changes are to be retrieved. |
1847+
| list_entry_id | integer | false | A unique ID that represents a list entry object whose field value changes are to be retrieved. |
1848+
| changed_after | datetime | false | A UTC timestamp that filters field value changes with a `changed_at` greater than or equal to the given value. Non-UTC offsets are accepted and converted to UTC. |
1849+
| order_by | string | false | Sort order for results. Accepted values: `asc` (oldest first) or `desc` (newest first). Defaults to `desc`. |
1850+
| after_id | integer | false | A cursor for keyset pagination. When provided, returns only records that come after the record with this ID in the current sort order. Requires both `changed_after` and `order_by=asc`. Returns a 422 if either is missing. |
1851+
| limit | integer | false | An integer number that restricts the field value changes being returned. |
18511852

18521853
#### Returns
18531854

18541855
An array of all the field values changes associated with the supplied field and `person`, `organization`, `opportunity` or `list_entry` if specified.
18551856

18561857
#### Notes
18571858

1858-
> - Exactly one of `person_id`, `organization_id`, `opportunity_id`, or `list_entry_id` must be specified to the endpoint.
1859-
> - If a `person_id`, `organization_id`, or `opportunity_id` is specified, the endpoint returns all field value changes tied to these entities.
1859+
> - Results are sorted by `changed_at` with `id` as a tiebreaker for deterministic ordering. The default sort order is `desc` (newest first). Use `order_by=asc` to sort oldest first, which is required for forward pagination.
1860+
> - The response may be filtered by providing at most one of the following parameters: `person_id`, `organization_id`, `opportunity_id`, or `list_entry_id`. If none are specified, the response encompasses all data for the given `field_id` across the organization. For fields with high volumes of data, organization-wide queries may be subject to timeouts; in these cases, the use of the `changed_after` and `limit` parameters is recommended.
1861+
> - If a `person_id`, `organization_id`, or `opportunity_id` is specified, the endpoint returns all field value changes for the provided `field_id` tied to these entities.
18601862
> - If a `list_entry_id` is specified, the result is filtered by the `person_id`, `organization_id` or `opportunity_id` which is tied to the specified `list_entry_id`.
1863+
> - To paginate through all changes since a given date, use `order_by=asc` and on each subsequent request set `changed_after` to the `changed_at` of the last record and `after_id` to its `id`. Repeat until the response is empty. The `changed_at` field in responses uses microsecond precision to ensure it can be used directly as an exact cursor.
18611864
18621865
#### Example Request
18631866

@@ -1883,7 +1886,7 @@ curl "https://api.affinity.co/field-value-changes?field_id=236333" -u :$APIKEY
18831886
"primary_email": "jane@gmail.com",
18841887
"emails": ["jane@gmail.com"]
18851888
},
1886-
"changed_at": "2020-04-11T15:46:50.963-07:00",
1889+
"changed_at": "2020-04-11T22:46:50.963241Z",
18871890
"value": {
18881891
"id": 1607859,
18891892
"text": "New",
@@ -1919,13 +1922,13 @@ Dates of the most recent and upcoming interactions with a person are available i
19191922
| first_name | string | The first name of the person. |
19201923
| last_name | string | The last name of the person. |
19211924
| emails | string[] | The email addresses of the person. |
1922-
| primary_email | string | The email (automatically computed) that is most likely to the current active email address of the person. |
1925+
| primary_email | string | The email (automatically computed) that is most likely to be the current active email address of the person. |
19231926
| organization_ids | integer[] | An array of unique identifiers of organizations that the person is associated with. |
19241927
| opportunity_ids | integer[] | An array of unique identifiers of opportunities that the person is associated with. Only returned when `with_opportunities=true`. |
19251928
| current_organization_ids | integer[] | An array of unique identifiers of organizations that the person is currently associated with according to the Affinity Data: Current Organization in-app column. Only returned when `with_current_organizations=true`. |
19261929
| | | |
19271930
| list_entries | ListEntry[] | An array of list entry resources associated with the person, only returned as part of the [Get a Specific Person](#get-a-specific-person) endpoint. |
1928-
| interaction_dates | object | An object with seven string date fields representing the most recent and upcoming interactions with this person: `first_email_date`, `last_email_date`, `last_event_date`, `last_chat_message_date`, `last_interacton_date`, `first_event_date` and `next_event_date`. Only returned when passing `with_interaction_dates=true`. |
1931+
| interaction_dates | object | An object with seven string date fields representing the most recent and upcoming interactions with this person: `first_email_date`, `last_email_date`, `last_event_date`, `last_chat_message_date`, `last_interaction_date`, `first_event_date` and `next_event_date`. Only returned when passing `with_interaction_dates=true`. |
19291932
| interactions | object | An object with seven fields nested underneath. Each field corresponds to one of the seven interactions, and includes nested fields for `date` and `person_ids` which indicates the internal people associated with that event. Only returned when passing `with_interaction_dates=true`. |
19301933

19311934
### Person types
@@ -2388,7 +2391,7 @@ Dates of the most recent and upcoming interactions with an organization are avai
23882391
| opportunity_ids | integer[] | An array of unique identifiers of opportunities that are associated with the organization |
23892392
| global | boolean | Returns whether this organization is a part of Affinity's global dataset of organizations. This is always false if the organization was created by you. |
23902393
| list_entries | ListEntry[] | An array of list entry resources associated with the organization, only returned as part of the [Get a specific organization](#get-a-specific-organization) endpoint. |
2391-
| interaction_dates | object | An object with seven string date fields representing the most recent and upcoming interactions with this organization: `first_email_date`, `last_email_date`, `last_event_date`, `last_chat_message_date`, `last_interacton_date`, `first_event_date`, and `next_event_date`. Only returned when passing `with_interaction_dates=true`. |
2394+
| interaction_dates | object | An object with seven string date fields representing the most recent and upcoming interactions with this organization: `first_email_date`, `last_email_date`, `last_event_date`, `last_chat_message_date`, `last_interaction_date`, `first_event_date`, and `next_event_date`. Only returned when passing `with_interaction_dates=true`. |
23922395
| interactions | object | An object with seven fields nested underneath. Each field corresponds to one of the seven interactions, and includes nested fields for `date` and `person_ids` which indicates the internal people associated with that event (people only returned if passing `with_interaction_persons=true`). Only returned when passing `with_interaction_dates=true`. |
23932396

23942397
#### Example Response
@@ -5243,6 +5246,49 @@ curl "https://api.affinity.co/rate-limit" -u :$API_KEY
52435246
```
52445247
# Changelog
52455248

5249+
**2026-04-27**
5250+
5251+
- Added two new query parameters to
5252+
`GET /field-value-changes`
5253+
to support keyset pagination:
5254+
- `order_by`
5255+
(string): Specifies sort order for results. Accepted values:
5256+
`asc`
5257+
(oldest first) or
5258+
`desc`
5259+
(newest first). Defaults to
5260+
`desc`
5261+
.
5262+
- `after_id`
5263+
(integer): A cursor for keyset pagination. When provided along with
5264+
`changed_after`
5265+
and
5266+
`order_by=asc`
5267+
, returns records after the record with the given ID. Returns a 422 if
5268+
`changed_after`
5269+
or
5270+
`order_by=asc`
5271+
is not also specified.
5272+
- Results are now sorted deterministically by
5273+
`(changed_at, id)`
5274+
, using
5275+
`id`
5276+
as a tiebreaker to ensure stable pagination across records with identical timestamps.
5277+
- The
5278+
`changed_at`
5279+
field in responses now uses microsecond precision (e.g.
5280+
`2024-01-03T08:00:00.000000Z`
5281+
), allowing it to be used directly as an exact pagination cursor.
5282+
- The
5283+
`changed_after`
5284+
parameter now normalizes non-UTC timestamps to UTC before filtering.
5285+
5286+
**2026-03-13**
5287+
5288+
- Added two new query parameters to GET /field-value-changes:
5289+
- changed_after (datetime): When provided, only field value changes with a changed_at timestamp greater than or equal to the given value are returned.
5290+
- limit (integer, min: 1): Restricts the number of field value changes returned.
5291+
52465292
**2025-11-05**
52475293

52485294
- Added support for bearer authentication

0 commit comments

Comments
 (0)