Create Run
Start an asynchronous workflow run. Returns 202 Accepted with a run id and polling URLs.
curl --fail-with-body --silent --show-error -X POST 'https://api.edgaze.ai/v1/runs' \
-H "Authorization: Bearer $EDGAZE_API_KEY" \
-H 'Content-Type: application/json' \
--data '{"workflow":"550e8400-e29b-41d4-a716-446655440000","inputs":{"input_node_id":"replace with a value matching inputSchema"},"idempotencyKey":"replace-with-one-stable-request-id"}'Developers building with the Edgaze API.
https://api.edgaze.ai/v1/runsOverview#
This is the primary execution endpoint. It accepts a workflow id and an inputs object, validates required inputs, entitlement, and spend caps synchronously, then returns 202 Accepted with a run id and URLs for polling.
Runs are asynchronous. A successful response means the request was accepted, not that the run finished. Always follow statusUrl until the run reaches a terminal state, then read outputs from the same response or from GET /runs/{id}/events for step-level progress.
Build inputs from the selected workflow's current inputSchema; there is no universal field such as topic. Every key must match either one published nodeId or its exact input name. Unknown keys are rejected so spelling mistakes cannot be silently ignored. Send an Idempotency-Key header and reuse it when retrying the same logical POST so a network retry does not create another billable run.
You may use a field's nodeId or name alias. Do not send both with different values: conflicting aliases return 400 invalid_inputs. Sending both is accepted only when their values are identical. When two published fields share a name, that name is ambiguous and you must use their node IDs.
Authorization#
Requires run:execute.
run:executeParameters#
Headers
AuthorizationstringheaderrequiredBearer token with run:execute scope.
Example: Bearer edgaze_sk_live_…
Idempotency-KeystringheaderPreferred idempotency location. Maximum 255 characters. If the body field is also present, both values must match.
Example: order_8f31_run_1
Request body
workflowstringbodyrequiredWorkflow UUID.
Example: 550e8400-e29b-41d4-a716-446655440000
inputsobjectbodyStrict map of exact input names (or nodeIds) to values matching inputSchema. Unknown keys and conflicting aliases are rejected. May be empty only when the workflow has no required inputs.
Example: {"topic": "AI agents", "tone": "Technical"}
versionstringbodyOptional immutable workflow version UUID. The caller must be entitled to this version.
Example: 8f57e8f7-7b74-4fe2-a425-722a135d93aa
idempotencyKeystringbodyCompatibility body location for the idempotency key. Prefer the Idempotency-Key header.
Version resolution#
POST /runs pins each run to one immutable workflow version. The same workflow id can therefore execute different graphs for different callers, and the resolution rules are as follows:
- Explicit pin. When you set
versionin the request body to an immutable version id you are entitled to, the run executes that exact graph. Owners can select any version in the workflow's history; buyers can select the version their purchase pin already covers. - Purchase pin. When you omit
versionand hold a purchase row whoseworkflow_version_idis non-null, the run executes that pinned version. A creator publishing a newer version does not silently upgrade you. - Follow active. When you omit
versionand your purchase pin is null (or you have no purchase row), the run executes the workflow's currentactive_version_id. Callers who fall in this path float with each publish.
Cache pinnedVersionId, activeVersionId, and updateAvailable from GET /workflows/{id} to reason about drift. When updateAvailable flips to true, review the new version before the next run: input shapes and output shapes can change between versions.
Sending an unknown or forbidden version returns 403 forbidden. The public API never reveals whether an unknown version id belongs to another workflow.
Idempotency#
Use the Idempotency-Key HTTP header. The compatibility field idempotencyKey in the JSON body is also accepted. If both are present they must be identical after surrounding whitespace is removed; otherwise the request returns 400 invalid_request. Header names are case-insensitive under HTTP, while key values are case-sensitive.
Keys may contain any non-empty string up to 255 characters. Uniqueness is scoped to the Edgaze account behind the API key, not to one API key or workflow. Records have no time-based expiry in the current implementation; a key remains reserved while its run record exists.
The request fingerprint covers the workflow, normalized inputs, and requested version. Reusing a key with the same request returns 202 and the original run URLs without creating or charging another run. Reusing it with a different request returns 409 idempotency_conflict. A failed or cancelled run is still the original result for that key. To intentionally retry execution as a new run, use a new key.
Canonical funding and acceptance behavior#
This table is the source of truth for REST run creation. Other billing pages link here instead of redefining the POST /runs timing.
| Condition | HTTP response | Run record and initial response status | Failure timing and signal | Buyer charge / creator earnings | Safe retry |
|---|---|---|---|---|---|
| Valid hosted, BYOK, paid marketplace, or free run | 202 | Created; response status is accepted | Execution continues asynchronously | Charged and creator earnings recorded only on success; BYOK uses its documented margin and orchestration pricing | Same idempotency key replays the original run |
| API-key spend cap exceeded | 402 spend_cap_reached | No run record | Synchronous, before wallet or bundle reservation | No charge; no creator earnings | Retry after raising the cap or after its window resets |
| Account-level spend cap | Not implemented for POST /runs | N/A | Only an API-key cap is enforced | N/A | N/A |
| Eligible workflow bundle | 202 | Created; accepted | Bundle reservation occurs during asynchronous preparation | One bundle run is consumed only on success; creator earnings recorded on success | Same key replays; a new key creates a new run |
| Bundle depleted, expired, wrong version, or lost reservation race | 202 | Created; accepted | Preparation falls through atomically to wallet | Wallet is charged only on success | Same key replays the outcome |
| Wallet insufficient, including a balance race | 202 | Created; accepted, then failed | Asynchronous run.completed with failed outcome and reason Insufficient funds to cover this run | No charge; no creator earnings | Same key returns the failed run; use a new key after funding |
| Demo or builder test | Not started through this public endpoint | N/A | Use the product's demo or builder surface | Never charged; no creator earnings | Follow the surface-specific retry behavior |
| Input or compute envelope rejected before execution | 400 invalid_inputs for schema errors; envelope rejection may fail during preparation | Schema errors create no run; a preparation-time rejection has a run record | Synchronous for published input validation; otherwise asynchronous | No charge; no creator earnings | Correct the input, then use a new key |
| Compute limit reached during execution | 202 | Created; accepted, then terminal failure | Asynchronous terminal run event | Creator margin is released; already consumed compute may remain charged | Same key replays; use a new key only if another execution is intended |
| Payment authorization failure | Not applicable at run time | Run creation never authorizes a card | Runs spend existing wallet or bundle funds; top-up authorization is a separate checkout | No run-time card charge | Resolve checkout separately |
File inputs#
POST /runs accepts JSON, not multipart form data. For an input whose schema type is file, send a JSON-safe WorkflowMedia object under that input's nodeId:
{
"__workflowMedia": true,
"kind": "image",
"url": "https://example.com/input.png",
"mimeType": "image/png",
"filename": "input.png"
}Use an HTTPS URL your workflow can retrieve, or replace url with a raw base64 field. Never put an API key or authorization token in the media URL.
Response#
Only POST /runs is rate-limited (60 req/min per key). Invalid JSON returns 400 invalid_json. Missing workflow returns 400 missing_workflow. Missing, unknown, conflicting, or incorrectly typed workflow inputs return 400 invalid_inputs before a run or billing reservation is created. Reusing an idempotency key with a different workflow, normalized inputs, or requested version returns 409 idempotency_conflict.
Example payloads are in the request/response panel above.
Edge cases#
POST returns 202 before wallet funding is verified. If balance is insufficient, the run fails asynchronously. Poll GET /runs/{id} and check for status failed.
spend_cap_reachedSpend cap checks happen before the run row is created. A cap breach returns 402 immediately with no run ID.
rate_limitedRate limiting is enforced before run execution. A 429 never creates a partial run.
API runs use identical entitlement, wallet, bundle, and BYOK billing paths as runs started from the web app.
Send idempotencyKey and reuse the same value when retrying one logical request. Use a new value only for a genuinely new run.
invalid_inputsUnknown keys, ambiguous name aliases, and different values supplied for the same field by name and nodeId return 400 invalid_inputs before billing or run creation.
Was this useful?
Your response helps us improve the documentation.