Working with the API

Workflow runs, credits and results

Estimate a workflow’s credit cost before you start it. Poll the run by ID to check its status, then look up the results by node in the space.

How much will a workflow run cost?

An estimate says what a run would make and what it would cost in credits. It starts nothing and spends nothing. Say what to run: all for the whole space, nodes with their IDs, or group with a group’s ID.

POST /spaces/{space}/runs/estimate
curl -H "Authorization: Bearer $HYPERMAKE_KEY" -H "Content-Type: application/json" -d '{"kind":"all"}' \ "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/spaces/$SPACE/runs/estimate"

Start a run with a credit budget

Start the run with the same target, an ID you make and the credits you approve. When the price has grown past what you approved, nothing starts: the answer is 409 and carries the new estimate, so you can agree to it and send the request again.

POST /spaces/{space}/runs
curl -H "Authorization: Bearer $HYPERMAKE_KEY" -H "Content-Type: application/json" \ -d '{"id":"run_01jd…","target":{"kind":"all"},"approvedCredits":12}' \ "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/spaces/$SPACE/runs"

How do I check a run’s status?

Poll GET /spaces/{space}/runs/{run} every few seconds. Stop polling when the status is succeeded, failed or cancelled.

StatusWhat it means
runningSomething of the run is being made or is about to be.
pausedIt waits: for credits, or for a higher approval than it was started with.
succeededEverything was made.
failedSomething could not be made. Each job says why.
cancelledIt was stopped. What was already being made finished and was paid for.
GET /spaces/{space}/runs/{run}
curl -H "Authorization: Bearer $HYPERMAKE_KEY" "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/spaces/$SPACE/runs/$RUN"

Retrieve results for a node

List results for the space, newest first. Use the node query parameter to narrow the results to one node. For a file result, look up its fileId in the Library to get the download link.

GET /spaces/{space}/results
curl -H "Authorization: Bearer $HYPERMAKE_KEY" "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/spaces/$SPACE/results?node=$NODE"

Cancel a run

Cancelling stops what a run has not started yet. What is already being made finishes and is paid for.

POST /spaces/{space}/runs/{run}/cancel
curl -H "Authorization: Bearer $HYPERMAKE_KEY" -X POST "https://0a2d5g5qtj.execute-api.eu-north-1.amazonaws.com/v1/organizations/$HYPERMAKE_ORG/spaces/$SPACE/runs/$RUN/cancel"