Generate a text draft
Generate an actor-owned draft through the shared AI gateway with an explicit currency, charge cap and exact retry key. The prompt can request drafting, translation or platform adaptation; browser task controls prepare that prompt without adding API fields. May reserve/spend Service Balance; never saves or publishes a post. Optional workspace query selects an existing Account workspace with current placement and Social action permissions; the key organisation is fixed. For POST, workspace belongs in the query, never the body. Version v1.
Parameters
| Name | Body | Description |
|---|---|---|
requestKey | POST | Stable key for this exact request. Retain the original body and key when recovering a lost response; do not start a new provider write to resolve an unknown outcome. |
modelId | POST | ID returned by the corresponding ready text-model or media-model listing. Availability and current AI permission are checked again before use. |
prompt | POST | Human-reviewed instructions and reference text for the configured AI model. Generation does not publish a post or send a reply. |
maxChargeMinor | POST | Maximum authorized AI charge as a positive integer in minor currency units. This spending limit is not an additional charge. |
currency | POST | Explicit wallet/model currency code used for the reviewed spending limit. A changed or mismatched currency is refused. |
Request
curl -X POST "https://api.wrnexus.com/social/generate-text?workspace=workspace-id" \
-H "Authorization: Bearer $WRNEXUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"requestKey": "text_generate_001",
"modelId": "model-id",
"prompt": "Draft a launch post for human review.",
"maxChargeMinor": 50,
"currency": "INR"
}'Body
{
"requestKey": "text_generate_001",
"modelId": "model-id",
"prompt": "Draft a launch post for human review.",
"maxChargeMinor": 50,
"currency": "INR"
}Response
200 (or 201 for a new send) on success:
{
"ok": true,
"data": {
"id": "draft-id",
"status": "completed",
"text": "Illustrative generated text for human review.",
"currency": "INR",
"charged_minor": 25,
"error_code": null
},
"requestId": "illustrative-request"
}Errors
Every error uses the same envelope, with a stable error.code to branch on and a requestId to reference when contacting support:
{
"ok": false,
"error": {
"code": "operation-not-allowed",
"message": "This API key is not allowed to use sms/send."
},
"requestId": "req_0f2a9c"
}| Status | Code | Meaning |
|---|---|---|
| 401 | api-key-required / api-key-invalid | Missing, invalid, revoked or expired key. |
| 403 | operation-not-allowed | The key isn't scoped for this app/operation. |
| 403 | kyc-required | The organization hasn't completed identity verification. |
| 403 | ip-not-allowed | The caller's address isn't on the allowed list. |
| 404 | message-not-found | No message with that id for this organization. |
| 429 | rate-limited | Too many requests for this key in the last minute. |
| 502 | app-unavailable | The app didn't respond. Safe to retry. |