Documents
Endpoint de depot d'un document generique (convention, facture, etc.).
POST /:opcoId/documents
Depot d'un document. Traitement asynchrone via file d'attente.
Auth : X-API-KEY obligatoire.
Body (JSON)
json
{
"typeFichier": "convention",
"objets": [
{
"typeObjet": "dossier",
"idObjet": "INT-001"
}
],
"_files": { "document": "base64..." }
}Champs du body
| Champ | Type | Requis | Description |
|---|---|---|---|
typeFichier | string | Oui | Type du fichier (ex: convention, facture, cerfa) |
objets | array | Oui | Au moins 1 objet lie au document |
_files | object | Non | Fichiers joints en base64 |
Champs d'un objet
| Champ | Type | Requis | Description |
|---|---|---|---|
typeObjet | string | Oui | Type de l'objet (ex: dossier, facture) |
idObjet | string | Oui | Identifiant de l'objet |
Headers optionnels
| Header | Description |
|---|---|
Idempotency-Key | Cle d'idempotence. Si deja vue, retourne 200 + duplicate. |
Reponse 202
json
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"statusUrl": "/opco-ep/jobs/550e8400-e29b-41d4-a716-446655440000"
}Reponse 200 (doublon)
json
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "duplicate",
"statusUrl": "/opco-ep/jobs/550e8400-e29b-41d4-a716-446655440000"
}Suivez le job via GET /:opcoId/jobs/:jobId.
Erreurs
| Code HTTP | Code erreur | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Body invalide (typeFichier manquant, objets vide) |
| 403 | HTTP_ERROR | X-API-KEY manquant |
Exemple curl
bash
curl -X POST -H "X-API-KEY: votre-cle" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: doc-001" \
-d '{"typeFichier": "convention", "objets": [{"typeObjet": "dossier", "idObjet": "INT-001"}]}' \
"https://api.opcovia.com/opco-ep/documents"