People API
Create, update, and manage user profiles with the Flameup People API
Overview
The People API allows you to manage user profiles in Flameup. Each person represents a user in your system with their contact information, attributes, and engagement history.
people:read for GET requests, people:write for POST/PUT requests, people:delete for DELETE requests.Person Object
A person in Flameup has the following structure:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"workspace_id": "ws_abc123",
"userId": "user_12345",
"email": "jane@example.com",
"traits": {
"first_name": "Jane",
"last_name": "Doe",
"plan": "premium",
"company": "Acme Inc"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z"
}
Field Reference
| Field | Type | Description |
|---|---|---|
id | UUID | Flameup's internal identifier (read-only) |
workspace_id | string | Workspace identifier (read-only) |
userId | string | Your unique identifier for this user (required, max 255 chars) |
email | string | User's email address (optional, max 254 chars) |
anonymousId | string | Anonymous identifier for merging anonymous activity (transient, not persisted) |
traits | object | Custom user attributes (see validation rules) |
created_at | timestamp | When the person was created (read-only) |
updated_at | timestamp | When the person was last updated (read-only) |
Create a Person
Create a new person profile.
Endpoint: POST /api/v1/workspaces/{workspace_id}/people
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
userId: 'user_12345', // Required: your unique ID
email: 'jane@example.com', // Optional but recommended
traits: {
first_name: 'Jane',
last_name: 'Doe',
plan: 'premium',
company: 'Acme Inc'
}
})
}
);
const person = await response.json();
response = requests.post(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people',
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
},
json={
'userId': 'user_12345',
'email': 'jane@example.com',
'traits': {
'first_name': 'Jane',
'last_name': 'Doe',
'plan': 'premium',
'company': 'Acme Inc'
}
}
)
person = response.json()
curl -X POST "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"userId": "user_12345",
"email": "jane@example.com",
"traits": {
"first_name": "Jane",
"last_name": "Doe",
"plan": "premium",
"company": "Acme Inc"
}
}'
userId. Database primary keys or UUIDs work well.Get a Person
Retrieve a person by their Flameup ID.
Endpoint: GET /api/v1/workspaces/{workspace_id}/people/{person_id}
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/${personId}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
const person = await response.json();
response = requests.get(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/{person_id}',
headers={'Authorization': f'Bearer {API_KEY}'}
)
person = response.json()
curl "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/{person_id}" \
-H "Authorization: Bearer your_api_key"
Update a Person
Update an existing person's attributes.
Endpoint: PUT /api/v1/workspaces/{workspace_id}/people/{person_id}
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/${personId}`,
{
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
traits: {
plan: 'enterprise', // Update existing
renewal_date: '2025-01-15' // Add new attribute
}
})
}
);
const person = await response.json();
response = requests.put(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/{person_id}',
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
},
json={
'traits': {
'plan': 'enterprise',
'renewal_date': '2025-01-15'
}
}
)
person = response.json()
curl -X PUT "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/{person_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"traits": {
"plan": "enterprise",
"renewal_date": "2025-01-15"
}
}'
null.Upsert a Person
Create a person if they don't exist, or update them if they do. This is the recommended approach for most integrations.
Endpoint: POST /api/v1/workspaces/{workspace_id}/people/upsert
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/upsert`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
userId: 'user_12345',
email: 'jane@example.com',
traits: {
first_name: 'Jane',
last_name: 'Doe',
last_login: new Date().toISOString()
}
})
}
);
const result = await response.json();
console.log('Was created:', result.was_created); // true if new, false if updated
response = requests.post(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/upsert',
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
},
json={
'userId': 'user_12345',
'email': 'jane@example.com',
'traits': {
'first_name': 'Jane',
'last_name': 'Doe',
'last_login': datetime.utcnow().isoformat()
}
}
)
result = response.json()
print(f"Was created: {result['was_created']}")
curl -X POST "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/upsert" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"userId": "user_12345",
"email": "jane@example.com",
"traits": {
"first_name": "Jane",
"last_name": "Doe",
"last_login": "2024-01-20T14:45:00Z"
}
}'
The response includes a was_created boolean indicating whether the person was newly created or updated.
List People
Retrieve a paginated list of people.
Endpoint: GET /api/v1/workspaces/{workspace_id}/people
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 50 | Number of results (max 500) |
offset | integer | 0 | Pagination offset |
status | string | - | Filter by status: active, unsubscribed, bounced |
search | string | - | Search by name or email |
created_since | timestamp | - | Filter by creation date |
updated_since | timestamp | - | Filter by last update date |
const params = new URLSearchParams({
limit: '50',
status: 'active',
search: 'acme'
});
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people?${params}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
const { people, total, limit, offset } = await response.json();
response = requests.get(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people',
headers={'Authorization': f'Bearer {API_KEY}'},
params={
'limit': 50,
'status': 'active',
'search': 'acme'
}
)
data = response.json()
people = data['people']
total = data['total']
curl "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people?limit=50&status=active&search=acme" \
-H "Authorization: Bearer your_api_key"
Response:
{
"people": [...],
"total": 1250,
"limit": 50,
"offset": 0
}
Search People
Search for people by specific criteria.
Endpoint: GET /api/v1/workspaces/{workspace_id}/people/search
Query Parameters
| Parameter | Type | Description |
|---|---|---|
q | string | General search query |
email | string | Exact email match |
userId | string | Exact userId match |
limit | integer | Number of results (default 10) |
// Search by email
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/search?email=jane@example.com`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
const { people } = await response.json();
const person = people[0]; // First match
# Search by userId
response = requests.get(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/search',
headers={'Authorization': f'Bearer {API_KEY}'},
params={'userId': 'user_12345'}
)
data = response.json()
person = data['people'][0] if data['people'] else None
curl "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/search?email=jane@example.com" \
-H "Authorization: Bearer your_api_key"
Batch Upsert
Create or update multiple people in a single request (max 100).
Endpoint: POST /api/v1/workspaces/{workspace_id}/people/batch
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/batch`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
people: [
{
userId: 'user_001',
email: 'alice@example.com',
traits: { first_name: 'Alice', plan: 'basic' }
},
{
userId: 'user_002',
email: 'bob@example.com',
traits: { first_name: 'Bob', plan: 'premium' }
},
// ... up to 100 people
]
})
}
);
const { people, created_count, updated_count } = await response.json();
response = requests.post(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/batch',
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {API_KEY}'
},
json={
'people': [
{
'userId': 'user_001',
'email': 'alice@example.com',
'traits': {'first_name': 'Alice', 'plan': 'basic'}
},
{
'userId': 'user_002',
'email': 'bob@example.com',
'traits': {'first_name': 'Bob', 'plan': 'premium'}
}
]
}
)
result = response.json()
print(f"Created: {result['created_count']}, Updated: {result['updated_count']}")
curl -X POST "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/batch" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"people": [
{"userId": "user_001", "email": "alice@example.com", "traits": {"first_name": "Alice"}},
{"userId": "user_002", "email": "bob@example.com", "traits": {"first_name": "Bob"}}
]
}'
Delete a Person
Delete a person and all associated data.
Endpoint: DELETE /api/v1/workspaces/{workspace_id}/people/{person_id}
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/${personId}`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
if (response.ok) {
console.log('Person deleted');
}
response = requests.delete(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/{person_id}',
headers={'Authorization': f'Bearer {API_KEY}'}
)
if response.status_code == 204:
print('Person deleted')
curl -X DELETE "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/{person_id}" \
-H "Authorization: Bearer your_api_key"
Get Person Events
Retrieve events for a specific person.
Endpoint: GET /api/v1/workspaces/{workspace_id}/people/{person_id}/events
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/${personId}/events?limit=50`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
const { events } = await response.json();
response = requests.get(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/{person_id}/events',
headers={'Authorization': f'Bearer {API_KEY}'},
params={'limit': 50}
)
events = response.json()['events']
curl "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/{person_id}/events?limit=50" \
-H "Authorization: Bearer your_api_key"
Get People Statistics
Get aggregate statistics for your workspace.
Endpoint: GET /api/v1/workspaces/{workspace_id}/people/stats
const response = await fetch(
`https://api.flameup.ai/api/v1/workspaces/${WORKSPACE_ID}/people/stats`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
const stats = await response.json();
console.log(`Total: ${stats.total}, Active: ${stats.active}`);
response = requests.get(
f'https://api.flameup.ai/api/v1/workspaces/{WORKSPACE_ID}/people/stats',
headers={'Authorization': f'Bearer {API_KEY}'}
)
stats = response.json()
print(f"Total: {stats['total']}, Active: {stats['active']}")
curl "https://api.flameup.ai/api/v1/workspaces/{workspace_id}/people/stats" \
-H "Authorization: Bearer your_api_key"
Response:
{
"total": 15420,
"active": 14200,
"unsubscribed": 850,
"bounced": 370,
"recent": 245
}
Best Practices
The upsert endpoint is ideal for most use cases. It handles both creation and updates in a single call, making your integration simpler and more resilient.
Last updated today