Distance Prefill Service
API Contract
REST
/api/v1/distance-prefill
5 endpoints
GET
/api/v1/distance-prefill/api/v1/distance-prefill
List all cached distance prefill entries (admin use). Supports pagination.
Public
Response Example
{
"data": [
{
"user_id": "usr_abc123",
"last_used_distance_km": 42.5,
"cached_at": "2026-03-25T14:30:00Z"
},
{
"user_id": "usr_def456",
"last_used_distance_km": 18,
"cached_at": "2026-03-20T09:10:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 2
}
}
GET
/api/v1/distance-prefill/api/v1/distance-prefill/:userId
Read the last used distance for a specific user from local cache.
Public
Response Example
{
"user_id": "usr_abc123",
"last_used_distance_km": 42.5,
"cached_at": "2026-03-25T14:30:00Z"
}
POST
/api/v1/distance-prefill/api/v1/distance-prefill
Save a new last-used distance entry for a user after a successful submission.
Public
Request Example
{
"user_id": "usr_abc123",
"distance_km": 42.5
}
Response Example
{
"user_id": "usr_abc123",
"last_used_distance_km": 42.5,
"cached_at": "2026-03-25T14:30:00Z"
}
PUT
/api/v1/distance-prefill/api/v1/distance-prefill/:userId
Overwrite the cached distance for a user.
Public
Request Example
{
"distance_km": 55
}
Response Example
{
"user_id": "usr_abc123",
"last_used_distance_km": 55,
"cached_at": "2026-03-25T15:45:00Z"
}
DELETE
/api/v1/distance-prefill/api/v1/distance-prefill/:userId
Clear the cached distance for a user (e.g. on logout or explicit cache invalidation).
Public
Response Example
{
"user_id": "usr_abc123",
"cleared": true,
"cleared_at": "2026-03-25T16:00:00Z"
}