Skip to content

Resources API requests

Parameters

The API system allows you to automate the validation of resource documents through a simple HTTP POST request.

The accepted parameters are listed in the table below:

Parameter Type Format Required Description
api_key string Yes Your API key.
format string No Response format: json (default) or xml.
fr_income_taxes_file file PDF No French income tax return document.
fr_civil_servant_payslip_file file PDF No French civil servant payslip.
fr_caf_payment_certificate_file file[] PDF No One or more documents: French CAF payment certificate.

Example calls in different languages

cURL

curl \
  -X POST \
  -F "format={{ xml }}" \
  -F "api_key={{ YOUR_API_KEY }}" \
  -F "fr_****_file=@{{ PATH_TO_FILE }}" \
  https://api.app.trustdochub.com/api/resources/v1

Java

    public String sendIdFileAndGetResults(MultipartFile file) {

    WebClient client = WebClient.create();

    MultipartBodyBuilder builder = new MultipartBodyBuilder();
    builder.part("fr_****_file", file.getResource());
    builder.part("api_key", {{ YOUR_API_KEY }});

    return client.post()
    .uri(URI.create("https://api.app.trustdochub.com/api/resources/v1"))
    .contentType(MediaType.MULTIPART_FORM_DATA)
    .body(BodyInserters.fromMultipartData(builder.build()))
    .retrieve()
    .bodyToMono(String.class)
    .block();
    }

Python

import requests

url = 'https://api.app.trustdochub.com/api/resources/v1'
data = {'api_key': '{{ YOUR_API_KEY }}'}

with open('file.txt', 'rb') as file:
    response = requests.post(url, data=data, files={'fr_****_file': file})

print(response.text)

Node

    const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();

// Chemin vers le fichier que vous souhaitez envoyer
const filePath = 'pathToFile';

// Vérifier si le fichier existe
if (!fs.existsSync(filePath)) {
    console.error('Le fichier spécifié est introuvable :', filePath);
    process.exit(1);
}

// Ajouter le fichier au formulaire
form.append('fr_****_file', fs.createReadStream(filePath));

// Ajouter le paramètre api_key
form.append('api_key', 'votre_clé_api'); // Remplacez par votre clé API réelle

