Attio Python SDK and CLI
A type-safe Python client for the Attio REST API (v2), with a sync and an async variant of every method. It also ships the standalone attio CLI for people, company, note and record workflows. The CLI prints JSON for agents and scripts.
- Install:
pip install attio(oruv add attio) for the SDK;uvx attioruns the CLI without installing. Requires Python 3.10+. - Package:
attioon PyPI.gtm-attiois the same code under its original distribution and command name, kept as an alias. - Credentials: an Attio API key, in
ATTIO_API_KEY. - Where the SDK comes from: Speakeasy generates it from Attio's OpenAPI spec into
generated/. Every method has a reference page undergenerated/docs/sdks/.
Quick start for agents
| Goal | Command |
|---|---|
| Add the SDK to a project | pip install attio (or uv add attio) |
| List the CLI commands (no install) | uvx attio --help |
| Pin an exact version | uvx attio@0.28.3 --help |
| Force the newest release | uvx attio@latest --help |
Run unreleased code from main |
uvx --from git+https://github.com/elviskahoro/sdk-python-attio attio --help |
| Install the CLI on PATH | uv tool install attio |
| Run a script that imports the SDK | uv run --with attio script.py |
| Open a Python REPL with the SDK | uvx --from attio python |
Rules of thumb:
- Credentials. Put the Attio API key in
ATTIO_API_KEY. The CLI also reads it from.env.localor.envin the working directory. Never pass the key as a command-line argument. - CLI output. The CLI prints exactly one JSON envelope on stdout. Branch on
success,errors[].codeand the exit code, not on message text. The one exception is a usage error (exit 2), which goes to stderr as plain text. - CLI writes.
add,updateandupsertwrite to Attio immediately. There is no confirmation prompt and no dry run, so runsearchorlistfirst when unsure. - CLI or SDK? Use the CLI for people, companies and notes keyed by email, domain or record ID. Use the SDK for everything else: lists, entries, tasks, attributes, webhooks, meetings, SQL and so on.
- Finding an SDK method. Derive its name with Finding the right method, then open the resource page under Available Resources and Operations. That page has every parameter, an example, the response model and the errors the method raises.
Table of Contents
- Quick start for agents
- SDK Installation
- Standalone CLI
- Authentication
- SDK Example Usage
- Common Workflows
- Available Resources and Operations
- File uploads
- Retries and timeouts
- Error Handling
- Server Selection
- Custom HTTP Client
- Resource Management
- Debugging
- Troubleshooting
- Maintaining this repository
SDK Installation
pip install attio # or: uv add attio / poetry add attio
Install attio. gtm-attio is the same code under its original distribution name; install one or the other, not both. Each installs the attio import package and both the attio and gtm-attio commands. Releases before 0.28.2 install only the gtm-attio command.
Minimum Python: once a Python version reaches its end of life, the SDK keeps supporting it for 3 more months and then raises the minimum.
Scripts without a project
Use a PEP 723 inline script, and uv installs the SDK on the fly:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = ["attio"]
# ///
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
for obj in sdk.objects.get_v2_objects().data:
print(obj.api_slug)
Run it with uv run script.py, or make it executable. A script without the metadata block runs with uv run --with attio script.py. For an interactive session, use uvx --from attio python.
Standalone CLI
The attio command wraps the SDK in people, company, note and record commands. Each command identifies records by email, domain, matching attribute or ID, and prints one JSON envelope. You can run it without cloning or installing anything:
export ATTIO_API_KEY="your-attio-api-key"
uvx attio people upsert person@example.com \
--first-name Ada --last-name Lovelace
Running on demand with uvx
| Form | Use it when |
|---|---|
uvx attio … |
The default. Needs 0.28.2+. |
uvx attio@0.28.3 … |
You need reproducible runs pinned to one version. |
uvx attio@latest … |
You want a new release. Plain uvx reuses a version it already cached. |
uvx --from git+https://github.com/elviskahoro/sdk-python-attio attio … |
You need unreleased code from main. |
uv tool install attio |
You want attio on PATH permanently. |
uv tool run attio … |
Only uv is on PATH. It's identical to uvx. |
uvx gtm-attio … |
You are on a release older than 0.28.2. gtm-attio is the original name of the same command, and still ships as an alias. |
Run uvx attio <resource> <command> --help for the full flag list of any command.
Credentials
The CLI reads only ATTIO_API_KEY. It looks in the process environment first, then in .env.local, then in .env in the current directory. Without a key, the CLI returns the missing_api_key envelope. If Attio rejects the key (HTTP 401/403), the CLI returns invalid_api_key. The key needs record read/write scopes for people, companies and records commands, and note scopes for notes.
Commands
| Command | Effect | Identity |
|---|---|---|
people search [EMAIL] [search flags] |
Read-only | Email, name, email domain or company |
people add EMAIL [flags] |
Creates a person; duplicate_identity if the email already exists |
|
people update EMAIL [flags] |
Updates exactly one match; record_not_found or multiple_matches otherwise |
|
people upsert EMAIL [flags] |
Creates a person, or updates the match | |
companies search --json PAYLOAD |
Read-only | Exact domain |
companies add --json PAYLOAD |
Creates a company; duplicate_identity if the domain already exists |
Domain |
companies update --json PAYLOAD |
Updates exactly one match; record_not_found or multiple_matches otherwise |
Domain |
notes list --json PAYLOAD |
Read-only | Parent record |
notes add --json PAYLOAD |
Creates a note on an existing record | Parent record |
notes update --json PAYLOAD |
Replaces only the fields you supply | Note ID |
records upsert --json PAYLOAD |
Creates or updates a record on any object; multiple_match_results if the matching attribute finds more than one record |
Matching attribute |
People
Every flag has a matching JSON key for --json:
| Flag | JSON key | Notes |
|---|---|---|
EMAIL (positional) |
email |
Identity key; required |
--add-email (repeatable) |
additional_emails (list) |
Extra addresses to store |
--replace-emails |
replace_emails |
update/upsert only: replace the stored emails with the identity email plus --add-email values |
--first-name, --last-name |
first_name, last_name |
|
--job-title |
job_title |
|
--phone |
phone |
Start with + and the country code, or pair with --phone-country-code |
--phone-country-code |
phone_country_code |
ISO-3166-1 alpha-2, e.g. US |
--linkedin |
linkedin |
Profile URL or handle |
--location |
location |
Needs --country-code |
--country-code |
country_code |
ISO-3166-1 alpha-2 |
--location-mode city|raw |
location_mode |
How --location splits: city reads locality, region (the default); raw reads street, locality, region |
--company |
company_domain |
Links the person to the company with this domain |
--notes |
notes |
Writes the person's notes attribute |
--strict |
strict |
Turns the cases below into errors |
--json replaces every flag, including the positional email, and rejects unknown keys. people search has its own flags and does not take --json.
people search needs at least one filter. Filters combine with AND, and every match is listed:
| Flag | Match |
|---|---|
EMAIL (positional) |
Exact email |
--name |
Case-insensitive substring of the full name |
--email-domain |
Exact email domain (mail.example.com does not match example.com) |
--company |
Case-insensitive substring of the linked company name |
--limit |
Maximum records returned (default and cap: 50) |
Without --strict, the CLI keeps going in three cases, and reports each one in warnings and skipped_fields:
- Invalid optional value (a phone number, LinkedIn handle or domain): skipped.
- Optional attribute your workspace doesn't have: the write is retried without it.
upsertmatches several people: the CLI writes to the lexicographically smallestrecord_id, setspartial_success, and adds anupsert_multi_match_selected_recordwarning.
With --strict, these fail with invalid_value, schema_mismatch or multiple_matches instead. update and add never pick between duplicates.
uvx attio people search person@example.com
uvx attio people search --name "Ada Lovelace" --email-domain example.com
uvx attio people add person@example.com --first-name Ada --last-name Lovelace
uvx attio people update person@example.com --job-title Mathematician
uvx attio people upsert person@example.com --company example.com --strict
uvx attio people upsert --json '{"email":"person@example.com","first_name":"Ada","job_title":"Mathematician"}'
Companies
--json is required and has the form {"domain": "example.com", "values": {...}}:
domainis the identity. The CLI writes it to Attio'sdomainsattribute, so it rejectsvalues.domains.valuesuses the API's record format,{"attribute_slug": [value, ...]}. See Record values.updateoverwrites only the attributes you supply. Multi-select values are replaced, not appended.
uvx attio companies search --json '{"domain":"example.com"}'
uvx attio companies add --json '{"domain":"example.com","values":{"name":[{"value":"Example Inc"}]}}'
uvx attio companies update --json '{"domain":"example.com","values":{"description":["Prospect"]}}'
Notes
| Command | JSON fields |
|---|---|
notes list |
parent_object, parent_record_id, and optionally limit (1-500, default 100) and offset (default 0) |
notes add |
parent_object, parent_record_id, title, content, and optionally format (plaintext by default, or markdown) |
notes update |
note_id, plus at least one of title, content and format |
parent_object is an object slug such as people or companies. parent_record_id is that record's ID, which you can read from the record_id of a people or company envelope.
uvx attio notes list --json '{"parent_object":"people","parent_record_id":"RECORD_ID"}'
uvx attio notes add --json '{"parent_object":"people","parent_record_id":"RECORD_ID","title":"Discovery call","content":"Discussed the launch plan.","format":"plaintext"}'
uvx attio notes update --json '{"note_id":"NOTE_ID","content":"Updated call notes."}'
Records
--json is required and has the form {"object": "...", "matching_attribute": "...", "values": {...}}:
objectis any object slug or ID, including custom objects.matching_attributeis a unique attribute on that object; a record is created if no record matches it, or updated if exactly one does.valuesuses the API's record format,{"attribute_slug": [value, ...]}(see Record values), and must include thematching_attributekey. Values can reference other records, by ID or by a matching attribute of the target; see Upsert a record on any object.- Attio rejects a matching attribute that finds more than one record with
multiple_match_results.
uvx attio records upsert --json '{"object":"deals","matching_attribute":"external_id","values":{"external_id":["deal-1042"],"name":["Acme renewal"],"contact":[{"target_object":"people","email_addresses":[{"email_address":"ada@example.com"}]}]}}'
Output envelope
Every run that gets past argument parsing prints exactly one JSON object to stdout:
{
"success": true,
"partial_success": false,
"action": "created",
"record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b",
"warnings": [],
"skipped_fields": [],
"errors": [],
"meta": {
"output_schema_version": "v1",
"person": {
"record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b",
"email_addresses": ["person@example.com"],
"name": "Ada Lovelace",
"created": true,
"raw": {}
}
}
}
| Field | Contents |
|---|---|
action |
created, updated, upserted, searched, listed or failed |
record_id |
The ID of the person, company or record written (the note ID for notes); null for search, list and failures |
meta.results |
The matching records or notes from search or list. A people or company search returns at most 50 (people search --limit can lower this), and adds a search_result_limit_reached warning when it hits that limit. |
meta.person, meta.company, meta.note, meta.record |
The object that was written |
meta.object, meta.matching_attribute |
Echoed back from records upsert; the API response doesn't say whether the record was created or updated, so both arrive as upserted |
warnings[] |
Objects with code, message, field and retryable |
skipped_fields[] |
Objects with field and reason (invalid_value or schema_mismatch) |
A failure has the same shape, with success: false and the details in errors:
{
"success": false,
"partial_success": false,
"action": "failed",
"record_id": null,
"warnings": [],
"skipped_fields": [],
"errors": [
{
"code": "missing_api_key",
"message": "ATTIO_API_KEY is not set. Export it or add it to .env.local or .env in the current directory.",
"error_type": "CLIError",
"fatal": true,
"field": null,
"status_code": null,
"type": null,
"details": {}
}
],
"meta": {"output_schema_version": "v1"}
}
errors[].code |
Meaning |
|---|---|
missing_api_key |
No ATTIO_API_KEY in the environment, .env.local or .env |
invalid_api_key |
Attio returned 401/403: a wrong key, or a missing scope |
invalid_json, validation_error |
--json isn't valid JSON, or a value failed validation; message names the field |
duplicate_identity |
add found an existing person or company with that email or domain |
record_not_found |
update matched nothing |
multiple_matches |
update, or upsert --strict, matched more than one record |
multiple_match_results |
records upsert's matching attribute matched more than one record |
invalid_value, schema_mismatch |
With --strict: a value was invalid, or the workspace lacks the attribute |
uniqueness_conflict |
A person write included an email address that already belongs to another person |
| anything else | Attio's own error code, passed through with status_code and details from the API response |
Exit codes:
| Code | Meaning |
|---|---|
0 |
Success, including partial_success |
1 |
A failure, reported in a success: false envelope |
2 |
A command-line usage error. argparse prints it to stderr and no JSON is emitted. |
Authentication
Every request needs an Attio access token, which you pass as api_key (oauth2 is an equivalent alias; pass only one). It accepts either kind of Attio access token:
- API key: a single-workspace token. Generate it in the developer settings of an app in your workspace.
- OAuth 2.0 access token: for an app installed in several workspaces.
import os
from attio import SDK
with SDK(api_key=os.environ["ATTIO_API_KEY"]) as sdk:
print(sdk.meta.get_v2_self()) # which workspace and scopes the token has
Look up a person by email
with SDK(api_key=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.records.post_v2_objects_object_records_query(
object="people",
filter_={"email_addresses": "ada@example.com"},
limit=1,
)
person = res.data[0] if res.data else None
From the shell, uvx attio people search ada@example.com does the same.
Tokens carry scopes. Each method's reference page lists the scopes it needs under "Required scopes", and a 403 usually means one of them is missing.
SDK Example Usage
# Synchronous
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.objects.get_v2_objects()
for obj in res.data:
print(obj.api_slug, obj.singular_noun)
Every method has an _async twin:
# Asynchronous
import asyncio
import os
from attio import SDK
async def main() -> None:
async with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = await sdk.objects.get_v2_objects_async()
print([obj.api_slug for obj in res.data])
asyncio.run(main())
Finding the right method
Method names come mechanically from the HTTP verb and the path of the Attio endpoint:
| Rule | Example |
|---|---|
Name: sdk.<resource>.<verb>_<path>, where /, { and } become _ |
POST /v2/objects/{object}/records/query → sdk.records.post_v2_objects_object_records_query |
A path that ends in a parameter gets a trailing _ |
GET /v2/objects/{object}/records/{record_id} → sdk.records.get_v2_objects_object_records_record_id_ |
Async: append _async and await the call |
await sdk.records.post_v2_objects_object_records_query_async(...) |
Arguments are keyword-only. Path params, query params and top-level body fields are all flattened into arguments; most write endpoints take one body argument, data= |
sdk.records.post_v2_objects_object_records(object="people", data={"values": {...}}) |
Names that clash with Python builtins get a trailing _ |
filter_= on query methods; the format_ key in a note body |
A {list} path parameter is named list_id |
sdk.entries.post_v2_lists_list_entries_query(list_id="sales") |
Every method also accepts retries=, timeout_ms=, server_url= and http_headers= |
See Retries and timeouts |
Request bodies accept plain dicts (typed as TypedDict) or model instances from attio.models. Responses are Pydantic models with the payload under .data. res.model_dump(mode="json", by_alias=True) turns a response into plain JSON-compatible data.
The resource pages in Available Resources and Operations document each method's parameters, an example, the response model and its errors. In a checkout, they live at generated/docs/sdks/<resource>/README.md, and the models at generated/docs/models/.
Record values
Attio record attributes are written as {attribute_slug: [value, ...]}. The value is always a list, even for a single-value attribute. Common shapes (the CLI writes these):
| Attribute | Value |
|---|---|
email_addresses (people) |
[{"email_address": "ada@example.com"}] |
name (people) |
[{"first_name": "Ada", "last_name": "Lovelace", "full_name": "Ada Lovelace"}] |
job_title, description (text) |
["Mathematician"] |
phone_numbers (people) |
[{"original_phone_number": "+14155550100"}] |
domains (companies) |
[{"domain": "example.com"}] |
name (companies) |
[{"value": "Example Inc"}] |
associated_company (person → company) |
[{"target_object": "companies", "domains": [{"domain": "example.com"}]}] |
| Any record reference, by ID | [{"target_object": "people", "target_record_id": "<record-uuid>"}] |
Attribute slugs and types differ between workspaces. List them with sdk.attributes.get_v2_target_identifier_attributes(target="objects", identifier="people"), and see Attio's attribute types reference for every value shape.
Common Workflows
Query people, with a filter and pagination
import os
from attio import SDK
PAGE = 100
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
offset = 0
while True:
page = sdk.records.post_v2_objects_object_records_query(
object="people",
filter_={"email_addresses": "ada@example.com"},
limit=PAGE,
offset=offset,
)
for record in page.data:
print(record.id.record_id, record.values.get("name"))
if len(page.data) < PAGE:
break
offset += PAGE
Create a person
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.records.post_v2_objects_object_records(
object="people",
data={
"values": {
"email_addresses": [{"email_address": "ada@example.com"}],
"name": [
{
"first_name": "Ada",
"last_name": "Lovelace",
"full_name": "Ada Lovelace",
},
],
"job_title": ["Mathematician"],
},
},
)
print(res.data.id.record_id)
Create a custom attribute and select options on people
Create the attribute, then add options to it. The API key needs the object_configuration:read-write scope. Other types (text, date, ...) use the same call with a different type:
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
sdk.attributes.post_v2_target_identifier_attributes(
target="objects",
identifier="people",
data={
"title": "Lead stage",
"description": None,
"api_slug": "lead_stage",
"type": "select",
"is_required": False,
"is_unique": False,
"is_multiselect": False,
"config": {},
},
)
for title in ("Prospect", "Customer"):
sdk.attributes.post_v2_target_identifier_attributes_attribute_options(
target="objects",
identifier="people",
attribute="lead_stage",
data={"title": title},
)
Upsert a person by email
This creates the person, or updates the one record whose matching_attribute matches:
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.records.put_v2_objects_object_records(
object="people",
matching_attribute="email_addresses",
data={
"values": {
"email_addresses": [{"email_address": "ada@example.com"}],
"job_title": ["Mathematician"],
},
},
)
print(res.data.id.record_id)
Look up records of any object
object takes any object slug, built-in or custom. This finds a record's ID by filtering on an attribute, then fetches it:
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
page = sdk.records.post_v2_objects_object_records_query(
object="deals",
filter_={"name": "Acme renewal"},
limit=10,
)
for record in page.data:
print(record.id.record_id, record.values.get("name"))
if page.data:
res = sdk.records.get_v2_objects_object_records_record_id_(
object="deals",
record_id=page.data[0].id.record_id,
)
print(res.data.values)
Set custom attributes on a person
Custom attributes are written like built-in ones: {attribute_slug: [value, ...]} (see Record values). The attribute must already exist; list slugs with sdk.attributes.get_v2_target_identifier_attributes(target="objects", identifier="people"). This example assumes a text attribute lead_source.
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
# Create with a custom attribute.
created = sdk.records.post_v2_objects_object_records(
object="people",
data={
"values": {
"email_addresses": [{"email_address": "ada@example.com"}],
"lead_source": ["Conference"],
},
},
)
# Update it later by record ID.
sdk.records.patch_v2_objects_object_records_record_id_(
object="people",
record_id=created.data.id.record_id,
data={"values": {"lead_source": ["Webinar"]}},
)
patch_... adds to multiselect attributes (new values are prepended to the existing list). Use put_v2_objects_object_records_record_id_ to overwrite them. To create or update by a unique attribute in one call, see Upsert a person by email.
Upsert a record on any object
object accepts any object slug or ID, including custom objects. matching_attribute should be a unique attribute on that object; a record is created if none matches. Record-reference values point at a record either by ID or by a matching attribute of the target:
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.records.put_v2_objects_object_records(
object="deals",
matching_attribute="external_id",
data={
"values": {
"external_id": ["deal-1042"],
"name": ["Acme renewal"],
# Reference a person by matching attribute...
"contact": [
{
"target_object": "people",
"email_addresses": [{"email_address": "ada@example.com"}],
},
],
# ...or by record ID.
"owner": [
{
"target_object": "people",
"target_record_id": "00000000-0000-0000-0000-000000000000",
},
],
},
},
)
print(res.data.id.record_id)
A reference matching no record, or more than one, is rejected. If the matching attribute is itself multiselect, upserted values are added to the existing ones; any other multiselect attribute is set to exactly the supplied values, so values left out are deleted.
Add a note to a record
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.notes.post_v2_notes(
data={
"parent_object": "people",
"parent_record_id": "bf071e1f-6035-429d-b874-d83ea64ea13b",
"title": "Discovery call",
"format_": "plaintext",
"content": "Discussed the launch plan.",
},
)
print(res.data.id.note_id)
Fuzzy search across objects
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
res = sdk.records.post_v2_objects_records_search(
query="ada",
objects=["people", "companies"],
request_as={"type": "workspace"},
limit=10,
)
print(res.data)
Search is eventually consistent. When you need up-to-date results, use post_v2_objects_object_records_query.
Available Resources and Operations
Each heading links to the resource's reference page and shows the attribute it lives on. Each method links to its section on that page.
Activities: sdk.activities
- get_v2_activities - List activities
- post_v2_activities - Create an activity
- get_v2_activities_activity_ - Get an activity
- patch_v2_activities_activity_ - Update an activity
- delete_v2_activities_activity_ - Delete an activity
ActivityRecords: sdk.activity_records
- post_v2_activities_activity_records_query - List activity records
- post_v2_activities_activity_records - Create an activity record
- put_v2_activities_activity_records - Upsert an activity record
- get_v2_activities_activity_records_record_id_ - Get an activity record
- patch_v2_activities_activity_records_record_id_ - Update an activity record (append multiselect values)
- put_v2_activities_activity_records_record_id_ - Update an activity record (overwrite multiselect values)
- delete_v2_activities_activity_records_record_id_ - Delete an activity record
Attributes: sdk.attributes
- get_v2_target_identifier_attributes - List attributes
- post_v2_target_identifier_attributes - Create an attribute
- get_v2_target_identifier_attributes_attribute_ - Get an attribute
- patch_v2_target_identifier_attributes_attribute_ - Update an attribute
- get_v2_target_identifier_attributes_attribute_options - List select options
- post_v2_target_identifier_attributes_attribute_options - Create a select option
- patch_v2_target_identifier_attributes_attribute_options_option_ - Update a select option
- get_v2_target_identifier_attributes_attribute_statuses - List statuses
- post_v2_target_identifier_attributes_attribute_statuses - Create a status
- patch_v2_target_identifier_attributes_attribute_statuses_status_ - Update a status
CallRecordings: sdk.call_recordings
- get_v2_meetings_meeting_id_call_recordings - List call recordings
- post_v2_meetings_meeting_id_call_recordings - Create call recording
- get_v2_meetings_meeting_id_call_recordings_call_recording_id_ - Get call recording
- delete_v2_meetings_meeting_id_call_recordings_call_recording_id_ - Delete call recording
Comments: sdk.comments
- post_v2_comments - Create a comment
- get_v2_comments_comment_id_ - Get a comment
- delete_v2_comments_comment_id_ - Delete a comment
Emails: sdk.emails
- get_v2_emails - List emails
Entries: sdk.entries
- post_v2_lists_list_entries_query - List entries
- post_v2_lists_list_entries - Create an entry (add record to list)
- put_v2_lists_list_entries - Upsert a list entry by parent
- get_v2_lists_list_entries_entry_id_ - Get a list entry
- patch_v2_lists_list_entries_entry_id_ - Update a list entry (append multiselect values)
- put_v2_lists_list_entries_entry_id_ - Update a list entry (overwrite multiselect values)
- delete_v2_lists_list_entries_entry_id_ - Delete a list entry
- get_v2_lists_list_entries_entry_id_attributes_attribute_values - List attribute values for a list entry
- put_v2_lists_list_entries_entry_id_attributes_attribute_values - Write list entry attribute values
Files: sdk.files
- get_v2_files - List files
- post_v2_files - Create a folder
- post_v2_files_upload - Upload a file
- get_v2_files_file_id_ - Get a file
- delete_v2_files_file_id_ - Delete a file
- get_v2_files_file_id_download - Download a file
Lists: sdk.lists
- get_v2_lists - List all lists
- post_v2_lists - Create a list
- get_v2_lists_list_ - Get a list
- patch_v2_lists_list_ - Update a list
- get_v2_lists_list_views - List views for list
Meetings: sdk.meetings
- get_v2_meetings - List meetings
- post_v2_meetings - Create a meeting
- get_v2_meetings_meeting_id_ - Get a meeting
- patch_v2_meetings_meeting_id_ - Update a meeting (append linked records)
- put_v2_meetings_meeting_id_ - Update a meeting (overwrite linked records)
- delete_v2_meetings_meeting_id_ - Delete a meeting
Meta: sdk.meta
- get_v2_self - Identify
Notes: sdk.notes
- get_v2_notes - List notes
- post_v2_notes - Create a note
- get_v2_notes_note_id_ - Get a note
- patch_v2_notes_note_id_ - Update a note
- delete_v2_notes_note_id_ - Delete a note
Objects: sdk.objects
- get_v2_objects - List objects
- post_v2_objects - Create an object
- get_v2_objects_object_ - Get an object
- patch_v2_objects_object_ - Update an object
- delete_v2_objects_object_ - Delete an object
- get_v2_objects_object_views - List views for object
Records: sdk.records
- post_v2_objects_object_records_query - List records
- post_v2_objects_object_records - Create a record
- put_v2_objects_object_records - Upsert a record
- get_v2_objects_object_records_record_id_ - Get a record
- patch_v2_objects_object_records_record_id_ - Update a record (append multiselect values)
- put_v2_objects_object_records_record_id_ - Update a record (overwrite multiselect values)
- delete_v2_objects_object_records_record_id_ - Delete a record
- post_v2_objects_object_records_merge - Merge two records
- get_v2_objects_object_records_record_id_attributes_attribute_values - List record attribute values
- put_v2_objects_object_records_record_id_attributes_attribute_values - Write record attribute values
- get_v2_objects_object_records_record_id_entries - List record entries
- post_v2_objects_records_search - Search records
Sequences: sdk.sequences
- post_v2_sequences_unsubscribed_emails - Add emails to the unsubscribe list
Sql: sdk.sql
- post_v2_sql - Query SQL
Tasks: sdk.tasks
- get_v2_tasks - List tasks
- post_v2_tasks - Create a task
- get_v2_tasks_task_id_ - Get a task
- patch_v2_tasks_task_id_ - Update a task
- delete_v2_tasks_task_id_ - Delete a task
Threads: sdk.threads
- get_v2_threads - List threads
- get_v2_threads_thread_id_ - Get a thread and its comments
Transcripts: sdk.transcripts
- get_v2_meetings_meeting_id_call_recordings_call_recording_id_transcript - Deprecated: Get call transcript
Webhooks: sdk.webhooks
- get_v2_webhooks - List webhooks
- post_v2_webhooks - Create a webhook
- get_v2_webhooks_webhook_id_ - Get a webhook
- patch_v2_webhooks_webhook_id_ - Update a webhook
- delete_v2_webhooks_webhook_id_ - Delete a webhook
WorkspaceMembers: sdk.workspace_members
- get_v2_workspace_members - List workspace members
- get_v2_workspace_members_workspace_member_id_ - Get a workspace member
File uploads
Pass a file as a stream rather than reading it into memory; bytes also work:
import os
from attio import SDK
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk, open("example.pdf", "rb") as content:
res = sdk.files.post_v2_files_upload(
file={"file_name": "example.pdf", "content": content},
object="people",
record_id="bf071e1f-6035-429d-b874-d83ea64ea13b",
)
print(res.data)
Retries and timeouts
By default, a failed request is not retried. Pass a RetryConfig, either per call with retries= or for the whole client with retry_config=. A retry happens on HTTP 429, 500, 502, 503 and 504, and also on connection errors when retry_connection_errors is set:
import os
from attio import SDK
from attio.utils import BackoffStrategy, RetryConfig
retry = RetryConfig(
"backoff",
BackoffStrategy(
initial_interval=500, # ms before the first retry
max_interval=60_000, # ms cap on a single wait
exponent=1.5, # growth factor between waits
max_elapsed_time=300_000, # ms before giving up
),
retry_connection_errors=True,
)
# For every method on this client:
with SDK(oauth2=os.environ["ATTIO_API_KEY"], retry_config=retry, timeout_ms=30_000) as sdk:
# Or per call; this overrides the client-wide setting:
res = sdk.objects.get_v2_objects(retries=retry, timeout_ms=10_000)
timeout_ms is in milliseconds. Set it on SDK(...) for every request, or on a single call.
Error Handling
import os
import httpx
from attio import SDK, errors
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
try:
sdk.records.get_v2_objects_object_records_record_id_(
object="people",
record_id="00000000-0000-0000-0000-000000000000",
)
except errors.SDKError as e:
print(e.status_code) # e.g. 404
print(e.message)
print(e.body) # Attio's JSON error body: status_code, type, code, message
except httpx.RequestError as e:
print("network error:", e)
| Exception | When |
|---|---|
errors.SDKError |
Base class for every HTTP error response. Has status_code, message, body, headers and raw_response. |
errors.<Verb><Path><Kind>Error |
A typed subclass for each documented Attio error, e.g. PostV2ObjectsObjectRecordsBadRequestInvalidRequestError (400 on create record) or GetV2NotesNoteIDNotFoundError. Has the parsed body in e.data (status_code, type, code, message). |
errors.SDKDefaultError |
Any other 4XX or 5XX response. |
errors.ResponseValidationError |
The response didn't match the SDK's model. The Pydantic error is in e.cause. |
httpx.RequestError (ConnectError, TimeoutException) |
Network failure. Not an SDKError. |
The typed classes are long and specific to one endpoint. Catch errors.SDKError and branch on e.status_code (404, 409, 429, …), or on e.data.code when the class has one. Each method's reference page lists its error classes under "Errors", but a few of those tables still use older class names. Before you catch a class, confirm it exists in attio.errors; the definitions live in generated/src/attio/errors/.
Server Selection
The default server is https://api.attio.com. To override it, pass server_url to SDK(...), or to a single call:
import os
from attio import SDK
sdk = SDK(oauth2=os.environ["ATTIO_API_KEY"], server_url="https://api.attio.com")
Custom HTTP Client
The SDK uses httpx. For proxies, custom headers, transport timeouts or event hooks, pass your own client: client= for sync calls, async_client= for async ones:
import os
import httpx
from attio import SDK
sdk = SDK(
oauth2=os.environ["ATTIO_API_KEY"],
client=httpx.Client(headers={"x-custom-header": "someValue"}),
async_client=httpx.AsyncClient(headers={"x-custom-header": "someValue"}),
)
Any object that implements the attio.httpclient.HttpClient or AsyncHttpClient protocol (send and build_request) also works, for example a wrapper that adds logging.
To run on httpx2, Pydantic's fork of httpx, alias it before importing the SDK:
import httpx2
httpx2.alias_httpx()
from attio import SDK # noqa: E402
Resource Management
SDK is a context manager. On exit it closes the HTTP clients it created; a finalizer closes them otherwise. In a long-running program, create one client and reuse it:
import os
from attio import SDK
def main() -> None:
with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
... # reuse sdk for every call
async def amain() -> None:
async with SDK(oauth2=os.environ["ATTIO_API_KEY"]) as sdk:
... # reuse sdk for every call
Debugging
import logging
import os
from attio import SDK
logging.basicConfig(level=logging.DEBUG)
sdk = SDK(oauth2=os.environ["ATTIO_API_KEY"], debug_logger=logging.getLogger("attio"))
The debug logger records each request's method, URL, headers and body, and each response. The headers include Authorization: Bearer <your key>, so never share these logs or commit them.
Troubleshooting
401 or 403 responses
- From the CLI, this is the
invalid_api_keyerror. From the SDK, it's anSDKErrorwith status 401 or 403. - Check that the key is current and has the scopes on the method's reference page. Record writes, for example, need
record_permission:read-write.
400 validation errors on create or update
- Values must be lists in the shapes shown in Record values, and every attribute slug must exist in your workspace.
- Start from one attribute and add the rest one at a time. The error's
messagenames the attribute it rejected.
uvx runs an old version
uvx reuses a cached environment. Run uvx attio@latest …, pin a version with @X.Y.Z, or add --refresh.
uvx attio: "An executable named attio is not provided by package attio"
The resolved release predates 0.28.2, so it ships only gtm-attio. Run uvx attio@latest … to get a current release, or uvx --from attio gtm-attio … to stay on the old one.
uvx: command not found
uvx ships with uv. uv tool run … does the same thing.
Async usage issues
- Inside
async with SDK(...), use the_asyncmethods. The sync methods block the event loop. - Don't mix sync and async clients in the same call path.
Maintaining this repository
This README is maintained by hand. Speakeasy generates everything under generated/: the SDK source, generated/docs/ and generated/USAGE.md. ci/post_generate_patch.py owns the Standalone CLI section and the [project.scripts] entry points, and re-applies them after every regeneration. AGENTS.md covers regeneration, the overlay and releases.
Metadata
Release files for gtm-attio 0.28.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gtm_attio-0.28.12.tar.gz | 446.9 kB | Without provenance | Details for gtm_attio-0.28.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gtm_attio-0.28.12-py3-none-any.whl | Python 3 | none | any | Details for gtm_attio-0.28.12-py3-none-any.whl |
Total release size: 984.4 kB
Release files / gtm_attio-0.28.12.tar.gz
| Download URL | gtm_attio-0.28.12.tar.gz |
|---|---|
| Size | 446.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cede1b8394470b4f9ff2cccf58ff288b9cdcc9a3e25bc21ac6d8ef5798215f5
|
|
BLAKE2b-256 checksum How to use checksums |
d578e620bbbbebef3d6a727ba01a09a01ba1246d5627229798a1b646534eadca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.18
|
Release files / gtm_attio-0.28.12-py3-none-any.whl
| Download URL | gtm_attio-0.28.12-py3-none-any.whl |
|---|---|
| Size | 537.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72ec17266a7ba43443e6aac65f3103188203857000bb98d459a875019d03fa0b
|
|
BLAKE2b-256 checksum How to use checksums |
ea029eb388ee862e9047d975f9a9e19dcafb2de51af1e5520e574511d51674b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.18
|
Security for gtm-attio 0.28.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.