Skip to main content

Overview

Contazen uses conventional HTTP response codes to indicate the success or failure of an API request.

Error Response Format

All error responses follow a consistent structure:

Error Types

Type: authentication_errorThese errors occur when there’s a problem with your API key.Example:
Type: validation_errorThese errors occur when request parameters fail validation.Example with field-specific errors:
Type: rate_limit_errorReturned when you exceed the allowed number of requests.Example:
Check the response headers for rate limit information:
  • X-RateLimit-Limit: Maximum requests allowed
  • X-RateLimit-Remaining: Requests remaining
  • X-RateLimit-Reset: Reset time (Unix timestamp)
Type: resource_errorThese errors relate to specific resources.Example:
Type: api_errorThese indicate problems on our servers.Example:

Handling Errors

Best Practices

1

Always check the response status

Don’t assume a request succeeded. Check the HTTP status code and success field.
2

Log error details

Store the full error response, especially the request_id for debugging.
3

Handle specific error types

Implement different handling for different error types.
4

Implement retry logic

For 5xx errors and rate limits, implement exponential backoff.

Example Error Handling

Common Error Scenarios

Invalid CUI Format

Solution: Ensure CUI starts with “RO” for Romanian companies

Duplicate Invoice Number

Solution: Let the system auto-generate numbers

Missing Required Fields

Solution: Check all required fields are provided

Invalid Date Format

Solution: Use ISO 8601 date format

e-Factura Not Configured

Solution: Complete OAuth setup in settings

Invoice Already Sent to SPV

Solution: Check invoice status before sending

Cannot Delete Used Product

Solution: Products used in invoices cannot be deleted

Getting Help

If you encounter an error you can’t resolve:
  1. Check the error message and code - They provide specific information about what went wrong
  2. Review the API documentation - Ensure you’re using the correct parameters
  3. Include the request ID - Found in error responses for server errors
  4. Contact support - Email contact@contazen.ro with details