Authentication
Our API is secured using standard two-legged OAuth2. Prepared will create application credentials with scopes for the APIs required for your integration.
Getting Started
- Prepared will provide a
client_id,client_secret, andscopeper dispatch center for your integration - Before making API requests, obtain an access token using your credentials
- Include the access token in all subsequent requests
Obtaining an Access Token
Make a POST request to obtain an access token:
curl -X POST https://api.prepared911.com/oauth/token \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"grant_type": "client_credentials",
"scope": "YOUR_SCOPE"
}'
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 7200
}
Scopes Reference
Your integration will be assigned one of the following scopes based on your use case:
| Scope | Use Case | APIs Enabled |
|---|---|---|
cad_incidents | CAD providers integrating with Prepared | CAD Incidents API, CAD Webhooks |
incident_events | First responder applications accessing incident data | Incident Events API, Incident Events Webhooks |
Contact your Prepared integration team if you're unsure which scope you need.
Using Your Access Token
HTTPS Requests
Include the access token as a Bearer token in the Authorization header:
Authorization: Bearer <ACCESS_TOKEN>
Example:
curl -X GET https://api.prepared911.com/v1/incident_events \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
WebSocket Connections
For real-time data streaming, include the access token in the query parameters:
const socket = new WebSocket(`${API_WEBSOCKET_URL}?token=${accessToken}`);
WebSocket connections are primarily used for real-time incident event streaming.
WebRTC (Live Audio)
Live audio streams require a separate JWT token specific to:
- A Prepared incident ID
- A participant ID
Retrieve a stream token using the POST /v1/incident_events/{id}/stream_token endpoint, then connect using LiveKit:
import { Room } from 'livekit-client';
const room = new Room();
await room.connect(API_STREAM_URL, streamToken);
See LiveKit's documentation for more details.
WebRTC authentication is used for live audio streaming capabilities. See the Live Audio guide for more information.
Token Expiration
Access tokens expire after 2 hours (7200 seconds). Your application should:
- Store the token and reuse it for multiple requests
- Track the
expires_invalue and refresh before expiration - Handle
401 Unauthorizedresponses by obtaining a new token