### Get All List Entries Example Response Source: https://api-docs.affinity.co/ This is an example of the response when fetching all list entries for a list. It returns an array of list entry objects. ```json [ { "id": 64608, "list_id": 450, "creator_id": 287843, "entity_id": 62034, "created_at": "2017-05-04T10:44:31.525-08:00", "entity": { "type": 0, "first_name": "Affinity", "last_name": "Team", "primary_email": "team@affinity.co", "emails": [ "team@affinity.co" ] } }, { "id": 53510, "list_id": 450, "creator_id": 38596, "entity_id": 241576, "created_at": "2017-02-22T15:22:21.125-08:00", "entity": { "type": 0, "first_name": "John", "last_name": "Doe", "primary_email": "jdoe@stanford.edu", "emails": [ "jdoe@stanford.edu" ] } }, ... ] ``` -------------------------------- ### Authentication Examples Source: https://api-docs.affinity.co/ Examples of how to authenticate API requests using HTTP Basic Auth or HTTP Bearer Auth. ```APIDOC ## Authentication ### HTTP Basic Auth ```bash curl "https://api.affinity.co/api_endpoint" -u :$APIKEY ``` ### HTTP Bearer Auth ```bash curl "https://api.affinity.co/api_endpoint" -H "Authorization: Bearer ${APIKEY}" ``` Requests are authenticated using one of the following: Authentication Type | Details ---|--- HTTP Basic Auth | Provide your API key as the basic auth password. You do not need to provide a username. HTTP Bearer Auth | Provide your API key as the bearer token. ``` -------------------------------- ### Example Response for Note Creation Source: https://api-docs.affinity.co/ This is an example of the response received after successfully creating a note. It includes the note's ID and associated metadata. ```json { "id": 22985, "creator_id": 860197, "person_ids": [38708, 24809, 89203, 97304], "associated_person_ids": [38708, 24809], "interaction_person_ids": [89203, 97304], "interaction_id": 114, "interaction_type": 0, "is_meeting": true, "mentioned_person_ids": [], "organization_ids": [64779194], "opportunity_ids": [117], "parent_id": null, "content": "Had a lunch meeting with Jane ... ", "type": 0, "created_at": "2017-03-28T00:38:41.275-08:00", "updated_at": null } ``` -------------------------------- ### Example Fields List Response Source: https://api-docs.affinity.co/ This is an example of the response when fetching a list of fields. It shows multiple field objects, each with their respective properties. ```json [ { "id": 1234, "name": "[Deals] Amount", "list_id": 11, "enrichment_source": "none", "value_type": 3, "allows_multiple": false, "track_changes": true, "dropdown_options": [] }, { "id": 5678, "name": "[Events] Amount", "list_id": 16, "enrichment_source": "none", "value_type": 3, "allows_multiple": false, "track_changes": true, "dropdown_options": [] }, { "id": 4321, "name": "[Companies] Description", "list_id": 18, "enrichment_source": "dealroom", "value_type": 6, "allows_multiple": false, "track_changes": false, "dropdown_options": [] }, ... ] ``` -------------------------------- ### Get All List Entries Example Response with Pagination Source: https://api-docs.affinity.co/ When a `page_size` is specified, the API returns a paginated response containing a list of entries and a token for the next page. Use the `page_token` in subsequent requests to fetch more results. ```json { "list_entries": [ { "id": 64608, "list_id": 450, "creator_id": 287843, "entity_id": 62034, "created_at": "2017-05-04T10:44:31.526-08:00", "entity": { "type": 0, "first_name": "Affinity", "last_name": "Team", "primary_email": "team@affinity.co", "emails": [ "team@affinity.co" ] } }, { "id": 53510, "list_id": 450, "creator_id": 38596, "entity_id": 241576, "created_at": "2017-02-22T15:22:21.125-08:00", "entity": { "type": 0, "first_name": "John", "last_name": "Doe", "primary_email": "jdoe@stanford.edu", "emails": [ "jdoe@stanford.edu" ] } }, ... ], "next_page_token": "eyJwYXJhbXMiOnsidGVybSI6IiJ9LCJwYWdlX3NpemUiOjUsIm9mZnNldCI6MTB9" } ``` -------------------------------- ### Get All Notes Response Source: https://api-docs.affinity.co/ Example JSON response for retrieving all notes. Includes details like ID, creator, associated people, and content. ```json [ { "id": 22984, "creator_id": 860197, "person_ids": [38706,89734], "is_meeting": false, "mentioned_person_ids": [49817, 78624], "organization_ids": [64779194], "opportunity_ids": [117], "parent_id": null, "content": "Had a lunch meeting with Jane ... ", "type": 0, "created_at": "2017-03-28T00:38:41.275-08:00", "updated_at": "2017-04-03T00:22:25.612-08:00" }, { "id": 22983, "creator_id": 860196, "person_ids": [], "is_meeting": false, "mentioned_person_ids": [7237], "organization_ids": [64779194], "opportunity_ids": [115], "parent_id": null, "content": "Had a **lunch meeting** @ Google ... ", "type": 2, "created_at": "2017-03-28T00:38:41.275-08:00", "updated_at": null }, ... ] ``` -------------------------------- ### Example Webhook Event Response Source: https://api-docs.affinity.co/ This is an example of a JSON payload received when a 'list_entry.created' webhook event is triggered. ```json { "type": "list_entry.created", "body": { "id": 388, "list_id": 26, "creator_id": 38603, "entity_id": 38706, "entity_type": 0, "created_at": "2021-09-08T09:55:50.321-07:00", "entity": { "id": 70796737, "type": 0, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": ["john@affinity.co"] } }, "sent_at": 1631120151 } ``` -------------------------------- ### List Resource Example Response Source: https://api-docs.affinity.co/ An example response structure for the List resource, detailing its attributes such as ID, type, name, and ownership. ```json { "id": 450, "type": 0, "name": "My List of People", "public": true, "owner_id": 38706, "creator_id": 38901, "list_size": 67, "additional_permissions": [ { "internal_person_id": 38706, "role_id": 0 } ] } ``` -------------------------------- ### Example Response for Get All Reminders Source: https://api-docs.affinity.co/ This JSON structure represents a successful response when fetching multiple reminders, including details for each reminder and a token for pagination. ```json { "reminders": [ { "id": 15562, "type": 1, "created_at": "2021-11-22T09:31:52.415-08:00", "completed_at": null, "content": "Recurring reminder", "due_date": "2021-12-22T09:31:52.415-08:00", "reset_type": 0, "reminder_days": 30, "status": 2, "creator": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "owner": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "completer": null, "person": null, "organization": { "id": 4904, "name": "organization", "domain": null, "domains": [], "crunchbase_uuid": null, "global": false }, "opportunity": null }, { "id": 15326, "type": 1, "created_at": "2021-11-18T14:34:53.218-08:00", "completed_at": null, "content": "Reply email to Alice", "due_date": "2021-12-18T14:34:53.217-08:00", "reset_type": 1, "reminder_days": 30, "status": 2, "creator": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "owner": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "completer": null, "person": { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": [ "yen@alice.com" ] }, "organization": null, "opportunity": null } ], "next_page_token": "eyJwYXJhbXMiOnsiY29tcGxldGVyX2lkIjpudWxsLCJvd25lcl9pZCI6bnVsbCwiY3JlYXRvcl9" } ``` -------------------------------- ### Entity File Resource Example Source: https://api-docs.affinity.co/ This is an example response structure for an entity file resource, showing its attributes like ID, name, size, and associated entity IDs. ```json { "id": 43212, "name": "JohnDoeFriends.csv", "size": 993, "person_id": 10, "organization_id": null, "opportunity_id": null, "created_at": "2011-01-25T09:59:35.288-08:00", "uploader_id": 10 } ``` -------------------------------- ### Example Get Field Values Response Source: https://api-docs.affinity.co/ This JSON array shows a sample response from the GET /field-values endpoint. It includes various field value objects, each with an ID, associated field and entity IDs, and a 'value' attribute. ```json [ { "id": 250616, "field_id": 337, "list_entry_id": null, "entity_id": 38706, "created_at": "2021-10-04T08:54:24.694-04:00", "updated_at": "2022-03-04T08:54:24.694-04:00", "value": { "city": "San Francisco", "state": "California", "country": "United States", "continent": null, "street_address": null } }, { "id": 2634897436, "field_id": 768101, "list_entry_id": null, "entity_type": 0, "value_type": 2, "entity_id": 65680071, "created_at": "2022-10-04T08:54:24.694-04:00", "updated_at": null, "value": "Software Engineer" }, { "id": 32760, "field_id": 198, "list_entry_id": null, "entity_id": 38706, "created_at": "2022-09-04T08:54:24.694-04:00", "updated_at": null, "value": 38659 }, ... ] ``` -------------------------------- ### Get All Notes Request Source: https://api-docs.affinity.co/ Example cURL request to retrieve all notes. Requires an API key for authentication. ```curl curl "https://api.affinity.co/notes" -u :$APIKEY ``` -------------------------------- ### Example Person Resource Response Source: https://api-docs.affinity.co/ This JSON object shows an example response for a Person resource. It includes basic information, email addresses, associated organization and opportunity IDs, list entries, and detailed interaction dates and summaries. ```json { "id": 38706, "type": 0, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co", "jdoe@alumni.stanford.edu", "johnjdoe@gmail.com", ], "organization_ids": [ 1687449, ... ], "opportunity_ids": [ 4, 11, ... ], "current_organization_ids": [1687449], "list_entries": [ { "id": 388, "list_id": 26, "creator_id": 38603, "entity_id": 38706, "created_at": "2015-12-11T02:26:56.537-08:00", }, ... ], "interaction_dates": { "first_email_date": "2011-11-23T08:12:45.328-08:00", "last_email_date": "2012-03-04T05:06:07.890-08:00", "last_event_date": "2011-12-11T02:26:56.537-08:00", "last_chat_message_date": "2011-11-01T02:26:56.537-08:00", "last_interaction_date": "2012-03-04T05:06:07.890-08:00", "next_event_date": "2019-03-04T05:06:07.890-08:00", "first_event_date": "2012-01-01T08:18:00.329-08:00", }, "interactions": { "first_email": { "date": "2011-11-23T08:12:45.328-08:00", "person_ids": [ 123 ] }, "last_email": { "date": "2012-03-04T05:06:07.890-08:00", "person_ids": [ 123 ] }, "last_event": { "date": "2011-12-11T02:26:56.537-08:00", "person_ids": [ 123 ] }, "last_chat_message": { "date": "2011-11-01T02:26:56.537-08:00", "person_ids": [ 123 ] }, "last_interaction": { "date": "2012-03-04T05:06:07.890-08:00", "person_ids": [ 123, 111 ] }, "next_event": { "date": "2019-03-04T05:06:07.890-08:00", "person_ids": [ 123, 124, 125 ] }, "first_event": { "date": "2012-01-01T08:18:00.329-08:00", "person_ids": [ 123 ] } } } ``` -------------------------------- ### Example Get Field Value Changes Response Source: https://api-docs.affinity.co/ This is an example of the array response when retrieving field value changes for a specific field. It contains one or more field value change objects. ```json [ { "id": 50822718, "field_id": 236333, "entity_id": 261131046, "list_entry_id": 15709964, "action_type": 0, "changer": { "id": 38706, "type": 0, "first_name": "Jane", "last_name": "Doe", "primary_email": "jane@gmail.com", "emails": ["jane@gmail.com"] }, "changed_at": "2020-04-11T22:46:50.963241Z", "value": { "id": 1607859, "text": "New", "rank": 1, "color": 0 } } ] ``` -------------------------------- ### List Entry Resource Example Response Source: https://api-docs.affinity.co/ This is an example of a single list entry object returned by the API. It includes details about the entry's ID, associated list, creator, the entity it represents, and creation timestamp. ```json { "id": 16367, "list_id": 450, "creator_id": 38706, "entity_id": 287125, "entity": { "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "jdoe@jdoe.com", "emails": ["jdoe@jdoe.com", "jdoe2@jdoe2.com"] }, "created_at": "2017-01-16T16:34:03.539-08:00" } ``` -------------------------------- ### Reminder Response Example Source: https://api-docs.affinity.co/ This is an example of a successful response when retrieving a reminder object. It includes details about the reminder's content, due date, creator, and any associated person, organization, or opportunity. ```json { "id": 15326, "type": 1, "created_at": "2021-11-18T14:34:53.218-08:00", "completed_at": null, "content": "Reply email to Alice", "due_date": "2021-12-18T14:34:53.217-08:00", "reset_type": 1, "reminder_days": 30, "status": 2, "creator": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "owner": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, "completer": null, "person": { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": [ "yen@alice.com" ] }, "organization": null, "opportunity": null } ``` -------------------------------- ### Webhook Subscription Object Example Source: https://api-docs.affinity.co/ This is an example of a webhook subscription object, which defines the events that will trigger notifications and the URL to send them to. An empty `subscriptions` array means all events are subscribed. ```json { "id": 1234, "webhook_url": "https://hooks.example.com/webhook", "subscriptions": [ "list.created", "person.created", "organization.created", "opportunity.created" ], "disabled": false, "created_by": 5678 } ``` -------------------------------- ### Meeting/Call Interaction Resource Example Source: https://api-docs.affinity.co/ This JSON object represents a manually logged meeting or call interaction. It includes details like date, attendees, start and end times, creator, title, type, and associated persons. ```json { "date": "2022-02-22T11:15:29.758-08:00", "id": 3007, "attendees": [ "john@affinity.co", "yen@alice.com" ], "start_time": "2022-02-22T11:15:29.758-08:00", "end_time": null, "updated_at": null, "manual_creator_id": 2, "title": "Manually logged event", "type": 0, "notes": [ 7 ], "persons": [ { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": [ "yen@alice.com" ] } ] } ``` -------------------------------- ### Interactions Resource Source: https://api-docs.affinity.co/ Provides examples of interaction resources, including meeting/call and chat message types. ```APIDOC # Interactions The interactions API allows you to manage interactions. ## The Interactions Resource Different types of interactions have different interaction resources. Note the combination of ID and type for an interaction is unique. ### Example Response (Meeting/Call type) ```json { "date": "2022-02-22T11:15:29.758-08:00", "id": 3007, "attendees": [ "john@affinity.co", "yen@alice.com" ], "start_time": "2022-02-22T11:15:29.758-08:00", "end_time": null, "updated_at": null, "manual_creator_id": 2, "title": "Manually logged event", "type": 0, "notes": [ 7 ], "persons": [ { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": [ "yen@alice.com" ] } ] } ``` ### Example Response (Chat message type) ```json { "id": 7267, "date": "2022-02-22T11:50:20.126-08:00", "direction": 0, "manual_creator_id": 443, "persons": [ { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": [ "john@affinity.co" ] }, { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": [ "yen@alice.com" ] } ], "type": 2, "notes": [ 7462534 ] } ``` ``` -------------------------------- ### Create an HTML-Type Note (Form) Source: https://api-docs.affinity.co/ This example demonstrates creating an HTML-formatted note using form data. The `type` parameter must be set to 2, and HTML content should be included in the `content` field. ```bash curl -X POST "https://api.affinity.co/notes" \ -u :$APIKEY \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "person_ids[]=38706&person_ids[]=624289&organization_ids[]=120611418&opportunity_ids[]=167&type=2&content=Had a lunch meeting with Jane and John today. They want to invest in Acme Corp." ``` -------------------------------- ### Get Specific Note Request Source: https://api-docs.affinity.co/ Example cURL request to retrieve a single note by its ID. Replace '{note_id}' with the actual note ID. ```curl # Returns the note with the specified `note_id` curl "https://api.affinity.co/notes/22984" -u :$APIKEY ``` -------------------------------- ### Example Response for Creating a Webhook Subscription Source: https://api-docs.affinity.co/ This JSON object represents the newly created webhook subscription, confirming the provided URL and initial settings. ```json { "id": 1234, "webhook_url": "https://hooks.example.com/webhook", "subscriptions": [], "disabled": false, "created_by": 5678 } ``` -------------------------------- ### Create a New Note (Form) Source: https://api-docs.affinity.co/ This example shows how to create a new note using form-urlencoded data. Ensure correct formatting for array parameters like `person_ids`. ```bash curl -X POST "https://api.affinity.co/notes" \ -u :$APIKEY \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "person_ids[]=38706&person_ids[]=624289&organization_ids[]=120611418&opportunity_ids[]=167&content=Had a lunch meeting with Jane and John today. They want to invest in Acme Corp." ``` -------------------------------- ### Get Specific Note Response Source: https://api-docs.affinity.co/ Example JSON response for retrieving a specific note. Includes detailed fields such as associated people, interaction details, and content. ```json { "id": 22984, "creator_id": 860197, "person_ids": [38708, 24809, 89203, 97304], "associated_person_ids": [38708, 24809], "interaction_person_ids": [89203, 97304], "interaction_id": 114, "interaction_type": 0, "is_meeting": true, "mentioned_person_ids": [49817, 78624], "organization_ids": [64779194], "opportunity_ids": [117], "parent_id": null, "content": "Had a lunch meeting with Jane ... ", "type": 0, "created_at": "2017-03-28T00:38:41.275-08:00", "updated_at": "2017-04-03T00:22:25.612-08:00", } ``` -------------------------------- ### Get All Lists - Postman Request Source: https://api-docs.affinity.co/postman/collection.json Retrieves all lists associated with the authenticated user. Uses a GET request to the /lists endpoint. ```json { "collection": { "info": { "_postman_id": "672ad1d0-5bc6-48d5-8ec0-185d0d3ca43d", "name": "Affinity Documentation Collection", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "updatedAt": "2023-03-22T21:15:25.000Z" }, "item": [ { "name": "Lists", "item": [ { "name": "Get all lists", "id": "5108870a-c35d-43a4-b6b5-78ed53a9acff", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/lists", "host": [ "{{BASE_URL}}" ], "path": [ "lists" ] } }, "response": [] } ``` -------------------------------- ### Format Content as HTML Source: https://api-docs.affinity.co/ Example of content payload formatted as HTML, demonstrating basic text, bold, and colored text. ```html

