Run an app
Run a published Remagica app with your own inputs and collect its outputs.
An app is one page of a workflow packaged as a form: a few inputs (a prompt, an image, a setting) and the outputs they make. It's the simplest way to run a team's workflow from code, because you only fill in the form.
Needs apps:read to read apps and apps:run to run them.
Find the app and its inputs
GET /apps lists the apps you can run: your workspace's, and community ones. GET /apps/{appId} returns one, with:
form: its inputs. Each has anodeId, akey, alabeland atype(text,image,video,audioorparameter).outputs: the nodes whose results the app returns.creditsEstimate: what a run with the app's own values costs.
An input's id is nodeId:key.
Run it
curl https://api.remagica.com/api/v1/apps/APP_ID/runs \
-H "x-api-key: $REMAGICA_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"values": {
"node_prompt_1:text": "A cozy cabin in the snow, golden hour",
"node_image_1:file": "uploads/…/reference.jpg"
},
"count": 1
}'valuesare by input id (the ids above are examples; read yours fromform). Text and parameters take their value; media inputs take a storagekeyof your workspace's file (see Uploading files).- Inputs you leave out keep the app's own value.
count(1–20) is how many results each output makes.
The run happens in a copy of the app's page in a workflow of your workspace, which pays for it. You get 202 Accepted with the app run; its run is a workflow run, and its results show up as pending at once.
Get the outputs
Follow the run as you would a workflow run: stream GET /workflows/{workflowId}/events with the run's workflowId, poll GET /workflow-runs/{runId}, or listen for the app_run.succeeded webhook.
GET /apps/{appId}/runs lists your past runs of an app.
A run that can't start is refused with 409 RUN_REFUSED, as a workflow run is.