Skip to main content

Errors

When a request fails, Vetrol returns a JSON error object with details about what went wrong.

Error object

{
"error": "invalid_parameter",
"message": "The 'to' phone number is not a valid E.164 number.",
"status": 400,
"code": 21211,
"more_info": "https://developers.vetrol.io/docs/errors/21211"
}
FieldDescription
errorMachine-readable error type
messageHuman-readable description
statusHTTP status code
codeVetrol-specific error code
more_infoLink to detailed documentation

Common error codes

CodeHTTP StatusDescription
20003401Authentication failure
20404404Resource not found
20429429Rate limit exceeded
21211400Invalid phone number
21408400Permission to send to this region is not enabled
30001400Queue overflow

Handling errors

try {
const message = await client.messages.create({ ... });
} catch (error) {
if (error.status === 429) {
// Handle rate limiting — back off and retry
console.error('Rate limited:', error.message);
} else if (error.status === 400) {
console.error('Bad request:', error.message, 'Code:', error.code);
} else {
throw error;
}
}