This is normal text. But this is bold! And this is red!

``` -------------------------------- ### Example Opportunity Resource Response Source: https://api-docs.affinity.co/ Shows the structure of an opportunity object, including its ID, name, associated person and organization IDs, and list entry details. ```json { "id": 117, "name": "Affinity Opportunity", "person_ids": [38706], "organization_ids": [21442], "list_entries": [ { "id": 442313, "creator_id": 38706, "list_id": 4974, "entity_id": 117, "entity_type": 8, "created_at": "2018-03-03T23:02:46.412-08:00" } ] } ``` -------------------------------- ### Example Note Resource Response Source: https://api-docs.affinity.co/ Demonstrates the structure of a note object returned by the API. This includes content, creator, associated people, organizations, and timestamps. ```json { "id": 22984, "creator_id": 860197, "person_ids": [38708, 24809, 89203, 97304], "associated_person_ids": [38708, 24809], "interaction_person_ids": [89203, 97304], "interaction_id": 114, "interaction_type": 0, "is_meeting": true, "mentioned_person_ids": [49817, 78624], "organization_ids": [64779194], "opportunity_ids": [117], "parent_id": null, "content": "Had a lunch meeting with Jane and John today. They are looking to invest.", "type": 0, "created_at": "2017-03-28T00:38:41.275-08:00", "updated_at": "2017-04-03T00:22:25.612-08:00" } ``` -------------------------------- ### Get All Lists Source: https://api-docs.affinity.co/ Query the /lists endpoint to retrieve all lists. This is often the first step to get a list ID for subsequent operations. ```json GET /lists Response: [ { "id": 12058, "type": 0, "name": "Current Prospects", "public": true, "owner_id": 477400, "list_size": 150 } ... ] ``` -------------------------------- ### Get Specific List - Postman Request Source: https://api-docs.affinity.co/postman/collection.json Retrieves a single list by its ID. Uses a GET request to the /lists/:list_id endpoint. ```json { "name": "Get a specific list", "id": "6b29a03b-b58e-4040-8cde-f2ad0aed3496", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/lists/{{default_list_id}}", "host": [ "{{BASE_URL}}" ], "path": [ "lists", "{{default_list_id}}" ] } }, "response": [] } ``` -------------------------------- ### Create a New Note (JSON) Source: https://api-docs.affinity.co/ Use this endpoint to create a new note. Provide associated person, organization, or opportunity IDs along with the note content. ```bash curl -X POST "https://api.affinity.co/notes" \ -u :$APIKEY \ -H "Content-Type: application/json" \ -d '{"person_ids": [38706, 624289], "organization_ids": [120611418], "opportunity_ids": [167], "content": "Had a lunch meeting with Jane and John today. They want to invest in Acme Corp."}' ``` -------------------------------- ### Example Email Interaction Response Source: https://api-docs.affinity.co/ This is an example of a successful response when fetching email interactions. It includes details about the sender, recipients, subject, and timestamps. ```json { "emails": [ { "date": "2021-02-04T09:43:39.717-08:00", "id": 417, "subject": "John <-> Alice", "type": 3, "from": { "id": 443, "type": 1, "first_name": "John", "last_name": "Doe", "primary_email": "john@affinity.co", "emails": ["john@affinity.co"] }, "to": [ { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": ["yen@alice.com"] } ], "cc": [], "direction": 0 }, { "date": "2021-02-02T12:55:19.801-08:00", "id": 265, "subject": "Alfred <-> Alice", "type": 3, "from": { "id": 1012, "type": 1, "first_name": "Alfred", "last_name": "Hickey", "primary_email": "alfredhickeyshmcneax@affinity.co", "emails": ["alfredhickeyshmcneax@affinity.co"] }, "to": [ { "id": 2021, "type": 0, "first_name": "Alice", "last_name": "Yen", "primary_email": "yen@alice.com", "emails": ["yen@alice.com"] } ], "cc": [], "direction": 0 } ], "next_page_token": "eyJwYXJhbXMiOnsiY29tcGxldGVyX2lkIjpudWxsLCJvd25lcl9pZCI6bnVsbCwiY3JlYXRvcl9" } ``` -------------------------------- ### Get Whoami Source: https://api-docs.affinity.co/ Gets information about the user sending the request, and their affiliate company. This can be used for linking back to the user's Affinity instance. ```APIDOC ## GET /auth/whoami ### Description Gets information about the user sending the request, and their affiliate company. This can be used for linking back to the user's Affinity instance. ### Method GET ### Endpoint /auth/whoami ### Parameters There are no query or path parameters for this method. The information needed is contained within the API key. ### Response #### Success Response (200) - **tenant** (object) - Information about the Affinity instance the user belongs to. - **user** (object) - Data about the user whose api key was used for the endpoint. - **grant** (object) - Data about the type of authentication and metadata about the api key. ### Response Example { "tenant": { "id": 1, "name": "Affinity", "subdomain": "affinity" }, "user": { "id": 2, "firstName": "John", "lastName": "Doe", "email": "john@affinity.co" }, "grant": { "type": "api_key", "scope": "external_api", "createdAt": "2020-12-14T09:00:00.000-05:00" } } ``` -------------------------------- ### Example Response for All Webhook Subscriptions Source: https://api-docs.affinity.co/ This JSON array represents the response when fetching all webhook subscriptions. It includes details like subscription ID, URL, events subscribed to, and status. ```json [ { "id": 1234, "webhook_url": "https://hooks.example.com/webhook-create", "subscriptions": [ "list.created", "person.created", "organization.created", "opportunity.created" ], "disabled": false, "created_by": 5678 }, { "id": 2345, "webhook_url": "https://hooks.example.com/webhook-all", "subscriptions": [], "disabled": true, "created_by": 5678 } ] ``` -------------------------------- ### Get Specific List Entry - Postman Request Source: https://api-docs.affinity.co/postman/collection.json Retrieves a specific entry from a list by its ID. Uses a GET request to the /lists/:list_id/list-entries/:list_entry_id endpoint. ```json { "name": "Get a specific list entry", "id": "e0d2c6ff-7c4a-4a42-b93e-885fa7da5493", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [], "url": { "raw": "{{BASE_URL}}/lists/{{default_list_id}}/list-entries/{{default_list_entry_id}}", "host": [ ``` -------------------------------- ### Create a New Opportunity Source: https://api-docs.affinity.co/ Use this endpoint to create a new opportunity. Provide the opportunity's name, list ID, and associated person and organization IDs in JSON format. ```bash curl -X POST "https://api.affinity.co/opportunities" \ -u :$APIKEY \ -H "Content-Type: application/json" \ -d '{"name": "Penny Opportunity", "list_id": 6645, "person_ids": [38706], "organization_ids": [21442]}' ``` -------------------------------- ### Search Opportunities with Term Source: https://api-docs.affinity.co/ Use this endpoint to search for opportunities by a term that can be part of an opportunity's name. Results are paginated. ```bash curl "https://api.affinity.co/opportunities?term=affinity" -u :$APIKEY ``` -------------------------------- ### Example Field Value Change Response Source: https://api-docs.affinity.co/ This is an example of a single field value change object returned by the API. It includes details about the change, the entity it's associated with, and the new value. ```json { "id": 50822718, "field_id": 236333, "entity_id": 261131046, "list_entry_id": 15709964, "action_type": 0, "changer": { "id": 38706, "type": 0, "first_name": "Jane", "last_name": "Doe", "primary_email": "jane@gmail.com", "emails": ["jane@gmail.com"] }, "changed_at": "2020-04-11T22:46:50.963241Z", "value": { "id": 1607859, "text": "New", "rank": 1, "color": 0 } } ``` -------------------------------- ### Example Organization Fields Response Source: https://api-docs.affinity.co/ Illustrates the structure of the response when fetching global organization fields, including field ID, name, value type, and configuration. ```json [ { "id": 662, "name": "Potential Users", "value_type": 3, "allows_multiple": false, "dropdown_options": [] }, { "id": 700, "name": "Leads", "value_type": 0, "allows_multiple": true, "dropdown_options": [] }, { "id": 2988, "name": "Last Funding Date", "value_type": 4, "allows_multiple": false, "dropdown_options": [] }, ... ] ``` -------------------------------- ### Create an HTML-Type Note (JSON) Source: https://api-docs.affinity.co/ To create a note with rich text formatting, set the `type` parameter to 2 and include HTML tags within the `content` field. Note that `` tags are not clickable in the app. ```bash curl -X POST "https://api.affinity.co/notes" \ -u :$APIKEY \ -H "Content-Type: application/json" \ -d '{"person_ids": [38706, 624289], "organization_ids": [120611418], "opportunity_ids": [167], "type": 2, "content": "Had a lunch meeting with Jane and John today. They want to invest in Acme Corp."}' ``` -------------------------------- ### Example Field Object Response Source: https://api-docs.affinity.co/ This is an example of a single field object as returned by the Affinity API. It includes details like ID, name, value type, and dropdown options if applicable. ```json { "id": 1234, "name": "Deal Status", "list_id": 11, "enrichment_source": "none", "value_type": 7, "allows_multiple": false, "track_changes": true, "dropdown_options": [ { "id": 2863451, "text": "New", "rank": 0, "color": 3 }, { "id": 2863452, "text": "In Progress", "rank": 1, "color": 3 }, { "id": 2863453, "text": "Won", "rank": 2, "color": 2 } ] } ``` -------------------------------- ### Create a New List Source: https://api-docs.affinity.co/postman/collection.json Creates a new list with specified properties, including name, type, ownership, and permissions. ```APIDOC ## POST /lists ### Description Creates a new list with specified properties, including name, type, ownership, and permissions. ### Method POST ### Endpoint /lists ### Request Body - **name** (string) - Required - The title of the list that is displayed in Affinity. - **type** (integer) - Required - The type of the entities contained within the list. A list can contain people or organizations, but not both. - **is_public** (boolean) - Required - When true, the list is publicly accessible to all users in your team. - **owner_id** (integer) - Required - The unique ID of the internal person who is assigned this list. - **additional_permissions** (array) - Optional - The list of additional permissions that are associated with this list. See the List Resource section for more details on permissions. https://api-docs.affinity.co/#the-list-resource - **internal_person_id** (integer) - Required - The ID of the internal person. - **role_id** (integer) - Required - The role ID. ### Request Example { "name": "NAME", "type": 0, "is_public": false, "owner_id": 111, "additional_permissions": [ { "internal_person_id": 222, "role_id": 0 } ] } ``` -------------------------------- ### Get all notes Source: https://api-docs.affinity.co/postman/collection.json Retrieves a list of all notes. ```APIDOC ## GET /notes ### Description Retrieves a list of all notes. ### Method GET ### Endpoint {{BASE_URL}}/notes ``` -------------------------------- ### Example Response for a Specific Webhook Subscription Source: https://api-docs.affinity.co/ This JSON object shows the details of a single webhook subscription, including its ID, URL, subscribed events, and status. ```json { "id": 1234, "webhook_url": "https://hooks.example.com/webhook", "subscriptions": [ "list.created", "person.created", "organization.created", "opportunity.created" ], "disabled": false, "created_by": 5678 } ```