Skip to content

Error Handling

When a request fails, the API returns an appropriate HTTP status code and an error object in the response body.

{
"error": {
"code": "not_found",
"title": "Vitals Link not found"
}
}
StatusMeaningCommon causes
400Bad RequestInvalid input, expired link, disabled link, max scans reached, insufficient credits
401UnauthorizedMissing or invalid API key
404Not FoundResource does not exist or does not belong to your business
409ConflictPatient with this email already exists (when using mode: "create")

The SDK throws UpvioApiRequestError for non-2xx responses. The error includes status and statusText properties.

import {
UpvioApiClient,
UpvioApiRequestError,
} from '@upvio/sdk-node'
const client = new UpvioApiClient({
apiKey: process.env.UPVIO_API_KEY,
businessId: process.env.UPVIO_BUSINESS_ID,
})
try {
const { data: scan } =
await client.v1.vitals.scans.retrieve('invalid-id')
} catch (error) {
if (error instanceof UpvioApiRequestError) {
console.error(error.status) // 404
console.error(error.statusText) // "Not Found"
}
}
ScenarioStatusTitle
API key missing or invalid401Unauthorized
Scan link is expired400Link has expired
Scan link is disabled400Link is disabled
Scan link reached max scans400Maximum scans reached
Insufficient scan credits400Insufficient credits
Duplicate patient email with mode: "create"409A patient with this email already exists
Resource not found404{Resource} not found