Jsonpage · SIREN and SIRET API

Add company autocomplete to a form

To suggest companies while the user types, call GET /v2/autocomplete from your server from 2 characters, display the name, postcode and city, then save the chosen identifier. The tutorial follows these three steps, with validation of the number on submit.

01 / CALL

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" }
  ]
}
CompanyEXAMPLE
boulang
  • EXEMPLE BOULANGERIE DU PARCVERSAILLES (78000)
  • EXEMPLE BOULANGERIE MARTINLYON (69003)
{
  "data": [
    {
      "id": "FR-123456782",
      "name": "EXEMPLE BOULANGERIE DU PARC",
      "status": "active",
      "postal_code": "78000",
      "city": "VERSAILLES",
      "kind": "company"
    },
    {
      "id": "FR-234567891",
      "name": "EXEMPLE BOULANGERIE MARTIN",
      "status": "active",
      "postal_code": "69003",
      "city": "LYON",
      "kind": "company"
    }
  ]
}
On the left, the list shown while typing; on the right, the response of GET /v2/autocomplete that your server relays. Fictitious companies.
Try autocomplete for freeThe Discovery plan includes autocomplete with 30 requests per minute, no credit card. See Pricing or the route documentation.
02 / SERVER

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;
}
04 / VALIDATION

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.

05 / FREQUENTLY ASKED QUESTIONS

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.

06 / RELATED RESOURCES

Keep reading

Check it now

Check a SIREN or find a company's number

Type a SIREN, a SIRET or the name of a French company.

3 free checks a day, no account needed.

TRY IT

Try it on your own numbers

The free account gives access to the company record, validation and name search: 30 requests per minute, no credit card.