Skip to main content
POST
Stealth Agent Async Runs
The async Stealth Agent API lets you start a long-running generation job, return immediately, and receive the final result later by polling or webhook callback. Use it for integrations, automations, UI backends, and agent platforms where a multi-minute HTTP request is unreliable.
If you need a simple one-off script and can keep the connection open for up to 10 minutes, use the synchronous POST /api/stealthify/agent endpoint. For production integrations, prefer async runs.

Flow

1

Create a run

Send POST /api/stealthify/agent/runs with the same preset body as the synchronous endpoint. Optionally include webhookUrl and idempotency-key.
2

Store the run id

The API returns 202 Accepted with runId, status: "queued", and statusUrl.
3

Poll or wait for webhook

Call GET /api/stealthify/agent/runs/{runId} until status is completed, failed, or cancelled. If webhookUrl was provided, StealthGPT also sends the terminal payload to that URL.

Authentication

string
required
Your Stealth API token from the Stealth API dashboard.

Create a run

POST https://stealthgpt.ai/api/stealthify/agent/runs

Headers

string
required
Your Stealth API token.
string
required
Must be application/json.
string
Optional key, 1-255 characters. Reuse the same key when retrying the same create request to avoid enqueueing duplicate runs.

Request body

The async create body uses the same strict preset discriminated union as POST /api/stealthify/agent, plus optional webhookUrl and webhookSecret.
string
required
One of "academic", "seo", or "social".
string
required
Topic or instructions for the document (non-empty).
string
Required only when preset is "social". Must be "linkedin" or "medium".
boolean
default:"false"
When true, runs a fact-check pass on the draft and applies fixes before humanization.
boolean
default:"false"
When true, may embed generated images in the final markdown where supported.
string
Optional URL that receives a POST callback when the run reaches a terminal status.
string
Optional signing secret, 16-255 characters. When present, StealthGPT signs webhook callbacks with HMAC-SHA256.

Response: 202 Accepted

string
required
Identifier of the queued Stealth Agent run.
string
required
Always "queued" for a successful create response.
string
required
Relative polling URL: /api/stealthify/agent/runs/{runId}.

Poll run status

GET https://stealthgpt.ai/api/stealthify/agent/runs/{runId}

Headers

string
required
Your Stealth API token. The run must belong to this token’s account.

Path parameters

string
required
The runId returned from POST /api/stealthify/agent/runs.

Queued response

Returned before the generation row has started.

Running response

string
required
Run identifier.
string
required
academic, seo, or social.
string
required
"running".
string
required
ISO timestamp for run creation.
string
required
ISO timestamp for the latest run update.
string | null
required
Current pipeline step, or null while the run is starting. Possible step ids include web_research, keywords_research, competitor_analysis, social_research, generate_text, meta_generation, fact_check, humanize, image_generation, and citations.
string | null
required
Human-readable current operation, or null while the run is starting.

Completed response

The completed polling response is also the successful webhook callback body.
string
required
Identifier of the saved document record for this run.
string
required
Final content as markdown.
number
required
Word count of result used for billing.
number
required
Stealth API words charged for this request.
number
required
Prepaid word balance after this charge.
string
required
"prepaid" when covered from balance, or "payg" when metered usage was applied.
number
required
Words billed to metered usage for this request (0 when fully prepaid).

Failed response

failed can mean generation failed or billing could not be completed after generation.
Possible error.code values:

Cancelled response

Webhook callbacks

If webhookUrl is present in the create request, StealthGPT sends a best-effort POST when the run reaches a terminal status: completed, failed, or cancelled.

Headers

string
application/json
string
StealthGPT-API-Webhook/1.0
string
stealth_agent.run.completed, stealth_agent.run.failed, or stealth_agent.run.cancelled.
string
The run id.
string
Unix timestamp in seconds. Present on every webhook callback.
string
Present when webhookSecret was provided. Format: v1={hex_hmac_sha256}.

Delivery behavior

  • Webhook delivery uses a 10-second timeout.
  • Network errors, timeouts, 429, and 5xx responses are retried up to 3 attempts.
  • 4xx responses other than 429 are treated as final failures.
  • Webhook delivery is best-effort: a failed callback does not change the run status.
  • The callback body is the same terminal payload returned by GET /api/stealthify/agent/runs/{runId}.
  • When webhookSecret is provided, the signature is computed over ${timestamp}.${rawBody} using HMAC-SHA256.
  • Reject signed callbacks with old timestamps. A 5-minute tolerance is recommended.

Verify a signature

Use the raw request body exactly as received. Re-serializing parsed JSON can change whitespace and produce a different signature.
nodejs

Examples

Errors

Usage notes

  • Use idempotency-key whenever your create request can be retried by a queue, workflow engine, or HTTP client.
  • Poll every 5-15 seconds; there is no benefit to polling every second.
  • Store runId, statusUrl, and your own job id together so webhook handlers can reconcile callbacks with queued work.
  • Billing uses output words only: charged words = ceil(outputWords × 10) toward your Stealth API balance.