CarsXE Vehicle Data API Documentation
website·Indexed 33 days ago
https://docs.carsxe.comOfficial documentation for the CarsXE Vehicle Data API, featuring guides on VIN decoding, vehicle specifications, and ownership lookups. Includes specialized resources for AI agents, such as an MCP server for AI tools, agentic payment flows using HTTP 402, and machine-readable documentation via llms.txt.
What's inside CarsXE
- CarsXE provides official integrations to connect vehicle data into AI agents, data platforms, data warehouses, and no-code automation platforms. Depending on the use case, users can utilize the Model Context Protocol (MCP) for AI tools, dedicated SDKs for custom development, or the general integrations suite.
Integrate CarsXE with AI editors using the MCP server
The CarsXE MCP server is the recommended integration path for interactive AI editors and chat clients such as Claude Desktop, Cursor, VS Code, and Windsurf. This server exposes all CarsXE endpoints as named tools and automatically formats responses as Markdown for the AI agent.Interpret the 402 Payment Required response body
When a402error is returned due to insufficient credits, the response body provides details about the credit deficit.{ "success": false, "message": "Insufficient credits. Add credits or enable auto-recharge to continue.", "credits": { "available": 12, // Credits in the wallet when the request was checked "cost": 25, // Credits this request would have consumed (per-call cost × units) "remaining": 12 // Credits left after the attempt (unchanged from available for denied requests) } }Process Vehicle Recalls in Batch using x402
To process vehicle recalls in batch via the x402 payment flow, submit a JSON array of
vinsto/v1/recalls-batch/submit.Billing Logic: Duplicate VINs are normalized and charged only once. The total cost is calculated as the current per-VIN starter price multiplied by the count of unique VINs.
Retrieving Results:
- A successful submission returns a
202response containing adata.batchToken. - This token must be kept secret and used in the
X-CarsXE-Batch-Tokenheader for subsequent requests to retrieve status, results, or downloads. - Follow-up calls using the batch token do not require additional x402 payments.
# Example: Checking the status of a batch request curl -G "https://api.carsxe.com/v1/recalls-batch/status" \ -d batchId=brb_mnablbn7_wvbaqv \ -H "X-CarsXE-Batch-Token: <batch-token>"- A successful submission returns a
Implement best practices for agentic vehicle data workflows
When implementing agentic workflows for vehicle payments and data retrieval, follow these architectural guidelines:
- Identifier Management: Pass identifiers explicitly between API calls. For example, if a license plate lookup returns a VIN, use that specific VIN for all subsequent VIN-based product requests.
- Error Handling: If identifiers are missing or ambiguous, branch your logic to handle the gap rather than sending an invalid request to a downstream endpoint.
- Data Availability: Handle 'unavailable-data' responses according to the specific product guide for that endpoint.
- Scaling: Use asynchronous batch products when dealing with large inventories and strictly adhere to defined rate limits and quotas.
- Caching Strategy: Cache stable vehicle identity data to improve performance, but ensure time-sensitive data (such as market value or active recalls) is refreshed based on business requirements.
Implement the CarsXE Agentic Payment retry flow
When an AI agent encounters a
402 Payment Requiredresponse from the CarsXE API, it must follow these specific constraints to successfully complete the paid retry:- Remove API Keys: Do not include the
keyparameter when making the request for the x402 payment flow. - Maintain Parameter Consistency: Ensure all request parameters remain identical between the initial unpaid request and the subsequent paid retry.
- Extract Payment Details: Parse the
402response body to determine the current price and the required network for payment. - Use Correct Endpoint: Use the exact endpoint path specified in the payment requirement provided by the API.
- Deliver Final Result: Once the paid retry succeeds, return the resulting CarsXE API data directly to the end user.
- Remove API Keys: Do not include the
Increase API usage limits and volume
To increase the included volume for API calls, users can take the following actions based on their needs:
- Upgrade Tier: Move to a higher plan to increase the included volume across all APIs. Refer to the pricing page for plan comparisons.
- Enable Overage Billing: Prevent API blocks by enabling overage billing. Usage exceeding the included volume is billed at the current tier's rate (calculated per call or per result, depending on the specific API).
- Enterprise Plan: For high or spiky volume requirements, Enterprise plans provide custom quotas, custom pricing, and consolidated monthly invoicing.
Implement error handling and retries for CarsXE API
When making requests to the CarsXE API, you should branch your error handling based on the HTTP status code category.
- 4xx Errors (Client Errors): Do not retry. These errors (including
429Too Many Requests/Quota exceeded) indicate a problem with the request or account quota that requires a manual fix or plan upgrade. - 5xx Errors (Server Errors): Implement exponential backoff. These are transient server-side issues where retrying after a delay may succeed.
Recommended strategy: Check
response.okor the status code first, then apply exponential backoff only for status codes $\ge 500$.import { CarsXE } from "carsxe-api"; const carsxe = new CarsXE("YOUR_API_KEY"); async function carsxeRequest(vin, { retries = 3 } = {}) { for (let attempt = 0; attempt <= retries; attempt++) { try { return await carsxe.specs({ vin }); } catch (error) { // 4xx: fix the request (or your quota) — retrying won't help if (error.statusCode < 500) throw error; // 5xx: exponential backoff if (attempt < retries) { await new Promise((r) => setTimeout(r, 2 ** attempt * 1000)); } } } throw new Error("CarsXE request failed after retries"); }- 4xx Errors (Client Errors): Do not retry. These errors (including
Implement a Plate-to-Quote or Appraisal workflow
To start an insurance quote, trade-in form, or appraisal using a license plate instead of a manually entered VIN, follow this sequence of API calls:
- Collect the vehicle's plate and its associated state, province, or country.
- Use the Plate Decoder to retrieve the VIN.
- Use the Specifications API to decode the retrieved VIN and confirm the vehicle's identity and equipment.
- Send the VIN, mileage, state, and condition to the Market Value API to determine the vehicle's value.
- (Optional) Integrate the Recalls API if safety status is required for the quote or appraisal decision.
Critical Constraint: Never make valuation or underwriting decisions based solely on a plate response if the workflow requires a VIN. Always validate the resolved identity and implement a fallback path for cases where the Plate Decoder cannot return a VIN.
Plate Decoder -> Specifications -> Market Value `-> Recalls (optional)Connect CarsXE MCP server to Google Agent Development Kit (ADK)
You can connect the CarsXE MCP server to Google ADK agents using a single remote endpoint.Automate CarsXE workflows with n8n
Integrate CarsXE into n8n workflows using the official CarsXE community node to automate vehicle-related tasks.Perform vehicle assessment and valuation
Retrieve market valuations, ownership histories, and active safety recall information to support purchasing and servicing decisions.