Skip to content

POST /v1/organizations/{org_id}/projects/{id}/hors-ligne/imports

Imports a collection from the agent in offline mode, or a batch of collections gathered by a relay: the .twa file produced by techwatchalert-agent hors-ligne collecter or regrouper, sent as is. Designed for an automated transfer chain (data diode output, transfer station).

POST /api/v1/organizations/{org_id}/projects/{project_id}/hors-ligne/imports?fichier=lot.twa
Authorization: Bearer twa_your_key_here
Content-Type: application/json
{ …the .twa file as is… }
Parameter Where Description
org_id path Organisation of the key
project_id path Project of the machines (the one of the enrolment file)
fichier query, optional File name, kept in the import history (255 characters at most)

The body is 64 MiB at most (beyond, 413). Each collection is checked then imported separately: agent signature, encryption, organisation and project, sequence number (a collection already imported or older than the latest one is refused), freshness (30 days at most), size. A refused collection does not block the others.

Fenêtre de terminal
curl -X POST "https://app.techwatchalert.com/api/v1/organizations/$ORG_ID/projects/$PROJECT_ID/hors-ligne/imports?fichier=lot.twa" \
-H "Authorization: Bearer $TWA_API_KEY" -H "Content-Type: application/json" \
--data-binary @lot.twa
{
"id": "018e8888-0000-7000-8000-0000000000a1",
"recu_le": "2026-10-25T08:30:00Z",
"par_nom": null,
"via": "api",
"fichier": "lot.twa",
"taille": 48213,
"type": "lot",
"importees": 1,
"refusees": 1,
"details": [
{ "statut": "importee", "machine": "SCADA-01", "identifiant": "4c4c4544-0058-3010", "sequence": 12,
"cree_le": "2026-10-24T17:02:11Z", "machine_id": "018e8888-0000-7000-8000-000000000031",
"logiciels": 214, "mises_a_jour": 9, "regles": 168 },
{ "statut": "refusee", "machine": "HMI-02", "identifiant": "4c4c4544-0042-5a10", "sequence": 7,
"cree_le": "2026-10-24T17:05:40Z", "raison": "rejeu",
"message": "Collecte n° 7 déjà importée ou plus ancienne que la dernière (n° 7)." }
]
}

raison of a refusal: format, taille (size), organisation, destinataire (encrypted for another key), perimee (too old), future, signature, rejeu (replay), revoque (revoked), agent_inconnu (unknown agent), jeton (token), offre (plan), quota, dechiffrement (decryption), contenu (content). The guide says what to do in each case.

Code Case
403 Key without the hors-ligne scope, or project outside the key restriction
404 Unknown project in this organisation
413 File larger than 64 MiB
422 Not an importable offline file (unreadable, empty batch, enrolment file or catalogue)

Signed catalogue: GET …/hors-ligne/catalogue

Section titled “Signed catalogue: GET …/hors-ligne/catalogue”
Fenêtre de terminal
curl "https://app.techwatchalert.com/api/v1/organizations/$ORG_ID/projects/$PROJECT_ID/hors-ligne/catalogue" \
-H "Authorization: Bearer $TWA_API_KEY" -o catalogue.twa

Returns the compliance catalogue for the organisation’s level, signed by TechWatchAlert, to import on the machines (techwatchalert-agent hors-ligne catalogue --fichier catalogue.twa). Readable with the hors-ligne scope or an unrestricted key. 409 when no rule is available.

The enrolment file, which contains a token, can only be downloaded from the interface, by a project administrator.