Quickstart
Make your first authenticated paint-code request and handle its result.
Base URL
https://api.paintcodebyreg.comCreate a key
Sign into the partner portal, open API keys, create a key and save the secret when it is shown. Your account must have API access and an active applicable entitlement. Store the key on your server, not in public browser code.
export PAINTREG_API_KEY="YOUR_API_KEY"Send a registration lookup
curl --request POST "https://api.paintcodebyreg.com/v1/lookup" \
--header "Authorization: Bearer $PAINTREG_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: docs-example-paint-001" \
--data '{"reg":"AB12CDE"}'Choose a new idempotency key for a new lookup. Keep that same key, endpoint and input when retrying the original request.
Read the result
Check the HTTP status and JSON body. A completed HTTP 200 does not necessarily contain a paint code. For a successful paint result, inspect status, paint.code, its qualifications and billing.
- HTTP 202: follow the original
request_idusing lookup status. - HTTP 400: correct the input, rather than repeating it unchanged.
- HTTP 429: respect
Retry-After. - A timeout or unknown outcome: preserve your original idempotency key; do not automatically create another billable lookup.
JavaScript / Node.js
const response = await fetch('https://api.paintcodebyreg.com/v1/lookup', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PAINTREG_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': 'docs-example-paint-001',
},
body: JSON.stringify({ reg: 'AB12CDE' }),
});
const result = await response.json();
if (response.status === 202) {
console.log('Pending:', result.request_id, result.retry_after);
} else if (!response.ok) {
console.error(response.status, result.reason ?? result.error?.code, result.detail);
} else if (result.paint?.code) {
console.log(result.paint.code, result.paint.code_status, result.billing);
} else {
console.log(result.status, result.reason, result.detail);
}Python
import os
import requests
response = requests.post(
'https://api.paintcodebyreg.com/v1/lookup',
headers={
'Authorization': 'Bearer ' + os.environ['PAINTREG_API_KEY'],
'Content-Type': 'application/json',
'Idempotency-Key': 'docs-example-paint-001',
},
json={'reg': 'AB12CDE'},
timeout=95, # client setting; a lookup can take up to 85 seconds
)
result = response.json()
if response.status_code == 202:
print('Pending:', result['request_id'], result['retry_after'])
elif not response.ok:
print(response.status_code, result.get('reason'), result.get('detail'))
elif result.get('paint') and result['paint'].get('code'):
print(result['paint']['code'], result.get('billing'))
else:
print(result.get('status'), result.get('reason'), result.get('detail'))Examples show key fields with illustrative identifiers and display values; additional fields may appear. They are not ready-made test vehicles, fresh lookup receipts or promises that a particular vehicle returns this result. Use your own authorised vehicle identifiers. See the endpoint pages for JSON response examples and the OpenAPI document for the live request contract.
