Error Handling

Comprehensive guide to handling errors in the Bevor API

The Bevor API uses conventional HTTP response codes and provides detailed error information to help you understand and resolve issues quickly.

Response Format

All error responses follow a consistent JSON structure:

{
  "message": "Human-readable error description",
  "code": "error.code"
}

You can find the possible error codes by looking the 400 responses for each endpoint or below. They'll be consistent across each endpoint, but it's a useful frame of reference.

Request Tracking

Every API request includes a unique request identifier in the response headers:

bevor-request-id: req_1234567890abcdef

This identifier is crucial for:

  • Debugging: Reference the request ID when contacting support
  • Logging: Track specific requests in your application logs
  • Support: Help our team quickly locate and resolve issues

Using Request IDs

Always capture and log the bevor-request-id header for error responses:

fetch('https://api.bevor.io/v1/scan', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    contract_address: '0x...',
    network: 'ethereum'
  })
})
.then(response => {
  const requestId = response.headers.get('bevor-request-id');
  
  if (!response.ok) {
    return response.json().then(error => {
      console.error(`Request ${requestId} failed:`, error);
      throw new Error(`${error.message} (Request ID: ${requestId})`);
    });
  }
  
  return response.json();
})
.catch(error => {
  console.error('Request failed:', error);
});

Getting Help

If you encounter errors that aren't covered in this documentation:

  1. Check the request ID: Include the bevor-request-id in your support request
  2. Review your request: Ensure all required parameters are provided correctly
  3. Contact support: Reach out to support@bevor.io with:
    • The error message and code
    • The request ID
    • Your API key (for authentication issues)
    • Steps to reproduce the error

Error Codes

Errors are returned with a code specific to Bevor, as well as an optional human readable message, and an optional extra property to help with debugging.

On this page