API Téléphone — Valider et standardiser un numéro

Support DQE
Support DQE
  • Mise à jour
Validation Téléphone - API Classic

L'endpoint /TEL/ valide et standardise un numéro de téléphone fixe ou mobile, avec une vérification de niveau 2 optionnelle pour les numéros de mobile français.

Dans quel cas utiliser cet endpoint - Appelez /TEL/ via l'intégration XML/formulaire historique de DQE pour valider un numéro de téléphone et récupérer son opérateur et son type. Vous cherchez l'intégration JSON moderne ? Consultez API Téléphone Restful (/phonelookup) →

/TEL/

Requête

GET et POST sont toutes deux prises en charge.

{SERVER_ADDRESS} et {LICENCE_CODE} sont fournis par DQE à la création du compte. Contactez votre chargé de compte DQE pour obtenir ces identifiants.
GEThttps://{SERVER_ADDRESS}/TEL/?Pays={COUNTRY_CODE}&Tel={TEL}&Format={FORMAT}&Status=Y&TimeOut={TIME}&Separator={SYMBOL}&Licence={LICENCE_CODE}

Exemples de code

Numéro mobile valide

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

Envoyez tous les paramètres dans le corps de la requête au format Content-Type: application/x-www-form-urlencoded. L'adresse du serveur reste dans l'URL.

Exemples de code

Numéro mobile valide