(async () => {
    try {
        const response = await axios.post(
            'https://api.app.trustdochub.com/api/resources/v1',
            form,
            {
                headers: {
                    ...form.getHeaders(),
                    // Si l'API nécessite une autorisation supplémentaire, ajoutez-la ici
                    // 'Authorization': 'Bearer votre_token',
                },
            }
        );

        console.log('Réponse du serveur :', response.data);
    } catch (error) {
        if (error.response) {
            // La requête a été faite et le serveur a répondu avec un statut d'erreur
            console.error('Erreur du serveur :', error.response.status);
            console.error('Détails de l'erreur :', error.response.data);
        } else if (error.request) {
            // La requête a été faite mais aucune réponse n'a été reçue
            console.error('Aucune réponse reçue :', error.request);
        } else {
            // Erreur lors de la configuration de la requête
            console.error('Erreur lors de la configuration de la requête :', error.message);
        }
    }
})();

PHP

<?php require 'vendor/autoload.php'; 
use GuzzleHttpClient; 
use GuzzleHttpExceptionRequestException;
$url = 'https://api.app.trustdochub.com/api/resources/v1'; 

$filePath = '{{ path_to_file }}'; 

if (!file_exists($filePath)) {     die('Fichier introuvable : ' . $filePath); } 

// Clé API 
$apiKey = 'votre_clé_api'; // Remplacez par votre clé API 

// Créer un client Guzzle 
$client = new Client(); try {     $response = $client->post($url, [
        'multipart' => [
            [
                'name'     => 'fr_****_file',
                'contents' => fopen($filePath, 'r'),
                'filename' => 'specimen_passeport.webp',
                'headers'  => ['Content-Type' => 'image/webp']
            ],
            [
                'name'     => 'api_key',
                'contents' => $apiKey
            ]
        ],
        'verify' => true // Vérifier le certificat SSL
    ]);

    // Afficher le code de statut HTTP
    echo 'Code HTTP : ' . $response->getStatusCode() . "n";

    // Afficher la réponse du serveur
    echo 'Réponse du serveur : ' . $response->getBody();
} catch (RequestException $e) {
    if ($e->hasResponse()) {
        echo 'Erreur du serveur : ' . $e->getResponse()->getStatusCode() . "n";
        echo 'Réponse du serveur : ' . $e->getResponse()->getBody();
    } else {
        echo 'Erreur lors de la requête : ' . $e->getMessage();
    }
}

Status codes

The following codes are returned by the API:

API response codes

Code Type Description
200 Verification OK The verification was successful.
401 Unauthorized The API key is not valid.
402 Insufficient credits No verification credits left for the given period.
422 Unreadable document The document could not be recognized or is invalid.

Responses

JSON format

You can retrieve the results in JSON format.

To do so, simply add the parameter format=json to your request, or omit the format parameter.

Here are sample responses depending on the document type:

French income tax

{
  "documentInfos": {
    "publicationDate": null,
    "signatureDate": "2022-06-13",
    "taxableIncomeReference": "44444",
    "sharesNumber": "1",
    "noticeReference": "2222222222222",
    "incomeYear": "2021",
    "declarant1": "XXXXXX YYYYYY",
    "taxNumberDeclarant1": "777777777777",
    "declarant2": null,
    "taxNumberDeclarant2": "null",
    "collectionDate": "2022-07-31"
  },
  "certificate": {
    "validityStartDate": "2022-06-21",
    "validityEndDate": "2024-06-21",
    "issuerReference": "FR04",
    "issuerName": "AriadNEXT",
    "subjectReference": "FPE3",
    "issuer": "DIRECTION GENERALE DES FINANCES PUBLIQUES",
    "datesConsistency": true,
    "digitalSignature": true
  }
}

French civil servant payslip

{
  "documentInfos": {
    "fullName": "MR XXXX YYYY",
    "employerSiret": "55555555555555",
    "periodStartDate": "2021-11-01",
    "periodEndDate": "2021-11-30",
    "contractStartDate": "1111-11-11",
    "netTaxableSalary": "2290.3",
    "netTaxableAccumulatedSalary": "27138.31"
  },
  "certificate": {
    "validityStartDate": "2020-03-30",
    "validityEndDate": "2023-03-31",
    "issuerReference": "FR04",
    "issuerName": "AriadNEXT",
    "subjectReference": "FPE1",
    "issuer": "DIRECTION GENERALE DES FINANCES PUBLIQUES",
    "datesConsistency": true,
    "digitalSignature": true
  }
}

French CAF payment certificate (1 file / 2-page document)

{
  "cafPaymentCertificates": [
    {
      "documentInfos": {
        "documentDate": "2020-02-05",
        "dateOfBirth": "1980-08-14",
        "numberOfPages": 2,
        "beneficiaryNumberHeader": "8888888 M",
        "dateHourFooter": [
          "050220202336",
          "050220202336"
        ],
        "beneficiaryNumberFooter": [
          "8888888 M",
          "8888888 M"
        ],
        "barcodeNumber": [
          "88888888888800000000",
          "88888888888800000000"
        ],
        "barcodeNumberDecoded": [
          "88888888888800000000",
          "88888888888800000000"
        ]
      },
      "documentInfosValidation": {
        "datesHeaderFooterValid": true,
        "beneficiaryNumberHeaderFooterValid": true,
        "beneficiaryNumberBarcodeNumberValid": true,
        "barcodeNumberBarcodeValid": true,
        "datesHeaderMetasValid": true,
        "datesFooterMetasValid": true
      }
    }
  ],
  "documentsValidation": null
}

French CAF payment certificate (2 files / 2-page documents)

{
  "documentInfos": {
    "numberOfCharacters": "30",
    "documentType": "FR_DRIVING_LICENCE",
    "country": "FRA",
    "lastName": "MARTIN",
    "documentNumber": "13AA00002",
    "expirationDate": "2018-12-31"
  },
  "documentInfosValidation": {
    "numberOfCharactersValid": true,
    "documentTypeValid": true,
    "lastNameValid": true,
    "countryValid": true,
    "documentNumberValid": true,
    "expirationDateValid": true
  },
  "controlKeys": {
    "documentNumberControlKey": true,
    "globalControlKey": true
  }
}

XML format

The second response format available is XML.

To get XML, set the parameter format=xml in your request.

Here are sample responses depending on the document type:

French income tax

<FrenchIncomeTaxes>
    <documentInfos>
        <publicationDate/>
        <signatureDate>2022-06-13</signatureDate>
        <taxableIncomeReference>44444</taxableIncomeReference>
        <sharesNumber>1</sharesNumber>
        <noticeReference>2222222222222</noticeReference>
        <incomeYear>2021</incomeYear>
        <declarant1>XXXXX YYYYYY</declarant1>
        <taxNumberDeclarant1>777777777777</taxNumberDeclarant1>
        <declarant2/>
        <taxNumberDeclarant2>null</taxNumberDeclarant2>
        <collectionDate>2022-07-31</collectionDate>
    </documentInfos>
    <certificate>
        <validityStartDate>2022-06-21</validityStartDate>
        <validityEndDate>2024-06-21</validityEndDate>
        <issuerReference>FR04</issuerReference>
        <issuerName>AriadNEXT</issuerName>
        <subjectReference>FPE3</subjectReference>
        <issuer>DIRECTION GENERALE DES FINANCES PUBLIQUES</issuer>
        <datesConsistency>true</datesConsistency>
        <digitalSignature>true</digitalSignature>
    </certificate>
</FrenchIncomeTaxes>

French civil servant payslip

<FrenchCivilServantPayslip>
    <documentInfos>
        <fullName>MR XXXX YYYY</fullName>
        <employerSiret>55555555555555</employerSiret>
        <periodStartDate>2021-11-01</periodStartDate>
        <periodEndDate>2021-11-30</periodEndDate>
        <contractStartDate>1111-11-11</contractStartDate>
        <netTaxableSalary>2290.3</netTaxableSalary>
        <netTaxableAccumulatedSalary>27138.31</netTaxableAccumulatedSalary>
    </documentInfos>
    <certificate>
        <validityStartDate>2020-03-30</validityStartDate>
        <validityEndDate>2023-03-31</validityEndDate>
        <issuerReference>FR04</issuerReference>
        <issuerName>AriadNEXT</issuerName>
        <subjectReference>FPE1</subjectReference>
        <issuer>DIRECTION GENERALE DES FINANCES PUBLIQUES</issuer>
        <datesConsistency>true</datesConsistency>
        <digitalSignature>true</digitalSignature>
    </certificate>
</FrenchCivilServantPayslip>

French CAF payment certificate (1 file / 2-page document)

<FrenchCafPaymentCertificate>
    <cafPaymentCertificates>
        <cafPaymentCertificates>
            <documentInfos>
                <documentDate>2020-02-05</documentDate>
                <dateOfBirth>1980-08-14</dateOfBirth>
                <numberOfPages>2</numberOfPages>
                <beneficiaryNumberHeader>8888888 M</beneficiaryNumberHeader>
                <dateHourFooter>
                    <dateHourFooter>050220202336</dateHourFooter>
                    <dateHourFooter>050220202336</dateHourFooter>
                </dateHourFooter>
                <beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                </beneficiaryNumberFooter>
                <barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                </barcodeNumber>
                <barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                </barcodeNumberDecoded>
            </documentInfos>
            <documentInfosValidation>
                <datesHeaderFooterValid>true</datesHeaderFooterValid>
                <beneficiaryNumberHeaderFooterValid>true</beneficiaryNumberHeaderFooterValid>
                <beneficiaryNumberBarcodeNumberValid>true</beneficiaryNumberBarcodeNumberValid>
                <barcodeNumberBarcodeValid>true</barcodeNumberBarcodeValid>
                <datesHeaderMetasValid>true</datesHeaderMetasValid>
                <datesFooterMetasValid>true</datesFooterMetasValid>
            </documentInfosValidation>
        </cafPaymentCertificates>
    </cafPaymentCertificates>
    <documentsValidation/>
</FrenchCafPaymentCertificate>

French CAF payment certificate (2 files / 2-page documents)

<FrenchCafPaymentCertificate>
    <cafPaymentCertificates>
        <cafPaymentCertificates>
            <documentInfos>
                <documentDate>2020-02-05</documentDate>
                <dateOfBirth>1980-08-14</dateOfBirth>
                <numberOfPages>2</numberOfPages>
                <beneficiaryNumberHeader>8888888 M</beneficiaryNumberHeader>
                <dateHourFooter>
                    <dateHourFooter>050220202336</dateHourFooter>
                    <dateHourFooter>050220202336</dateHourFooter>
                </dateHourFooter>
                <beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                </beneficiaryNumberFooter>
                <barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                </barcodeNumber>
                <barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                </barcodeNumberDecoded>
            </documentInfos>
            <documentInfosValidation>
                <datesHeaderFooterValid>true</datesHeaderFooterValid>
                <beneficiaryNumberHeaderFooterValid>true</beneficiaryNumberHeaderFooterValid>
                <beneficiaryNumberBarcodeNumberValid>true</beneficiaryNumberBarcodeNumberValid>
                <barcodeNumberBarcodeValid>true</barcodeNumberBarcodeValid>
                <datesHeaderMetasValid>true</datesHeaderMetasValid>
                <datesFooterMetasValid>true</datesFooterMetasValid>
            </documentInfosValidation>
        </cafPaymentCertificates>
        <cafPaymentCertificates>
            <documentInfos>
                <documentDate>2021-02-05</documentDate>
                <dateOfBirth>1980-08-14</dateOfBirth>
                <numberOfPages>2</numberOfPages>
                <beneficiaryNumberHeader>8888888 M</beneficiaryNumberHeader>
                <dateHourFooter>
                    <dateHourFooter>050220212336</dateHourFooter>
                    <dateHourFooter>050220212336</dateHourFooter>
                </dateHourFooter>
                <beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                    <beneficiaryNumberFooter>8888888 M</beneficiaryNumberFooter>
                </beneficiaryNumberFooter>
                <barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                    <barcodeNumber>88888888888800000000</barcodeNumber>
                </barcodeNumber>
                <barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                    <barcodeNumberDecoded>88888888888800000000</barcodeNumberDecoded>
                </barcodeNumberDecoded>
            </documentInfos>
            <documentInfosValidation>
                <datesHeaderFooterValid>true</datesHeaderFooterValid>
                <beneficiaryNumberHeaderFooterValid>true</beneficiaryNumberHeaderFooterValid>
                <beneficiaryNumberBarcodeNumberValid>true</beneficiaryNumberBarcodeNumberValid>
                <barcodeNumberBarcodeValid>true</barcodeNumberBarcodeValid>
                <datesHeaderMetasValid>true</datesHeaderMetasValid>
                <datesFooterMetasValid>true</datesFooterMetasValid>
            </documentInfosValidation>
        </cafPaymentCertificates>
    </cafPaymentCertificates>
    <documentsValidation>
        <datesOfBirthValid>true</datesOfBirthValid>
        <datesHeaderFooterValid>true</datesHeaderFooterValid>
        <beneficiaryNumberHeaderFooterValid>true</beneficiaryNumberHeaderFooterValid>
        <beneficiaryNumberBarcodeNumberValid>true</beneficiaryNumberBarcodeNumberValid>
        <barcodeNumberBarcodeValid>true</barcodeNumberBarcodeValid>
        <datesHeaderMetasValid>true</datesHeaderMetasValid>
        <datesFooterMetasValid>true</datesFooterMetasValid>
        <modificationDateMetasValid>true</modificationDateMetasValid>
    </documentsValidation>
</FrenchCafPaymentCertificate>