Step 1: call the route
The route takes the typed text (q), one or more countries (country) and a maximum number of suggestions (limit, 1 to 20, 8 by default). Only active companies are suggested, unless you add status=any. A typed number (SIREN, SIRET or a foreign equivalent) returns its company directly.
curl "https://api.jsonpage.com/v2/autocomplete?q=danone&country=FR&limit=5" \
-H "X-API-Key: $JSONPAGE_API_KEY"
{
"data": [
{ "id": "FR-552032534", "name": "DANONE", "status": "active",
"postal_code": "…", "city": "…", "kind": "company" }
]
}
Step 2: relay the call from your server
Never call the API from the browser: the key would be visible there. Your server exposes a small address that relays the input:
async function suggestions(q) {
const url = new URL("https://api.jsonpage.com/v2/autocomplete");
url.searchParams.set("q", q);
url.searchParams.set("country", "FR");
url.searchParams.set("limit", "6");
const res = await fetch(url, { headers: { "X-API-Key": API_KEY } });
if (!res.ok) return [];
return (await res.json()).data;
}
Step 4: validate on submit
Before saving the record, a call to GET /v2/validate?id=FR-552032534 confirms the format, the existence and the active status of the company. The response is always 200; the valid field says whether all checks passed. For more, see How to check that a SIRET number is valid.
Good practice: let the user type a name freely if no suggestion fits, show the city to tell namesakes apart, and treat an API error as an empty list rather than blocking the form.
Frequently asked questions
Can I call autocomplete directly from the browser?+
It is not recommended: the API key would be visible to any visitor. Have your server relay the call.
From how many characters does the route answer?+
The input needs at least one word of 2 characters, otherwise the API returns the query_too_short error.
Can I search several countries?+
Yes. The country parameter accepts a comma-separated list of codes (FR, BE, CH, NO, LV, FI, GB). Without it, all countries are searched.
Are closed companies suggested?+
Not by default: only active companies appear. Add status=any to see every status.
Keep reading
- SIRENWhat is a SIREN number and how to find itThe 9-digit format, who gets one, where it appears and how to find a company's SIREN from its name.
- SIRETHow to check a French SIRET numberThe 14-digit format, spotting typing mistakes and the difference between a valid SIRET and an active establishment.
- COMPAREHow to choose a company data API: 8 criteriaCoverage, validation, up-to-date data, SLA, pricing, documentation, GDPR and monitoring: the grid to compare.