curl -X POST "https://{SERVER_ADDRESS}/TEL/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "Pays=FRA" \ -d "Tel=0611223344" \ -d "Licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/TEL/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ Pays: "FRA", Tel: "0611223344", Licence: "{LICENCE_CODE}" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/TEL/", data={ "Pays": "FRA", "Tel": "0611223344", "Licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/TEL/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'Pays' => 'FRA', 'Tel' => '0611223344', '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}/TEL/', qs.stringify({ Pays: 'FRA', Tel: '0611223344', Licence: '{LICENCE_CODE}' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "Pays=FRA&Tel=0611223344&Licence={LICENCE_CODE}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/TEL/")) .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> { ["Pays"] = "FRA", ["Tel"] = "0611223344", ["Licence"] = "{LICENCE_CODE}" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/TEL/", 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("Pays", "FRA") form.Set("Tel", "0611223344") form.Set("Licence", "{LICENCE_CODE}") resp, err := http.PostForm("https://{SERVER_ADDRESS}/TEL/", form) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }

Paramètres

Paramètre Description Obl / Fac
Licence Code de licence attribué à votre compte. Contactez le support si vous n'en avez pas encore un. Obligatoire
Pays Code pays ISO à 3 lettres. Obligatoire
Tel Numéro de téléphone à valider. Obligatoire
Format Niveau de formatage souhaité. Voir le tableau des valeurs de format ci-dessous. Optionnel
Status Y active la vérification de niveau 2 pour les numéros de mobile français et renvoie les champs supplémentaires Status et LabelStatus. Optionnel
TimeOut Temps de requête maximal pour la vérification, en secondes. Exemple : 0.5 pour 500 ms. Optionnel
Separator Caractère séparateur utilisé dans le numéro de téléphone formaté. Valeurs acceptées : - et .. Ne fonctionne que sur les formats qui utilisent des espaces (1, 2, 3, 4, 6). Optionnel

Valeurs de format

Les valeurs suivantes s'appliquent au paramètre Format dans les requêtes GET et POST.

Valeur Description Exemples (Allemagne / France / États-Unis)
0 Format national sans espaces 0301234567 / 0123456789 / (202)555-0123
1 Format national avec regroupement de chiffres propre au pays 030 1234567 / 01 23 45 67 89 / (202) 555-0123
2 Format international avec regroupement de chiffres propre au pays +49 30 1234567 / +33 1 23 45 67 89 / +1 202-555-0123
3 Format international avec espace entre l'indicatif pays et le numéro d'abonné +49 301234567 / +33 123456789 / +1 2025550123
4 Format international avec préfixe interurbain et numéro d'abonné compact +49 (0)301234567 / +33 (0)123456789 / +1 (0)2025550123
5 Format international sans espaces +49301234567 / +33123456789 / +12025550123
6 Format international avec préfixe interurbain et regroupement de chiffres propre au pays +49 (0) 30 1234567 / +33 (0) 1 23 45 67 89 / +1 (0) (202) 555-0123
7 Format national avec regroupement de chiffres propre au pays séparé par des points 030.1234567 / 01.23.45.67.89 / (202).555-0123
8 Format international avec regroupement de chiffres propre au pays séparé par des points +49.30.1234567 / +33.1.23.45.67.89 / +1.202-555-0123
9 Format international sans espaces et sans signe plus initial 49301234567 / 33123456789 / 1202-555-0123

Réponse

En cas de succès, l'API renvoie un objet JSON avec une clé unique "1" — un artefact historique de l'implémentation de cet endpoint — qui enveloppe les champs de résultat ci-dessous.

Niveau 1 vs Niveau 2 - TelOrigine, Geolocation, Tel, Operator, IdError, OldOperator et Type sont toujours renvoyés (vérification de niveau 1 : existence et format du numéro de téléphone). LabelStatus et une valeur Status mise à jour ne sont ajoutés que lorsque Status=Y est passé dans la requête (vérification de niveau 2, numéros de mobile français uniquement).

Champs de vérification niveau 1

Clé Description Type
TelOrigine Numéro de téléphone analysé. String
Geolocation Lieu où le numéro a été initialement attribué. String
Tel Numéro de téléphone formaté selon le format sélectionné. String
Ported Vide en vérification de niveau 1. String
Operator Opérateur auquel le numéro de téléphone a été initialement attribué. String
IdError 2 : syntaxe valide ; 1 : valide et attribué ; 0 : numéro invalide ou inexistant. Integer
OldOperator Opérateur d'origine du numéro de téléphone. String
Type MOBILE ou FIXED_LINE ou FIXED_LINE_OR_MOBILE ou Vide. String

Champs de vérification niveau 2

Attention : l'information de joignabilité n'est plus fournie. Cette variable est conservée à titre historique.

La vérification de niveau 2 fournit le statut d'activité et les informations opérateur. Activez-la en passant Status=Y dans la requête. La réponse JSON contient les champs supplémentaires (ou mis à jour) suivants :

Clé Description Type
Ported Y si le numéro a été porté, N sinon. String(1)
Operator Opérateur actuel du numéro de téléphone. String
OldOperator Opérateur précédent lorsque le numéro a été porté. String
LabelStatus Reachable ou No reachable information (mobile uniquement). String
Status 0 : joignable ; 1 : aucune information de joignabilité. String

Exemple de réponse

Niveau 1 (standard)
{ "1": { "TelOrigine": "+12XXXXXXXXX", "Geolocation": "UNITED STATES OF AMERICA", "Tel": "+12345678910", "Ported": "", "Operator": "FIRST COMMUNICATIONS", "IdError": 1, "OldOperator": "FIRST COMMUNICATIONS", "Type": "MOBILE" } }
Niveau 2 (avec Status=Y)
{ "1": { "TelOrigine": "0XXXXXXXXX", "Geolocation": "FRANCE", "LabelStatus": "Not Reachable", "Tel": "0XXXXXXXXX", "Ported": "N", "Status": "1", "Operator": "ORANGE", "IdError": 1, "OldOperator": "", "Type": "MOBILE" } }

Erreurs

Type d'erreur Type de réponse
Paramètre Licence manquant Erreur Licence Down dans la réponse JSON.
Paramètre Licence vide Erreur Licence Down dans la réponse JSON.
Numéro de licence incorrect Erreur Licence Down dans la réponse JSON.
Paramètre Tel manquant ou vide 400 Bad Request
Erreur de saisie dans un paramètre 400 Bad Request

Exemple d'erreur de licence :

{ "1": { "TelOrigine": "06XXXXXXXX", "Geolocation": "", "Tel": "", "Ported": "", "Operator": "", "IdError": 0, "OldOperator": "", "Error": "Licence Down" } }

Tester l'API

Cliquez sur le bouton ci-dessous pour tester cet endpoint en direct dans votre navigateur.

Ouvrir la console

Voir aussi

Associé à

Cet article vous a-t-il été utile ?

Utilisateurs qui ont trouvé cela utile : 0 sur 0