We offer Average Facility “Registration to Treatment Area” Wait Estimates on a per-facility basis.
Overview
Using the endpoint below, the estimated wait time can be retrieved by Facility ID.
This will return the lower and upper bound estimates for the length of time for a patient to move from registration to treatment area at a specific facility.
The lower and upper bound estimates represent the 50th and 90th quantiles of our wait time estimates.
The lower and upper bound estimates are rounded to the nearest 5 minutes, to match the wait time estimates shown in ERAdvisor.
Wait time estimates are cached for 2 minutes.
API Endpoint
https://api.vital.io/graphql
Required IDs
You will require the following IDs to use this endpoint (these will be provided to you by Vital):
facility-idclient-idclient-secret
Authentication
We are using the Client Credentials Flow for authentication and authorization.
Your Client ID and Client Secret will be provided to you by the Vital team.
Your application sends your credentials (Client ID and Client Secret) to the Auth0 Authorization Server.
The Auth0 Authorization Server validates your application's credentials, and responds with an access token.
Your application can then use the access token to call the API, which will then respond with the requested data.
Access tokens will be valid for 60 minutes.
Exchanging Client Credentials for an Access Token
You can execute a client credentials exchange to get an access-token to query the Wait Times API. Here are a few examples in different languages.
cURL
curl --request POST \ --url https://vital-software.us.auth0.com/oauth/token \ --header 'content-type: application/json' \ --data '{"client_id":"<client-id>","client_secret":"<client-secret>","audience":"https://api.vital.io","grant_type":"client_credentials"}'Node.js
const response = await fetch('https://vital-software.us.auth0.com/oauth/token', { method: 'POST', body: new URLSearchParams({ grant_type: 'client_credentials', audience: 'https://api.vital.io', client_id: '<client-id>', client_secret: '<client-secret>', }), }) console.log(await response.text())Response
You'll receive an HTTP 200 response with a payload containing access_token and token_type values:
{ "access_token":"eyJz93a...k4laUWw", "expires_in": 86400, "token_type":"Bearer", }API Request/Response
Wait Times API Request
You can then use this access_token with an Authorization Header in your request to obtain authorized access to the Wait Times API.
Below are two examples using Node.js and GraphQL.
Node.js
const response = await fetch('https://api.vital.io/graphql', { method: 'POST', headers: { 'content-type': 'application/json', authorization: '<access-token>', }, body: JSON.stringify({ query: query Facility($id: String!) { facility(id: $id) { id waitTimes { registrationToTreatmentArea { estimatedLowerBoundMinutes estimatedUpperBoundMinutes } } } }, variables: { id: '<facility-id>' }, }), }) console.log(await response.text())GraphQL
Query:
query Facility($id: String!) { facility(id: $id) { id waitTimes { registrationToTreatmentArea { estimatedLowerBoundMinutes estimatedUpperBoundMinutes } } } }Query variables:
{ "id": "<facility-id>" }HTTP headers:
{ "authorization": "<access-token>" }Wait Times API Response
You will receive a response with the wait times data in the following format:
{ "data": { "facility": { "id":"<facility-id>", "waitTimes": { "registrationToTreatmentArea": { "estimatedLowerBoundMinutes": 25, "estimatedUpperBoundMinutes": 90 } } } } }
