Asynchronous Generation Endpoint
This endpoint allows you to submit a text generation request and retrieve the result later.
It is useful when you don’t want to wait for the generation to complete within the same request.
Processing may take from a few seconds up to 1–2 minutes depending on the model used and system load.
1. Submit a request for asynchronous generation
POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/generation-async
Initiates the asynchronous generation process.
Path Parameters
companyCuid(string) – Your company identifier.orchestratorCuid(string) – The orchestrator identifier.
Request Body (MailGenerationAsyncParameters)
{
"subject": "Demande de remboursement suite à un accident de voiture",
"body": "Bonjour, Je vous écris pour déclarer un sinistre...",
"metadata": {
"date": "2024-09-11",
"policy_number": "123456789",
"sender": "jean.dupont@mail.com"
},
"template": "Bonjour [Nom du Client], Merci de nous avoir contactés...",
"external_ref": "case-457",
"external_metadata": {
"user_id": "abc-789"
}
}
Response (TextProcessOutput)
{
"process_cuid": "g78ml9fz3qwk"
}
Use the returned process_cuid to later retrieve the generated response.
📥 2. Retrieve the generated response
GET /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/generation-async/{processCuid}
Returns the result of the asynchronous generation process.
Path Parameters
companyCuid(string) – Your company identifier.orchestratorCuid(string) – The orchestrator identifier.processCuid(string) – The process ID returned at submission.
Response (MailGenerationAsyncOutput)
{
"status": "completed",
"response": "Bonjour Jean Dupont, Merci de nous avoir contactés...",
"external_ref": "case-457",
"external_metadata": {
"user_id": "abc-789"
}
}
Possible status values
"started"– Generation is in progress."completed"– The response has been successfully generated."failed"– An error occurred during generation.
If status is not "completed", the response field will be null.
About external_ref and external_metadata
These optional fields help you track generation jobs on your end.
They are not used for generation, but they are:
- Stored when the request is submitted.
- Returned with the final result via the
GETendpoint.
This makes it easier to correlate the result with your internal systems — for instance, linking it to a specific user or support ticket.
Example usage
"external_ref": "case-457",
"external_metadata": {
"user_id": "abc-789",
"source": "client_dashboard"
}