Affinity

Learn how to use Affinity with Composio

Overview

SLUG: AFFINITY

Description

Affinity helps private capital investors to find, manage, and close more deals

Authentication Details

generic_api_key
stringRequired

Connecting to Affinity

Create an auth config

Use the dashboard to create an auth config for the Affinity toolkit. This allows you to connect multiple Affinity accounts to Composio for agents to use.

1

Select App

Navigate to the Affinity toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2from composio.types import auth_scheme
3
4# Replace these with your actual values
5affinity_auth_config_id = "ac_YOUR_AFFINITY_CONFIG_ID" # Auth config ID created above
6user_id = "0000-0000-0000" # UUID from database/app
7
8composio = Composio()
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 # Replace this with a method to retrieve an API key from the user.
12 # Or supply your own.
13 user_api_key = input("[!] Enter API key")
14
15 connection_request = composio.connected_accounts.initiate(
16 user_id=user_id,
17 auth_config_id=auth_config_id,
18 config={"auth_scheme": "API_KEY", "val": user_api_key}
19 )
20
21 # API Key authentication is immediate - no redirect needed
22 print(f"Successfully connected Affinity for user {user_id}")
23 print(f"Connection status: {connection_request.status}")
24
25 return connection_request.id
26
27
28connection_id = authenticate_toolkit(user_id, affinity_auth_config_id)
29
30# You can verify the connection using:
31connected_account = composio.connected_accounts.get(connection_id)
32print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Affinity toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["AFFINITY"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Get all companies

Description

Affinity api allows paginated access to company info and custom fields. use `fieldids` or `fieldtypes` to specify data in a request. retrieve field ids/types via get `/v2/companies/fields`. export permission needed.

Action Parameters

cursor
string
fieldIds
array
fieldTypes
array
ids
array
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all list entries on a list

Description

Access and export essential data and metadata for companies, persons, or opportunities from a list, specifying data via `fieldids` or `fieldtypes`. "export data from lists" permission is necessary.

Action Parameters

cursor
string
fieldIds
array
fieldTypes
array
limit
integerDefaults to 100
listId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all list entries on a saved view

Description

Use the endpoint to access rows in a saved view with specific filters and selected fields from a web app. it doesn't maintain sort order, supports only sheet-type views, and requires export permissions.

Action Parameters

cursor
string
limit
integerDefaults to 100
listId
integerRequired
viewId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all opportunities

Description

Pagination through opportunities in affinity yields basic info but excludes field data. for field data, use specified get endpoints. "export data from lists" permission needed.

Action Parameters

cursor
string
ids
array
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get all persons

Description

The affinity api offers paginated access to person data using `fieldids` or `fieldtypes`. bulk extraction needs special permissions and supports multiple parameters.

Action Parameters

cursor
string
fieldIds
array
fieldTypes
array
ids
array
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a company s lists

Description

Returns metadata for all the lists on which the given company appears.

Action Parameters

cursor
string
id
integerRequired
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a company s list entries

Description

Summarize company data across all lists, including list-specific fields and metadata like creation date and author. access requires "export data from lists" permission.

Action Parameters

cursor
string
id
integerRequired
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a person s lists

Description

Returns metadata for all the lists on which the given person appears.

Action Parameters

cursor
string
id
integerRequired
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a person s list entries

Description

Summary: browse rows for a person in all lists, showing field data and entry metadata like creation time and author. requires "export data from lists" permission.

Action Parameters

cursor
string
id
integerRequired
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a single company

Description

Retrieve basic company info and specific field data by using `fieldids` or `fieldtypes` parameters. multiple fields can be queried. no field data if parameters aren't specified. requires "export all organizations directory" permission.

Action Parameters

fieldIds
array
fieldTypes
array
id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a single opportunity

Description

Get basic details about an opportunity without field data via provided endpoints. field data requires using specific list entry apis and the "export data from lists" permission.

Action Parameters

id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get a single person

Description

Use get `/v2/persons/fields` with `fieldids` or `fieldtypes` for detailed data; basic info by default. request multiple fields at once. "export all people" permission needed.

Action Parameters

fieldIds
array
fieldTypes
array
id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get current user

Description

Returns metadata about the current user.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on all lists

Description

Returns metadata on lists.

Action Parameters

cursor
string
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on a single list

Description

Returns metadata on a single list.

Action Parameters

listId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on a single list s fields

Description

Returns metadata on the fields available on a single list. use the returned field ids to request field data from the get `/v2/lists/{listid}/list-entries` endpoint.

Action Parameters

cursor
string
limit
integerDefaults to 100
listId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on a single saved view

Description

Returns metadata on a single saved view.

Action Parameters

listId
integerRequired
viewId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on company fields

Description

Returns metadata on non-list-specific company fields. use the returned field ids to request field data from the get `/v2/companies` and get `/v2/companies/{id}` endpoints.

Action Parameters

cursor
string
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on person fields

Description

Returns metadata on non-list-specific person fields. use the returned field ids to request field data from the get `/v2/persons` and get `/v2/persons/{id}` endpoints.

Action Parameters

cursor
string
limit
integerDefaults to 100

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get metadata on saved views

Description

Returns metadata on the saved views on a list.

Action Parameters

cursor
string
limit
integerDefaults to 100
listId
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired