Prompt
round robin scheduling api sales team
Latest observation
Oct 15, 2026
OpenAI APIWeb search: off
Here’s a simple way to think about a round-robin scheduling API for a sales team:
What it should do
Distribute incoming leads, meetings, or tasks evenly across sales reps, in order.
Example:
- Lead 1 → Alice
- Lead 2 → Bob
- Lead 3 → Carol
- Lead 4 → Alice again
Core API features
1. Create a round-robin pool
A pool is a group of sales reps.
POST /round-robin/pools
{
"name": "SDR Team A",
"members": [
{"user_id": "u1"},
{"user_id": "u2"},
{"user_id": "u3"}
]
}
2. Assign the next rep
When a new lead comes in, call the API to get the next assigned rep.
POST /round-robin/pools/{pool_id}/assign
{
"lead_id": "lead_123"
}
Response
{
"lead_id": "lead_123",
"assigned_user_id": "u2",
"assigned_user_name": "Bob"
}
3. Update membership
Add/remove reps from the rotation.
PATCH /round-robin/pools/{pool_id}
{
"add_members": ["u4"],
"remove_members": ["u2"]
}
4. Get assignment history
Useful for auditing.
GET /round-robin/pools/{pool_id}/history
[
{
"lead_id": "lead_123",
"assigned_user_id": "u2",
"assigned_at": "2026-10-15T12:00:00Z"
}
]
Important design considerations
Fairness
- Rotate in strict order
- Skip inactive/out-of-office reps
- Optionally weight some reps more heavily
Concurrency
Two leads can come in at the same time, so the assignment must be atomic.
- Use a DB lock, transaction, or Redis counter
Availability rules
Support logic like:
- On vacation → skip
- Not available → skip
- Max daily quota reached → skip
Routing options
You may want to support:
- strict rotation
- weighted round robin
- sticky routing (same lead always goes to same rep)
- territory-based routing combined with round robin
Minimal data model
round_robin_pools
idnamecreated_at
pool_members
pool_iduser_idpositionactiveweight
assignments
idpool_idlead_iduser_idassigned_at
pool_state
pool_idlast_assigned_member_idorlast_index
Example assignment logic
- Load active members
- Find the member after the last assigned one
- If at the end, wrap to the start
- Skip unavailable members
- Save assignment atomically
If you want, I can also provide:
- a REST API spec
- a database schema
- a Python/Node.js implementation
- a Salesforce/HubSpot-style lead routing design
If you want, I can generate a full OpenAPI spec for this API.