Skip to content

Authentication

VectorCare implements the OAuth2 protocol for authenticating applications. You must obtain an access token before making API requests.

POST https://auth.vectorcare.com/v2.0/oauth2/token

Send a POST request with form-data body:

FieldValueDescription
client_idYour client IDGenerated in VectorCare Open API settings
client_secretYour client secretGenerated in VectorCare Open API settings
grant_typeclient_credentialsAlways use this value
Terminal window
curl -X POST https://auth.vectorcare.com/v2.0/oauth2/token \
-d "client_id=your_client_id" \
-d "client_secret=your_client_secret" \
-d "grant_type=client_credentials"
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"token_type": "bearer",
"expires_in": 3600
}
FieldTypeDescription
access_tokenstringJWT token for API requests
token_typestringAlways bearer
expires_inintegerToken lifetime in seconds (typically 3600)
{
"error_description": "Client authentication failed.",
"error": "invalid_client"
}

Include the token in the Authorization header for all API requests:

Terminal window
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"}'

The expires_in field indicates when the token will expire (typically 1 hour). Proactively refresh your token before expiration to avoid 401 Unauthorized errors.

Recommended approach:

  1. Store the token and its expiration time
  2. Request a new token when ~80% of the lifetime has elapsed
  3. Retry failed requests with a fresh token if you receive a 401
  1. Log into VectorCare as an organization admin
  2. Navigate to SettingsOpen API
  3. Click Generate Credentials
  4. Store your client_id and client_secret securely