Skip to content

DSN API: immediate or deferred response

By default, the API answers a DSN check with the report: that is the immediate response, the direct call. With the standard Prefer: respond-async header, you ask for a deferred response: the client no longer waits for the check to finish, and fetches the report when it is ready.

Immediate response, the default

The client sends the file with POST /v1/controles and waits for the response, which contains the report in the requested format. Without a Prefer header, this is how the API behaves.

Deferred response, on request

Add the standard Prefer: respond-async header to the submission, with its usual idempotency key. You can add wait=N, where N is a whole number of seconds from 1 to the API’s configured limit, 120 seconds by default: for example Prefer: respond-async, wait=10. A value outside this range is refused with a 400.

  1. Send the file with the Prefer header — With this header you consent to the report being kept in memory, in a single-file batch that the API closes by itself. Checks, admission, quotas, counting and idempotency receipts are those of batches.
  2. Wait N seconds, if you wish — The wait starts once the file is fully received. If the check finishes first, the response is a 200 that delivers the report, as with an immediate response: there is nothing else to do.
  3. Otherwise, read the 202 — Without wait, or if the check has not finished, the API answers 202: received, in progress. The Location header gives the address of the result, which starts with /v1/lots/; the JSON body carries lot_id and index, which is 0; Preference-Applied: respond-async confirms the preference.
  4. Fetch the report — Poll the address received, sending back the cookies received: the completed counter of the batch reaches 1 when the check has finished (failed, if it failed). Then read the report by adding /rapports/0 to that address. With a designated destination, the signed completion notice saves you polling.

The signed completion notice, to your address:

  • Add the destination to the preference: Prefer: respond-async; webhook=destination_1. The destination is an identifier that your workspace has had registered, never an address. The two parameters combine: Prefer: respond-async; webhook=destination_1, wait=10.
  • When the check ends, the signed lot.termine notice carries the batch identifier, the counts of successes and failures and the destination: never the file or the report.
  • Without a destination, no notice is sent: poll the address of the result.

What to know about the deferred report:

  • The report is kept in memory for 300 seconds from the end of the check, and can be read once only: reading removes it, and a second read returns 410. During the calculation, a read returns 409.
  • Nothing is written to disk: the report is kept only in memory. It is lost at expiry, and may be lost before it is read, rarely (for example during a service update): send the file again with a new key.
  • By default, a report is at most 2 MiB: a larger report becomes an error, with no truncation and no billing. For a very large report, ask for the immediate response, which is streamed.
  • Send back on every read the cookies received with the submission: without them, the read may receive 421 (instance_incorrecte); read again with the cookies.
  • Idempotency is that of the immediate response: the same key receives 409 during the calculation, then 204, with no new report, once the check has finished. To find the result again, read the address you received; do not send the file again.

For a deferred response, add Prefer: respond-async, without wait. This command checks the fictional March DSN, then reads the batch status and its report.

POST /v1/controles
curl -X POST "$DSNLINT_API_URL/v1/controles?format=text&annee=2026" \
  -H "Authorization: Bearer $DSNLINT_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/octet-stream" \
  -H "Prefer: respond-async" \
  --data-binary @mars-2026.dsn \
  -o recu.json \
  -b affinite.txt -c affinite.txt
LOT_ID=$(jq -r .lot_id recu.json)
# Répéter cette lecture jusqu’à completed=1.
curl -X GET "$DSNLINT_API_URL/v1/lots/$LOT_ID" \
  -H "Authorization: Bearer $DSNLINT_API_KEY" \
  -o etat.json \
  -b affinite.txt -c affinite.txt
curl -X GET "$DSNLINT_API_URL/v1/lots/$LOT_ID/rapports/0" \
  -H "Authorization: Bearer $DSNLINT_API_KEY" \
  -o rapport.txt \
  -b affinite.txt -c affinite.txt

