CityDate API — Find a birth locality by postcode

Support DQE
Support DQE
  • Updated
CityDate API - BirthLocality

The BirthLocality endpoint retrieves French localities matching a search term at a given date.

Related CityDate documentation - The BirthLocality endpoint searches for localities by name or INSEE code. Looking for a birthdate validity check on a known city instead?
API - Description - CityDate - CPFRA →
CityDate introduction →

BirthLocality

Request

Both GET and POST are supported.

{SERVER_ADDRESS} and {LICENCE_CODE} are provided by DQE upon account creation. Contact your DQE account manager to obtain these credentials.
GEThttps://{SERVER_ADDRESS}/BirthLocality/?BirthDate={DATE}&Search={LOOKUP}&Licence={LICENCE_CODE}&NbMax={NB_MAX}

Code examples

Search by locality name

curl "https://{SERVER_ADDRESS}/BirthLocality/?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/BirthLocality/?" + new URLSearchParams({ BirthDate: "1980-05-15", Search: "PARIS", Licence: "{LICENCE_CODE}" })) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.get( "https://{SERVER_ADDRESS}/BirthLocality/", params={ "BirthDate": "1980-05-15", "Search": "PARIS", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $params = http_build_query([ 'BirthDate' => '1980-05-15', 'Search' => 'PARIS', 'Licence' => '{LICENCE_CODE}', ]); $ch = curl_init("https://{SERVER_ADDRESS}/BirthLocality/?{$params}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); axios.get('https://{SERVER_ADDRESS}/BirthLocality/', { params: { BirthDate: '1980-05-15', Search: 'PARIS', Licence: '{LICENCE_CODE}' } }) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String url = "https://{SERVER_ADDRESS}/BirthLocality/" + "?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .GET() .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var url = "https://{SERVER_ADDRESS}/BirthLocality/" + "?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"; var response = await client.GetAsync(url); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" ) func main() { url := "https://{SERVER_ADDRESS}/BirthLocality/" + "?BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}" resp, err := http.Get(url) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }
POSThttps://{SERVER_ADDRESS}/BirthLocality/

Add the following parameters in the request body using x-www-form-urlencoded. The server address remains in the URL.

Code examples

Search by locality name

curl -X POST "https://{SERVER_ADDRESS}/BirthLocality/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "BirthDate=1980-05-15" \ -d "Search=PARIS" \ -d "Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/BirthLocality/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ BirthDate: "1980-05-15", Search: "PARIS", Licence: "{LICENCE_CODE}" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/BirthLocality/", data={ "BirthDate": "1980-05-15", "Search": "PARIS", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/BirthLocality/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'BirthDate' => '1980-05-15', 'Search' => 'PARIS', 'Licence' => '{LICENCE_CODE}', ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); const qs = require('querystring'); axios.post('https://{SERVER_ADDRESS}/BirthLocality/', qs.stringify({ BirthDate: '1980-05-15', Search: 'PARIS', Licence: '{LICENCE_CODE}' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "BirthDate=1980-05-15&Search=PARIS&Licence={LICENCE_CODE}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/BirthLocality/")) .header("Content-Type", "application/x-www-form-urlencoded") .POST(HttpRequest.BodyPublishers.ofString(form)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var form = new Dictionary<string, string> { ["BirthDate"] = "1980-05-15", ["Search"] = "PARIS", ["Licence"] = "{LICENCE_CODE}" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/BirthLocality/", new FormUrlEncodedContent(form)); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" "net/url" ) func main() { form := url.Values{} form.Set("BirthDate", "1980-05-15") form.Set("Search", "PARIS") form.Set("Licence", "{LICENCE_CODE}") resp, err := http.PostForm("https://{SERVER_ADDRESS}/BirthLocality/", form) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }

Parameters

Parameter Description Mand / Opt
Licence Licence code assigned to your account. Mandatory
BirthDate Date in YYYY-MM-DD format. Mandatory
Search Search field using locality label or INSEE code. Mandatory
NbMax Maximum number of results returned by the API. Optional
Default: 20

Response

Key Description Type
Found Total number of results found. INTEGER
Results List of returned localities. ARRAY
Results.City Locality name. STRING(50)
Results.CountyCode County or department code. STRING(2)
Results.CountyLabel County or department label. STRING(50)
Results.CountryCode Country or DROM code. STRING(2)
Results.CountryLabel Country or DROM label. STRING(50)
Results.CodeInsee Locality INSEE code. STRING(5)
Results.ValidityStartDate Start date of INSEE code validity. DATE (YYYY-MM-DD)
Results.ValidityEndDate End date of INSEE code validity. Empty if the code is still valid. DATE (YYYY-MM-DD) / NULL
Country / DROM codes - FR = France, GP = Guadeloupe, MQ = Martinique, GF = Guyane, RE = La Réunion, YT = Mayotte, PM = Saint-Pierre-et-Miquelon, BL = Saint-Barthélemy, MF = Saint-Martin, PF = Polynésie française, NC = Nouvelle-Calédonie, WF = Wallis-et-Futuna, TF = Terres australes et antarctiques françaises

Response example

Search results
{ "Found": 3, "Results": [ {"City": "AAST", "CountyCode": "64", "CountyLabel": "PYRENEES-ATLANTIQUES", "CountryCode": "FR", "CountryLabel": "FRANCE", "CodeInsee": "64001", "ValidityStartDate": "1943-01-01", "ValidityEndDate": ""}, {"City": "ABAINVILLE", "CountyCode": "55", "CountyLabel": "MEUSE", "CountryCode": "FR", "CountryLabel": "FRANCE", "CodeInsee": "55001", "ValidityStartDate": "1943-01-01", "ValidityEndDate": ""} ] }

Errors

HTTP Description
400 Bad request or missing mandatory parameter — for example a missing BirthDate, Search, or Licence.

Test the API

Click the button below to test this endpoint live in your browser.

Open console

See also

Related to

Was this article helpful?

0 out of 0 found this helpful