Skip to content

Affinity Python SDK

A modern, strongly-typed Python wrapper for the Affinity CRM API, with a scriptable CLI (xaffinity), a local MCP server, and Claude Code plugins.

It covers companies, persons, opportunities, lists and list entries, field values, notes, reminders, interactions, meetings, transcripts, files, relationship strengths, teams, users, webhooks and more, using Affinity's V2 API wherever it can and V1 where it can't (API coverage). Use it for code, scripts and terminal work: bulk updates, exports, data pipelines, webhooks and integrations. Affinity also runs an official, hosted MCP server for working in a chat; see how the two compare.

Disclaimer: This is an unofficial community project and is not affiliated with, endorsed by, or sponsored by Affinity. “Affinity” and related marks are trademarks of their respective owners. Use of the Affinity API is subject to Affinity’s Terms of Service.

Install

pip install affinity-sdk

Requires Python 3.10+.

Quickstart

from affinity import Affinity

with Affinity(api_key="your-api-key") as client:
    me = client.whoami()
    print(me.user.email)

Next steps

Guides