BuyCarfaxBuyCarfax

BuyCarfax API Documentation

  • Getting started
  • Authentication
  • Account
  • CARFAX reports
  • AutoCheck reports
  • Record counts
  • Error responses
BuyCarfaxBuyCarfax
BuyCarfax / Vehicle recordsAPI reference / REST
Loading...

AutoCheck is a registered trademark of Experian Information Solutions, Inc. All other product names and brands are the property of their respective owners. BuyCarfax is an independent reseller and is not affiliated with, endorsed by, or sponsored by any vehicle history report provider. Product names are used only to describe the reports we sell.

Error Responses

Error Responses

How the BuyCarfax API reports errors and what to do with each code.

Error response format
Every error response uses the same JSON structure.
{
  "error": "Error Type",
  "message": "Detailed error description",
  "code": 400
}
400
Bad Request
The request is invalid or cannot be served.

Invalid VIN format

{
  "error": "Invalid VIN format",
  "message": "VIN must be 17 characters long",
  "code": 400
}

Missing required parameters

{
  "error": "Missing required parameter",
  "message": "VIN parameter is required",
  "code": 400
}
401
Unauthorized
The API key is missing or invalid.

Missing API key

{
  "error": "Unauthorized",
  "message": "API key is required",
  "code": 401
}

Invalid API key

{
  "error": "Unauthorized",
  "message": "Invalid API key",
  "code": 401
}
404
Not Found
The requested resource does not exist.

Report not found

{
  "error": "Not Found",
  "message": "Report with ID 12345 not found",
  "code": 404
}

Invalid endpoint

{
  "error": "Not Found",
  "message": "Endpoint not found",
  "code": 404
}
429
Too Many Requests
Rate limit exceeded

Rate limit exceeded

{
  "error": "Too Many Requests",
  "message": "Rate limit exceeded. Try again in 60 seconds",
  "code": 429,
  "retry_after": 60
}
500
Internal Server Error
The server hit an unexpected error.

Server error

{
  "error": "Internal Server Error",
  "message": "An unexpected error occurred",
  "code": 500
}
Handling Errors
How to handle errors in your integration

JavaScript Example

try {
  const response = await fetch('https://api.buycarfax.com/v1/user/info', {
    headers: {
      'x-api-key': 'your-api-key'
    }
  });
  
  if (!response.ok) {
    const error = await response.json();
    console.error(`Error ${error.code}: ${error.message}`);
    return;
  }
  
  const data = await response.json();
  // Handle success
} catch (error) {
  console.error('Network error:', error);
}

Error handling tips

  • Check the HTTP status code before you read the body
  • Read the error field and the message field
  • Retry 5xx responses with a short delay
  • Wait before you retry a 429 response, and increase the wait after each attempt
  • Log the status code and message for debugging