State Update
Use this endpoint to report trip progress timestamps to VectorCare.
POST
https://hub.vectorcare.com/openapi/v2.0/requests/{request_id}/state/
Note: URLs must include the trailing slash.
How It Works
Section titled “How It Works”This endpoint records when specific events occurred during a trip. You provide a state name and the timestamp when that state happened.
Request Body
Section titled “Request Body”{ "name": "en_route", "timestamp": "2025-01-15T14:30:00Z"}| Field | Type | Description |
|---|---|---|
name | string | State value (see table below) |
timestamp | string | ISO 8601 UTC timestamp when the state occurred |
Available States
Section titled “Available States”| State | Value | Description |
|---|---|---|
| En Route | en_route | En route to pickup location |
| Arrived | arrived | Arrived at pickup location |
| On Board | on_board | Patient on board at pickup location |
| Arrived at Destination | arrived_at_destination | Arrived at destination |
| Completed | completed | Trip complete |
| Canceled | canceled | Trip canceled (any reason) |
| Dry Run | dry_run | Trip canceled at pickup location |
State Flow
Section titled “State Flow”A typical trip progresses through states in order:
en_route → arrived → on_board → arrived_at_destination → completedHowever, any trip can also end with:
canceled- Trip canceled before completiondry_run- Trip canceled after arriving at pickup (patient not available, etc.)
Example
Section titled “Example”curl -X POST "https://hub.vectorcare.com/openapi/v2.0/requests/KP-ABCD1234/state/" \ -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9..." \ -H "Content-Type: application/json" \ -d '{ "name": "en_route", "timestamp": "2025-01-15T14:30:00Z" }'Success (201 Created)
Section titled “Success (201 Created)”{ "name": "en_route", "timestamp": "2025-01-15T14:30:00Z"}Timestamp Rules
Section titled “Timestamp Rules”- Must be in ISO 8601 format with UTC timezone (e.g.,
2025-01-15T14:30:00Z) - Cannot be in the future
- Must be within 7 days of the current time
Errors
Section titled “Errors”| Status | Cause |
|---|---|
| 400 | Invalid state name, timestamp in future, or timestamp too old |
| 401 | Invalid or expired token |
| 404 | Request not found |