---
title: "How to Get Detailed Customer Information from the Affinity API Using Python"
url: "http://35.223.47.52/blog/how-to-get-detailed-customer-information-from-the-affinity-api-using-python/"
date: "2026-08-13T12:58:28+00:00"
modified: "2026-08-23T11:20:33+00:00"
type: "post"
---

# How to Get Detailed Customer Information from the Affinity API Using Python

[Blog](http://35.223.47.52/blog) / [Tutorials](http://35.223.47.52/blogs/tutorials/) / How to Get Detailed Customer Information from the Affinity API Using Python [Tutorials](http://35.223.47.52/blogs/tutorials/) · August 13, 2026 

How to Get Detailed Customer Information from the Affinity API Using Python
===========================================================================

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-150x150.png)Kunal Mishra

3 min read

 

 

 [](https://www.linkedin.com/sharing/share-offsite/?url=http%3A%2F%2F35.223.47.52%2Fblog%2Fhow-to-get-detailed-customer-information-from-the-affinity-api-using-python%2F) [](https://twitter.com/intent/tweet?url=http%3A%2F%2F35.223.47.52%2Fblog%2Fhow-to-get-detailed-customer-information-from-the-affinity-api-using-python%2F&text=How%20to%20Get%20Detailed%20Customer%20Information%20from%20the%20Affinity%20API%20Using%20Python)  

 

 

 

  Table of Contents - [Introduction](#introduction)
- [Pre-requisites](#pre-requisites)
- [API Endpoints](#api-endpoints)
- [Step-by-Step Process](#step-by-step-process)
- [1. Authentication](#1-authentication)
- [2. Retrieve All Customers](#2-retrieve-all-customers)
- [3. Retrieve Detailed Information for One Customer](#3-retrieve-detailed-information-for-one-customer)
- [Common Pitfalls](#common-pitfalls)
- [Frequently Asked Questions](#frequently-asked-questions)
- [Knit for Affinity API Integration](#knit-for-affinity-api-integration)
 
  Introduction
------------

This article is part of our in-depth CRM API series. This one focuses specifically on retrieving detailed customer information from Affinity. If you’re looking for a broader breakdown of authentication methods, rate limits, and other supported use cases, you can explore the complete [CRM API guide](/blog/full-list-of-knits-crm-api-guides/).

In this guide, we’ll walk through the exact steps required to authenticate, fetch a list of customers, and retrieve detailed information for a specific individual using the Affinity API.

### Pre-requisites

Before making API calls, ensure you have the following in place:

- **Affinity API Key**: Generate this from the Settings Panel in the Affinity web app.
- **Python Environment**: Python installed with the `requests` library available.

API Endpoints
-------------

The following endpoints are required for retrieving customer information:

- `GET /people` – Retrieve a list of all people.
- `GET /people/{person_id}` – Retrieve detailed information for a specific person.

Step-by-Step Process
--------------------

### 1. Authentication

The Affinity API uses HTTP Basic Authentication. Your API key should be passed as the password in the Authorization header.

```
import requests

api_key = 'your_api_key'
headers = {'Authorization': f'Basic {api_key}'}
```

### 2. Retrieve All Customers

To fetch all customers (people records), use the `/people` endpoint.

```
response = requests.get('https://api.affinity.co/people', headers=headers)
all_customers = response.json()
```

This returns a list of people along with their respective IDs. You will need the `person_id` from this response to fetch detailed information.

### 3. Retrieve Detailed Information for One Customer

To fetch detailed information for a specific person, use their unique `person_id`.

```
person_id = 'specific_person_id'

response = requests.get(
    f'https://api.affinity.co/people/{person_id}',
    headers=headers
)

customer_details = response.json()
```

This returns comprehensive information about the selected individual.

Common Pitfalls
---------------

When working with the Affinity API, integration issues usually stem from operational oversights. Here are the most common challenges and how to avoid them:

1. **Exceeding API Rate Limits**
    Monitor usage closely to avoid throttling.
2. **Incorrect or Expired API Key**
    Double-check that your key is active and correctly passed in headers.
3. **Invalid Person ID**
    Ensure the `person_id` exists before attempting to retrieve detailed data.
4. **Unhandled 429 Errors**
    Always implement retry logic with exponential backoff.
5. **Too Many Concurrent Requests**
    Limit parallel calls to avoid triggering rate restrictions.
6. **Data Sync Issues**
    Regular synchronization prevents discrepancies between systems.
7. **Field ID Confusion**
    Validate field IDs directly from request payloads to avoid mismatches.

Operational discipline is key. Most integration failures are preventable with structured request handling and monitoring.

Frequently Asked Questions
--------------------------

**1. How do I generate an API key?**
Navigate to the Settings Panel in the Affinity web app and generate your API key from there.

**2. What is the rate limit for API calls?**
Affinity allows 900 API calls per user per minute.

**3. How should I handle rate limit errors (429)?**
Implement retry logic with exponential backoff to ensure stability.

**4. Can I retrieve data for a specific field?**
Yes. Use the relevant field ID within your requests.

**5. How do I find a person’s ID?**
Call the `GET /people` endpoint to retrieve all records along with their IDs.

**6. What should I do if my API key is compromised?**
Immediately revoke the compromised key and generate a new one.

**7. How many API keys can a user have?**
Currently, one API key per user is supported.

Knit for Affinity API Integration
---------------------------------

If you want to reduce integration complexity, [Knit ](/integrations/)offers a streamlined way to connect with the Affinity API.

By integrating with Knit once, you eliminate the need to repeatedly manage authentication, authorization, and ongoing API maintenance. Knit handles the heavy lifting, allowing your team to focus on using the data rather than maintaining the integration.

 

 ![](https://storage.googleapis.com/knit-website-media/2026/08/64c34ca1e0546a9d333bb35a_Kunal-3-150x150.png)Written by Kunal Mishra

Changing integration landscape, one organization at a time‍

 

 

 

 

 

   Keep Reading
------------

  ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-green-640x400.png) [Tutorials](http://35.223.47.52/blogs/tutorials/) 

### [How to Create a Slack Bot in 5 Minutes: A to Z Guide](http://35.223.47.52/blog/how-to-create-a-slack-bot/)

You can create your own Slack Bot in just a few minutes with the Knit Unified API. Read this step-by-step…

 August 13, 2026 · 3 min read 

 

   ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-green-640x400.png) [Tutorials](http://35.223.47.52/blogs/tutorials/) 

### [How to Build and Deploy a Microsoft Teams Bot](http://35.223.47.52/blog/how-to-build-and-deploy-a-microsoft-teams-bot/)

You can either build Microsoft Teams Bot on your own or you can use Knit's Unified API to create it…

 August 13, 2026 · 4 min read 

 

   ![](https://storage.googleapis.com/knit-website-media/2026/08/blog-banner-yellow-scaled-640x400.png) [Tutorials](http://35.223.47.52/blogs/tutorials/) 

### [What Should You Look For in A Unified API Platform?](http://35.223.47.52/blog/what-should-you-look-for-in-a-unified-api-platform/)

The right unified API can solve all your integration woes at minimal effort and cost. Read this to know how…

 August 13, 2026 · 14 min read 

 

  

 

  \#1 in Ease of Integrations
---------------------------

![4.9 out of 5 stars](/wp-content/themes/knit/assets/images/g2/g2-star-rating.svg)

4.9 out of 5 stars on G2

![G2 Leader, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-leader.svg)![G2 Fastest Implementation, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-fastest-implementation.svg)![G2 High Performer, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-high-performer.svg)![G2 Best Est. ROI, Spring 2026](/wp-content/themes/knit/assets/images/g2/g2-best-roi.svg)

 

  Put Integrations on Autopilot. Talk to Experts.
-----------------------------------------------

Knit is loved by customers across the globe due to our seamless product and white glove support. You'll love us too!

 [Talk to a Human](/book-demo)
