Skip to main content

Error Reference

All API errors return a consistent JSON envelope:

{
"success": false,
"error": "Descriptive error message",
"statusCode": 400
}

Authentication Errors

ScenarioStatusTypical message
Missing x-api-key header401API key is required
Invalid or revoked API key401Invalid API key
Missing x-admin-key401Admin key is required
Invalid admin key401Invalid admin key
Expired JWT token401Token expired
Invalid JWT token401Invalid token
Insufficient permissions403Access denied
Tenant is suspended403Tenant account is suspended

Tenant & Onboarding Errors

ScenarioStatusTypical message
Tenant not found404Tenant not found
Duplicate TIN400A tenant with this TIN already exists
TIN format invalid422TIN must be between 10 and 20 characters
BRN format invalid422Business registration number must be between 5 and 50 characters
Tenant not active403Tenant is not active. Complete onboarding first

Credential Errors

ScenarioStatusTypical message
Invalid PEM certificate422Certificate must be a valid PEM-encoded certificate
Public key too short422Public key must be at least 50 characters
Missing credentials400FIRS credentials have not been configured

ERP & Validation Errors

ScenarioStatusTypical message
Unsupported ERP type422ERP type is not supported
Invalid base URL422baseUrl must be a valid URI
Transform failed422Could not map invoice fields to FIRS schema
Validation failed422Invoice failed FIRS schema validation
Invoice ID key not found422Could not locate invoice ID at path: invoice.ref

API Key Errors

ScenarioStatusTypical message
API key not found404API key not found
Key already revoked400API key has already been revoked
Revocation reason too short422Reason must be at least 5 characters

Team Errors

ScenarioStatusTypical message
User not found404Team member not found
Email already in team400A team member with this email already exists
Invalid role422Role must be one of: admin, member, viewer
Invalid invite token400Invitation token is invalid or has expired

Rate Limiting

ScenarioStatusNotes
Rate limit exceeded429Slow down — check Retry-After header

Handling Errors in Code

const response = await fetch('https://e-invoicing-staging.vercel.app/v1/tenants/', {
method: 'POST',
headers: {
'x-admin-key': process.env.ADMIN_KEY!,
'Content-Type': 'application/json',
},
body: JSON.stringify({ ... }),
});

const result = await response.json();

if (!result.success) {
console.error(`Error ${result.statusCode}: ${result.error}`);
// Handle specific error scenarios
}