-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
Complete reference for all FieldOpt API endpoints.
Base URL: http://localhost:8000/api/v1
Currently: No authentication (development mode)
Coming in v0.0.9: JWT tokens and role-based access control
List all technicians
Response:
[
{
"id": 1,
"name": "Miles Davis",
"status": "available",
"phone": "555-0101",
"skills": ["install", "repair"],
"capacity": 4,
"current_workload": 2
}
]Get a specific technician by ID
Response:
{
"id": 1,
"name": "Miles Davis",
"status": "available",
"phone": "555-0101",
"skills": ["install", "repair"],
"capacity": 4,
"current_workload": 2
}Create a new technician
Request:
{
"name": "John Coltrane",
"phone": "555-0102",
"status": "available",
"skills": ["repair", "maintenance"]
}Response: Created technician object (HTTP 201)
Update technician status
Request:
{
"status": "on_break"
}Valid statuses: available, on_break, assigned, off_duty
Update technician location
Request:
{
"latitude": 40.7128,
"longitude": -74.0060
}List all jobs with optional filters
Query parameters:
-
scheduled_date— YYYY-MM-DD format -
status— pending, assigned, in_progress, completed, failed -
type— install, repair, maintenance, disconnect, service_change, inspection
Example:
GET /jobs/?scheduled_date=2026-04-15&status=pending
Response:
[
{
"id": 1,
"type": "install",
"customer": "Acme Corp",
"address": "123 Main St, NYC",
"skills_required": ["install"],
"status": "pending",
"scheduled_date": "2026-04-15",
"time_slot": "08:00-12:00",
"assigned_technician": null
}
]Get a specific job
Create a new job
Request:
{
"type": "install",
"customer": "Acme Corp",
"address": "123 Main St, NYC",
"scheduled_date": "2026-04-15",
"time_slot": "08:00-12:00",
"skills_required": ["install", "service_change"]
}Update job details
Request:
{
"status": "in_progress",
"customer": "Updated Name"
}Mark job as in_progress
Mark job as completed
Mark job as cancelled
Get summary statistics
Response:
{
"total_jobs": 42,
"pending": 15,
"assigned": 18,
"in_progress": 5,
"completed": 4,
"failed": 0
}Create a single assignment (assign job to tech)
Request:
{
"job_id": 1,
"technician_id": 1
}Response:
{
"id": 1,
"job_id": 1,
"technician_id": 1,
"assigned_at": "2026-04-11T14:30:00Z"
}Assign multiple jobs to one technician
Request:
{
"job_ids": [1, 2, 3, 4],
"technician_id": 1
}Response:
{
"assigned_count": 4,
"assignments": [
{ "job_id": 1, "technician_id": 1 },
{ "job_id": 2, "technician_id": 1 },
{ "job_id": 3, "technician_id": 1 },
{ "job_id": 4, "technician_id": 1 }
]
}Unassign multiple jobs
Request:
{
"job_ids": [1, 2, 3]
}Unassign a single job
Request:
{
"job_id": 1
}Reassign job to a different tech
Request:
{
"job_id": 1,
"new_technician_id": 2
}Get all assignments for a technician
Response:
[
{
"job_id": 1,
"technician_id": 5,
"assigned_at": "2026-04-11T08:00:00Z"
}
]Get assignment for a job
Find the best technician for a job
Request:
{
"job_id": 1
}Response:
{
"job_id": 1,
"recommended_technician": {
"id": 2,
"name": "Chet Baker",
"skills": ["install", "repair"],
"capacity_available": true,
"match_score": 0.95
}
}Alias for auto-route (GET version)
Check if a technician can do a job
Response:
{
"can_do": true,
"tech_id": 1,
"job_id": 1,
"missing_skills": []
}If can_do is false, missing_skills will list required skills the tech doesn't have.
All errors return standard HTTP status codes:
400 Bad Request — Invalid input
{
"detail": "Invalid request body"
}404 Not Found — Resource doesn't exist
{
"detail": "Job not found"
}409 Conflict — Operation conflicts with current state
{
"detail": "Technician already has maximum capacity"
}500 Internal Server Error — Server error
{
"detail": "Internal server error"
}Currently: No rate limiting (development)
Coming in v0.0.9: Standard rate limits to prevent abuse
curl -X POST http://localhost:8000/api/v1/jobs/ \
-H "Content-Type: application/json" \
-d '{
"type": "install",
"customer": "Test Co",
"address": "456 Oak Ave, NYC",
"skills_required": ["install"],
"time_slot": "10:00-14:00"
}'curl http://localhost:8000/api/v1/technicians/curl -X POST http://localhost:8000/api/v1/assignments/ \
-H "Content-Type: application/json" \
-d '{
"job_id": 1,
"technician_id": 1
}'curl -X POST http://localhost:8000/api/v1/assignments/batch-assign \
-H "Content-Type: application/json" \
-d '{
"job_ids": [1, 2, 3, 4, 5],
"technician_id": 1
}'curl -X POST http://localhost:8000/api/v1/routing/auto-route \
-H "Content-Type: application/json" \
-d '{ "job_id": 1 }'curl http://localhost:8000/api/v1/jobs/1/can-do/1- 200 OK — Successful GET/PATCH request
- 201 Created — Successful POST request (resource created)
- 204 No Content — Successful operation with no response body
- 400 Bad Request — Invalid input
- 404 Not Found — Resource not found
- 409 Conflict — Operation conflicts with state
- 500 Internal Server Error — Server error
FieldOpt Wiki
Resources