The API returns 202 with Location, the batch status address, and Preference-Applied, which confirms respond-async. This is the HTTP response to the submission.

202 Accepted15 ms
HTTP response
HTTP/1.1 202 Accepted
content-type: application/json
x-request-id: req_71db5274e489d781db60_1a3e
cache-control: no-store
x-content-type-options: nosniff
content-security-policy: default-src 'none'; frame-ancestors 'none'
referrer-policy: no-referrer
x-frame-options: DENY
strict-transport-security: max-age=31536000
preference-applied: respond-async
location: /v1/lots/lot_d91ee72e901d17113bf4_71db5274e489d781db60_1a3f
server-timing: traitement;dur=0.042

The receipt gives the batch identifier and the file index, here 0.

recu.json · lot_id
"lot_d91ee72e901d17113bf4_71db5274e489d781db60_1a3f"
recu.json · index
0
Receipt returned by the API to the curl command above, using the fictional March DSN.

Sending back the cookies received, read the batch status until completed=1. This is the completed batch status.

etat.json · lot_id
"lot_d91ee72e901d17113bf4_71db5274e489d781db60_1a3f"
etat.json · completed
1
etat.json · failed
0
etat.json · closed
true
Status returned by the API to the curl request for the fictional March DSN’s batch.

Then read the report once. The excerpt shows its first lines.

rapport.txt · lines 1 to 12 of 14
Fichier : message.dsn
Norme   : DSN P26V01
Lignes  : 3217
Statut  : NON_VALIDE (6 bloquant(s), 2 avertissement(s))
Identités : 661 / 669 (inventaire)
Anomalies :
  - S21.G00.30.006/CCH-11 BLOQUANT ligne 528 [S21.G00.30.006 — Date de naissance] = '08071994' : année de naissance 1994 incohérente avec l'identifiant
  - S21.G00.40.021/SIG-11 AVERTISSEMENT ligne 1128 [S21.G00.40.021 — Motif de recours] : Motif de recours attendu pour le contrat non concerné par un dispositif de politique publique.
  - S21.G00.40.010/CCH-11 BLOQUANT ligne 1136 [S21.G00.40.010 — Date de fin prévisionnelle du contrat] = '31122025' : fin 31122025 antérieure au début 01012026
  - S21.G00.81.001/SIG-18 AVERTISSEMENT ligne 1402 [S21.G00.81.001 — Code de cotisation] = '076' : cotisation 131 sans 142 sous le même versement (mois déclaré)
  - CSL-04 BLOQUANT ligne 2062 [S21.G00.50.001 — Date de versement] = '30022026' : La rubrique ne respecte pas les contraintes calendaires.
  - S21.G00.40.004/CRE-11 BLOQUANT ligne 2232 [S21.G00.40.004 — Code profession et catégorie socioprofessionnelle (PCS-ESE)] = '999z' : valeur '999z' hors nomenclature [CRE-11]
Excerpts from a real DSNLint API response, received with DSNLint Connect 1.3.0 on 5 December 2026, for public examples with fictitious data: mars-2026.dsn. Engine outputs are in French. The same request sent with curl returns the same document, byte for byte.

Batches

Batches are the other route for grouped submissions: from 1 to 32 files, processed in the background. The “Send in batches” section describes them.

What is left to the software publisher

  • Mode
    Immediate response (default)
    What the client receives
    The report, in the response.
    Left to the software publisher
    Its waiting screen, its error messages and saving the report on its side.
  • Mode
    Deferred response (on request)
    What the client receives
    The report if the check finishes within N seconds; otherwise a 202 with the address of the result, then the report, once only, within 5 minutes.
    Left to the software publisher
    Reading the report, once, within 5 minutes.

DSNLint sends no email to a software publisher’s customers: the publisher manages its own notifications.

See the two modes in the API overview

See the limits in the API overview

Compare two versions of a set of DSN files
Previous section
Submit DSN checks in batches
Next section