GustWeb includes a small HTTP API for triggering DAG runs and resuming tasks that are waiting on external events.

Mount it inside any Phoenix API scope with the GustWeb.API router macro:

import GustWeb.API

scope "/gust/api", MyAppWeb do
  pipe_through :api

  gust_api()
end

Requests must include a bearer token matching the configured :gust_web, :api_token; in releases, the default runtime config reads it from GUST_API_TOKEN.

Available endpoints

MethodPathDescription
POST/gust/api/dags/:dag_name/runCreate and dispatch a run for a DAG.
POST/gust/api/tasks/resumeResume task runs paused by wait_for.

Trigger a DAG run

POST /gust/api/dags/:dag_name/run

Body:

{
  "params": {
    "name": "Ada"
  }
}
curl -X POST http://localhost:4000/gust/api/dags/daily_import/run \
  -H "Authorization: Bearer $GUST_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"params":{"name":"Ada"}}'

Successful requests return 201 Created with the new run id and status:

{
  "id": "123",
  "status": "enqueued"
}

Disabled DAGs create a run without enqueueing it and return "status": "created".

Resume a waiting task

POST /gust/api/tasks/resume

Body:

{
  "waiting_for": "approval",
  "run_id": 123,
  "payload": {
    "approved": true,
    "reviewed_by": "marcio"
  }
}
curl -X POST http://localhost:4000/gust/api/tasks/resume \
  -H "Authorization: Bearer $GUST_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"waiting_for":"approval","run_id":123,"payload":{"approved":true,"reviewed_by":"marcio"}}'

waiting_for must match the task's wait_for key. run_id is optional; when omitted, Gust resumes every waiting task with the same key. payload is made available to the resumed task params under "__gust_wait_payload__".

Successful requests return 200 OK with the resumed tasks:

[
  {
    "id": "456",
    "run_id": "123",
    "name": "await_approval",
    "status": "created",
    "params": {
      "__gust_wait_payload__": {
        "approved": true,
        "reviewed_by": "marcio"
      }
    },
    "result": null,
    "error": null,
    "waiting_for": null,
    "wait_satisfied_at": "2026-07-02T19:00:00Z",
    "attempt": 0,
    "map_index": null
  }
]

Errors

Unknown DAGs return 404 with {"error":"dag_not_found"}, and invalid tokens return 401 with {"error":"unauthorized"}.