curl -X POST 'https://api.moustacheai.com/api/v1/agents/28ce3b2d-5791-4905-8d66-123456789abc/rag-resources' \
-H "Authorization: Bearer MON_API_TOKEN" \
-F "file=@guide.pdf" \
-F "externalId=notion-page-42"
{
"id": 123,
"external_id": "notion-page-42",
"file_name": "guide.pdf",
"file_type": "application/pdf",
"file_size_bytes": 20480,
"status": "PENDING",
"chunk_count": null,
"error_message": null,
"created_at": "…",
"updated_at": "…"
}
Base documentaire
Ajouter ou mettre à jour un document
POST
/
api
/
v1
/
agents
/
{agentUUID}
/
rag-resources
curl -X POST 'https://api.moustacheai.com/api/v1/agents/28ce3b2d-5791-4905-8d66-123456789abc/rag-resources' \
-H "Authorization: Bearer MON_API_TOKEN" \
-F "file=@guide.pdf" \
-F "externalId=notion-page-42"
{
"id": 123,
"external_id": "notion-page-42",
"file_name": "guide.pdf",
"file_type": "application/pdf",
"file_size_bytes": 20480,
"status": "PENDING",
"chunk_count": null,
"error_message": null,
"created_at": "…",
"updated_at": "…"
}
Les points de terminaison de la base documentaire permettent à une intégration externe (par exemple un workflow n8n) d’envoyer, lister et supprimer les documents d’un agent. L’API utilise automatiquement le RAG interne ou le Vector Store OpenAI/Azure configuré sur l’agent.
Envoi en
multipart/form-data.
Paramètres
string
required
UUID de l’agent. Il doit appartenir à la société propriétaire du token.
file
required
Le document. Types acceptés : TXT, MD, CSV, JSON, PDF, DOCX, PPTX, XLSX,
MP3, WAV, MP4, SRT, VTT. Taille max : 500 Mo (configurable).
string
Pour le RAG interne, renvoyer le même
externalId remplace la version
précédente. Pour un Vector Store, le remplacement est automatique lorsqu’un
fichier du même nom existe déjà.Pour un agent OpenAI/Azure, le champ
id retourné est l’identifiant du
fichier du Vector Store. Il sert également à le
supprimer.Réponses
| Code | Corps JSON |
|---|---|
| 201 | Document enregistré, voir l’exemple de réponse (id est une chaîne pour un fichier Vector Store) |
| 400 | { "error": "No file provided" } / type ou externalId invalide |
| 401 | { "error": "Provide Auth via Authorization with \"Bearer YOUR_MOUSTACHE_AI_API_TOKEN\"" } |
| 404 | { "error": "Agent not found for your company" } |
| 409 | { "error": "A concurrent upload for this externalId is in progress; retry shortly" }, ou { "error": "A replacement upload for this externalId is still processing; retry after it reaches READY or FAILED" } tant que la version précédente est en PENDING ou PROCESSING |
| 413 | { "error": "File size exceeds the 500 MB limit" } |
| 422 | Fournisseur actuel incompatible avec les documents |
| 429 | { "error": "Rate limit exceeded" } (en-tête Retry-After) |
| 500 | { "error": "Failed to upload RAG resource" } |
curl -X POST 'https://api.moustacheai.com/api/v1/agents/28ce3b2d-5791-4905-8d66-123456789abc/rag-resources' \
-H "Authorization: Bearer MON_API_TOKEN" \
-F "file=@guide.pdf" \
-F "externalId=notion-page-42"
{
"id": 123,
"external_id": "notion-page-42",
"file_name": "guide.pdf",
"file_type": "application/pdf",
"file_size_bytes": 20480,
"status": "PENDING",
"chunk_count": null,
"error_message": null,
"created_at": "…",
"updated_at": "…"
}
Was this page helpful?