CityDate API — Birth locality by postcode

Support DQE
Support DQE
  • Updated
CityDate API - CPFRA

The CPFRA endpoint validates whether a city or locality existed and was valid for a given birthdate.

Related CityDate documentation - The CPFRA endpoint checks a single city/birthdate pair for validity. Looking for locality search by name, postcode or INSEE code instead?
API - Description - CityDate - BirthLocality →
CityDate introduction →

CPFRA

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}/CPFRA/?DDN={BIRTHDATE}&INSEE={INSEE_CODE}&CP={POSTAL_CODE}&Localite={CITY_NAME}&Licence={LICENCE_CODE}

Code examples

Search by city name

curl "https://{SERVER_ADDRESS}/CPFRA/?DDN=1980-05-15&Localite=EVRY&Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/CPFRA/?" + new URLSearchParams({ DDN: "1980-05-15", Localite: "EVRY", Licence: "{LICENCE_CODE}" })) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.get( "https://{SERVER_ADDRESS}/CPFRA/", params={ "DDN": "1980-05-15", "Localite": "EVRY", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $params = http_build_query([ 'DDN' => '1980-05-15', 'Localite' => 'EVRY', 'Licence' => '{LICENCE_CODE}', ]); $ch = curl_init("https://{SERVER_ADDRESS}/CPFRA/?{$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}/CPFRA/', { params: { DDN: '1980-05-15', Localite: 'EVRY', Licence: '{LICENCE_CODE}' } }) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String url = "https://{SERVER_ADDRESS}/CPFRA/" + "?DDN=1980-05-15&Localite=EVRY&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}/CPFRA/" + "?DDN=1980-05-15&Localite=EVRY&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}/CPFRA/" + "?DDN=1980-05-15&Localite=EVRY&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}/CPFRA/

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

Code examples

Search by city name

curl -X POST "https://{SERVER_ADDRESS}/CPFRA/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "DDN=1980-05-15" \ -d "Localite=EVRY" \ -d "Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/CPFRA/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ DDN: "1980-05-15", Localite: "EVRY", Licence: "{LICENCE_CODE}" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/CPFRA/", data={ "DDN": "1980-05-15", "Localite": "EVRY", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/CPFRA/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'DDN' => '1980-05-15', 'Localite' => 'EVRY', '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}/CPFRA/', qs.stringify({ DDN: '1980-05-15', Localite: 'EVRY', Licence: '{LICENCE_CODE}' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "DDN=1980-05-15&Localite=EVRY&Licence={LICENCE_CODE}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/CPFRA/")) .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> { ["DDN"] = "1980-05-15", ["Localite"] = "EVRY", ["Licence"] = "{LICENCE_CODE}" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/CPFRA/", 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("DDN", "1980-05-15") form.Set("Localite", "EVRY") form.Set("Licence", "{LICENCE_CODE}") resp, err := http.PostForm("https://{SERVER_ADDRESS}/CPFRA/", 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. Mandatory
DDN Birthdate in YYYY-MM-DD format. Mandatory
INSEE INSEE code. Optional
CP Postal code. Optional
Localite City name. Optional
Note - INSEE, CP and Localite are each optional individually, but one of them is mandatory — the request fails if none is provided.

Response

Response shape - The response is a JSON object keyed by an arbitrary numeric index (e.g. "1", "2"…) — one entry per candidate match — rather than a JSON array. Iterate over the object's values rather than assuming a fixed set of keys.
Key Possible values Description Type
Insee 75113 INSEE code of the city. STRING(10)
Localite Paris City name. STRING(50)
Pays FR ISO 2 country code. STRING(2)
CodePostal 75013 Postal code of the city. STRING(10)
Status OK / KO Indicates whether the city is valid for the given birthdate. STRING(2)

Response example

Ambiguous city name match
{ "1": {"Localite": "EVRY", "Pays": "FR", "Insee": "89162", "CodePostal": "89140", "Status": "OK"}, "3": {"Localite": "EVRY", "Pays": "FR", "Insee": "91228", "CodePostal": "91080", "Status": "KO"}, "2": {"Localite": "EVRY", "Pays": "FR", "Insee": "91228", "CodePostal": "91000", "Status": "KO"} }

Errors

HTTP Description
400 Bad request or missing mandatory parameter — for example a missing DDN or Licence, or none of INSEE, CP, or Localite provided.

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