The PayFlow API allows you to programmatically manage payroll operations, employee data, and compensation workflows. This RESTful API uses JSON for requests and responses, making it simple to integrate payroll functionality into your existing systems.
Base URL: https://api.payflow.dev/v1
PayFlow uses API keys to authenticate requests. Include your API key in the Authorization header of every request.
Authorization: Bearer your_api_key_here
Security Note: Never expose your API key in client-side code or public repositories. Treat it like a password.
API requests are limited to 1,000 calls per hour per API key. Rate limit information is included in response headers:
X-RateLimit-Limit: Maximum requests per hourX-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Timestamp when the rate limit resetsCreate, update, and retrieve employee information including compensation details, tax information, and payment preferences.
Initiate and manage payroll processing cycles, including calculating wages, deductions, and tax withholdings.
Manage direct deposit accounts, payment cards, and other disbursement methods for employees.
Add a new employee to your payroll system.
Endpoint: POST /employees
Request Body:
{
"first_name": "Sarah",
"last_name": "Chen",
"email": "sarah.chen@company.com",
"employee_id": "EMP-2024-0156",
"hire_date": "2024-01-15",
"compensation": {
"type": "salary",
"amount": 75000,
"currency": "USD",
"pay_frequency": "biweekly"
},
"tax_details": {
"filing_status": "single",
"allowances": 1,
"additional_withholding": 0
}
}
Response (201 Created):
{
"id": "emp_1a2b3c4d5e6f",
"first_name": "Sarah",
"last_name": "Chen",
"email": "sarah.chen@company.com",
"employee_id": "EMP-2024-0156",
"status": "active",
"hire_date": "2024-01-15",
"created_at": "2024-01-15T14:30:00Z",
"compensation": {
"type": "salary",
"amount": 75000,
"currency": "USD",
"pay_frequency": "biweekly"
}
}
Example (Python):
import requests
url = "https://api.payflow.dev/v1/employees"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
data = {
"first_name": "Sarah",
"last_name": "Chen",
"email": "sarah.chen@company.com",
"employee_id": "EMP-2024-0156",
"hire_date": "2024-01-15",
"compensation": {
"type": "salary",
"amount": 75000,
"currency": "USD",
"pay_frequency": "biweekly"
}
}
response = requests.post(url, json=data, headers=headers)
employee = response.json()
print(f"Created employee: {employee['id']}")
Example (JavaScript):
const createEmployee = async () => {
const response = await fetch('https://api.payflow.dev/v1/employees', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: 'Sarah',
last_name: 'Chen',
email: 'sarah.chen@company.com',
employee_id: 'EMP-2024-0156',
hire_date: '2024-01-15',
compensation: {
type: 'salary',
amount: 75000,
currency: 'USD',
pay_frequency: 'biweekly'
}
})
});
const employee = await response.json();
console.log('Created employee:', employee.id);
};
Process payroll for a specified pay period.
Endpoint: POST /payroll-runs
Request Body:
{
"pay_period_start": "2024-01-01",
"pay_period_end": "2024-01-15",
"pay_date": "2024-01-19",
"employee_ids": ["emp_1a2b3c4d5e6f", "emp_9z8y7x6w5v4u"],
"auto_approve": false
}
Response (201 Created):
{
"id": "pr_abc123xyz789",
"status": "pending_review",
"pay_period_start": "2024-01-01",
"pay_period_end": "2024-01-15",
"pay_date": "2024-01-19",
"employee_count": 2,
"total_gross_pay": 15234.50,
"total_net_pay": 11456.78,
"created_at": "2024-01-16T09:00:00Z"
}
Get details for a specific employee.
Endpoint: GET /employees/{employee_id}
Response (200 OK):
{
"id": "emp_1a2b3c4d5e6f",
"first_name": "Sarah",
"last_name": "Chen",
"email": "sarah.chen@company.com",
"status": "active",
"hire_date": "2024-01-15",
"compensation": {
"type": "salary",
"amount": 75000,
"currency": "USD",
"pay_frequency": "biweekly"
},
"payment_method": {
"type": "direct_deposit",
"bank_name": "First National Bank",
"account_last4": "3456"
}
}
PayFlow uses standard HTTP status codes and returns detailed error information in JSON format.
200 OK: Request succeeded201 Created: Resource created successfully400 Bad Request: Invalid request parameters401 Unauthorized: Invalid or missing API key404 Not Found: Resource doesn't exist429 Too Many Requests: Rate limit exceeded500 Internal Server Error: Server error (contact support){
"error": {
"code": "invalid_employee_id",
"message": "The employee_id field must be unique",
"param": "employee_id",
"type": "validation_error"
}
}
Python Example:
try:
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
employee = response.json()
except requests.exceptions.HTTPError as e:
error_data = e.response.json()
print(f"Error: {error_data['error']['message']}")
JavaScript Example:
try {
const response = await fetch(url, options);
if (!response.ok) {
const error = await response.json();
throw new Error(error.error.message);
}
const employee = await response.json();
} catch (error) {
console.error('Failed to create employee:', error.message);
}
PayFlow can send real-time notifications to your application when events occur.
payroll_run.completed: Payroll processing finishedemployee.created: New employee addedemployee.updated: Employee information changedpayment.failed: Payment couldn't be processed{
"event": "payroll_run.completed",
"timestamp": "2024-01-19T16:45:00Z",
"data": {
"payroll_run_id": "pr_abc123xyz789",
"pay_date": "2024-01-19",
"employee_count": 156,
"total_net_pay": 234567.89,
"status": "completed"
}
}
Use our sandbox environment to test your integration without affecting live data.
Sandbox Base URL: https://sandbox.payflow.dev/v1
Request a sandbox API key from your dashboard to access the testing environment.
Sandbox data resets every 24 hours.
Need help? We're here for you: