If you’ve ever tried building apps that pull in real-time health, employment, or income data from different platforms, you know how big of a hassle it is to deal with each platform’s unique API, authentication quirks, and rate limits. That’s where Human API comes in—we’re a data provider that acts like a single translator for all those different services, so you don’t have to code each connection from scratch. Today, I’m gonna walk you through how to use Human API in Python, straight from someone on the team who works with this stuff every single day. No boring jargon, just practical steps that actually work. Human API

First, let’s get the basics straight. Human API lets you grab data from 100+ platforms—things like payroll (ADP, Gusto), health records (Epic, Kaiser Permanente), employment, and even benefits. For us, as a Human API supplier, our whole job is to make this process as smooth as possible, so developers can spend time building their product, not messing with integrations. Python is such a popular language here because it’s easy to read, has great libraries for API calls, and works well with most backend setups you’ll run into.
Step 1: Set up your Python environment. I’m assuming you already have Python 3.8 or newer installed—if not, go grab it from python.org, it’s straightforward. Pro tip: Use a virtual environment, so you don’t mess up your global Python packages. Just open your terminal (Command Prompt on Windows, Terminal on Mac/Linux) and run python -m venv humanapi-env, then activate it. On Mac/Linux that’s source humanapi-env/bin/activate, on Windows it’s humanapi-env\Scripts\activate. Once that’s done, we’ll need two main packages: requests for making API calls, and python-dotenv to keep your API keys safe (never hardcode keys directly in your code, that’s a huge security no-no). Install both with pip install requests python-dotenv.
Step 2: Get your Human API credentials. This is where you sign up for a developer account—you don’t need to be a paying customer to test this out, just grab your client ID and client secret from the Human API dashboard. Once you have them, create a file called .env in your project folder, and add two lines: HUMAN_API_CLIENT_ID=your_client_id_here and HUMAN_API_CLIENT_SECRET=your_client_secret_here. That’s it for setup.
Step 3: Authenticate with Human API. Authentication with Human API is OAuth 2.0, which sounds scary but requests makes it super simple. The first thing you need to do is get an access token—this is what you’ll use for every other API call. Let’s write a quick script for this:
First, import the packages we installed, load the .env file, and pull in your credentials:
import os
import requests
from dotenv import load_dotenv
load_dotenv() # loads variables from .env file
client_id = os.getenv("HUMAN_API_CLIENT_ID")
client_secret = os.getenv("HUMAN_API_CLIENT_SECRET")
Then, make the POST request to get your token. The endpoint here is https://api.humanapi.co/v1/oauth/token—that’s the only auth endpoint you’ll need for this part. The grant type here is client_credentials because we’re just testing (for production, you’ll use authorization_code when a user connects their platform). Here’s the code:
token_response = requests.post(
"https://api.humanapi.co/v1/oauth/token",
auth=(client_id, client_secret),
data={"grant_type": "client_credentials"}
)
Check if the request worked, and extract the access token
if token_response.status_code == 200:
access_token = token_response.json()["access_token"]
print("Got access token:", access_token)
else:
print("Error getting token:", token_response.json())
Wait, if you run this and it spits out an access token, you’re golden. If not, double-check your client ID and secret—easy typo, I’ve done it a hundred times. Also, make sure you’re using the right endpoint; the sandbox is api-sandbox.humanapi.co if you don’t want to mess with real data yet.
Step 4: Connect a test user and a platform. Now, this is where things get real. To pull data, you need a user in Human API, and that user needs to connect their account to one of the platforms (like a test ADP account for payroll data). For testing, you can create a test user via the API, or even just use the sandbox’s test accounts. Let’s create a test user first. The endpoint for creating a user is https://api.humanapi.co/v1/humans, and we’ll send a POST request with the user’s details.
Add this code to your script (after getting the access token):
user_response = requests.post(
"https://api.humanapi.co/v1/humans",
headers={"Authorization": f"Bearer {access_token}"},
json={"first_name": "Jane", "last_name": "Doe", "email": "jane.doe@example.com"}
)
if user_response.status_code == 201:
user_id = user_response.json()["id"]
print("Created user with ID:", user_id)
else:
print("Error creating user:", user_response.json())
Now, to connect the user to a platform, Human API gives you a link called a “connect URL”—this is what you send to your user so they can log into their ADP, Gusto, or whatever account and grant your app permission to pull their data. For testing, you can generate a connect URL right in Python:
connect_response = requests.post(
"https://api.humanapi.co/v1/connect/url",
headers={"Authorization": f"Bearer {access_token}"},
json={"user_id": user_id, "scope": "employment,payroll"} # scope is the data you want access to
)
if connect_response.status_code == 200:
connect_url = connect_response.json()["url"]
print("Send this link to your test user:", connect_url)
else:
print("Error getting connect URL:", connect_response.json())
If you paste that connect URL into a browser, it’ll take you to Human API’s platform selection page. Pick a sandbox platform (like ADP Sandbox), log in with the test credentials Human API provides, and boom—your user is connected. No need to handle OAuth redirects yourself for testing, the sandbox takes care of all that.
Step 5: Pull actual data. Okay, now for the fun part—getting employment or payroll data for that user. Human API has simple endpoints for different data types: /employment, /payroll, /health, etc. Let’s pull employment data first. The endpoint is https://api.humanapi.co/v1/humans/{user_id}/employment.
Add this to your script:
employment_response = requests.get(
f"https://api.humanapi.co/v1/humans/{user_id}/employment",
headers={"Authorization": f"Bearer {access_token}"}
)
if employment_response.status_code == 200:
employment_data = employment_response.json()
print("Employment Data:", employment_data)
else:
print("Error getting employment data:", employment_response.json())
Run this, and you’ll get a JSON object with details like job title, employer name, hire date, employment status, and more. For payroll data, just swap out /employment with /payroll—you’ll get pay periods, gross pay, net pay, hours worked, etc.
Wait, a quick note here: Human API lets you paginate data if you have a lot of it, like multiple pay stubs. If you don’t get all the data you want in one request, check the next link in the response headers, that’s how you fetch the next page. Also, rate limits—for sandbox, it’s pretty generous, but in production, don’t hammer the API with 1000 requests a second. Human API’s docs have the exact rate limits, but as a supplier, we’ll send you a heads-up if you’re pushing too hard.
Now, let’s talk about common pitfalls I see developers run into all the time. First, forgetting to refresh your access token. The client_credentials token expires after 1 hour, so in production, you’ll need a way to refresh it instead of making a new one every time. For user-facing apps, the authorization_code grant type (which is for real users connecting their accounts) will give you a refresh token you can use to get new access tokens without making the user log in again. Second, wrong headers: make sure your Authorization header is exactly Bearer {access_token}—capital B, no spaces wrong. Third, using the wrong endpoint: sandbox vs production, that’s a big one. If you’re testing with sandbox, all your endpoints are api-sandbox.humanapi.co, not just api.humanapi.co.
Another thing: if you’re building something that needs to handle many users, Human API has webhooks too. So when a user connects their account, or when new payroll data is available, you get a POST to your backend, no polling required. To set up a webhook, you just call the /webhooks endpoint with your backend URL, and Human API will send updates there. That’s way more efficient than you checking the API every 5 minutes.
Wait, let’s test a full working example put together. Here’s what your entire script would look like, end to end:
import os
import requests
from dotenv import load_dotenv
Load credentials
load_dotenv()
CLIENT_ID = os.getenv("HUMAN_API_CLIENT_ID")
CLIENT_SECRET = os.getenv("HUMAN_API_CLIENT_SECRET")
SANDBOX_BASE = "https://api-sandbox.humanapi.co/v1"
Get access token
token_resp = requests.post(
f"{SANDBOX_BASE}/oauth/token",
auth=(CLIENT_ID, CLIENT_SECRET),
data={"grant_type": "client_credentials"}
)
access_token = token_resp.json()["access_token"]
Create test user
user_resp = requests.post(
f"{SANDBOX_BASE}/humans",
headers={"Authorization": f"Bearer {access_token}"},
json={"first_name": "Alex", "last_name": "Morgan", "email": "alex.morgan@test.com"}
)
user_id = user_resp.json()["id"]
Get connect URL for test user
connect_resp = requests.post(
f"{SANDBOX_BASE}/connect/url",
headers={"Authorization": f"Bearer {access_token}"},
json={"user_id": user_id, "scope": "employment,payroll"}
)
connect_url = connect_resp.json()["url"]
print("Connect URL:", connect_url)
After user connects, get employment data
input("Press Enter after connecting your sandbox account…")
employment_resp = requests.get(
f"{SANDBOX_BASE}/humans/{user_id}/employment",
headers={"Authorization": f"Bearer {access_token}"}
)
print("Employment Data:", employment_resp.json())
That’s a complete script you can run right now—just add your client ID and secret to the .env file, and go. The input() line makes you wait until you’ve connected the sandbox account, which is exactly what you need to test data fetching.
Now, as someone on the Human API supplier side, I should mention that once you get the hang of this, scaling it is easy. Our library for Python (we have a official one too, which I’d recommend for production) handles all the edge cases—error retries, token refreshing, pagination—so you don’t have to code all that yourself. The human-api Python package is on PyPI, so you can install it with pip install human-api, and then the code becomes even cleaner. For example, authenticating with the official library is just from human_api import HumanApi; api = HumanApi(client_id, client_secret, sandbox=True), then pulling employment data is api.employment.get(user_id). Way less boilerplate, which is perfect for when you’re building a real product.
What about use cases? Maybe you’re building a loan app that verifies income, so you need to pull payroll data to confirm the user’s income. Or a HR tool that pulls employment records for new hires. Whatever it is, Human API in Python works for all of these. We’ve got docs for different scenarios, like connecting users in a web app, processing multiple pay stubs, or handling health data (which has its own endpoints like /health/activities, /health/records).
A quick note on security: when you’re using Human API, all user data is encrypted in transit and at rest, which is huge because you’re dealing with sensitive employment and health info. We comply with regulations like HIPAA (for health data) and GDPR, so your app will be compliant too, which is way less work for your legal team.
Now, if you’re just testing this out, the sandbox is free—you don’t have to pay until you’re ready to launch to real users. The sandbox has test data for all major platforms, so you don’t need to set up dummy accounts on every service. That’s one of my favorite parts about being a Human API supplier: we take the pain out of testing.
Wait, I should also address a common question: “Can I use this for real production apps?” Absolutely. Our production environment is fully scalable, and we have support to help you with any issues. If you run into a problem with data sync, or a platform change breaks something, our support team is quick to respond—no waiting 3 days for a reply.
Speaking of production, don’t forget to switch the API base from sandbox to https://api.humanapi.co when you go live. And switch from client_credentials to the authorization_code grant type, so real users can connect their own accounts instead of test accounts. The official Python library handles both grant types, so you don’t have to rewrite all your code.
Now, if this is making sense and you’re ready to integrate Human API into your product, or you have more questions about pricing, supported platforms, or production setups, we’d love to chat. Reach out to our team to talk through how Human API fits your specific use case, whether you’re building a fintech tool, HR platform, or health app. We can help you skip the messy integration work and get your product to users faster.
Wait, a quick recap of what we covered here: setup Python, get credentials, authenticate, create a test user, get a connect URL, pull data. That’s all the basics you need to get up and running. The rest is just exploring the endpoints and adapting it to your own project.
If you want to dive deeper, check the official Human API docs (linked in the reference below) for all endpoints, more code examples, and rate limit details. Also, the Python library’s GitHub repo has examples for common tasks like webhooks, user management, and data filtering.
One last tip: when you’re debugging, use print() or logging to check API responses. A lot of times, a 400 error is just a typo in the user ID, or a wrong scope. The Human API response gives a clear error message, so it’s easy to fix.

Okay, that’s it for the practical stuff. Whether you’re a new developer just figuring out API integrations, or an old pro looking to cut down on integration time, Human API in Python is way simpler than building 50 different platform connections. And as your supplier, we’re here to make sure you have the support you need every step of the way. If you’re ready to move past testing and launch, get in touch to talk procurement and customize the setup for your needs.
Cellular Energy Protection References
Human API Official Python Library Documentation
Human API REST API Reference Guide
Human API Sandbox Test Data Overview
BrightGene Health
BrightGene Health is one of the leading human api manufacturers and suppliers in China. We warmly welcome you to wholesale bulk human api in stock here from our factory. All our products are with high quality and competitive price.
Address: T2-805, European and American Financial City, Cangqian Street, Yuhang District, Hangzhou
E-mail: sales@brightgenehealth.com
WebSite: https://www.brightgene-health.com/