Call it from another system
An API endpoint lets any other system — a backend, a spreadsheet macro, a CI job — run your published script with one HTTP request and get its output back as JSON. In this last lesson of the track you turn the endpoint on for daily-report, create a token, call it, and find the call on the Runs page.
- Turn an endpoint on from the editor’s Triggers tab
- Create a token and keep it safe
- Call the endpoint synchronously and asynchronously
- Protect it with a calls-per-minute limit
One script, one URL
Each script or flow can have one endpoint. It lives in the item’s Triggers tab — the same place as its schedules and events — and the project’s API page lists every endpoint of the project. Like every trigger, the endpoint runs the published version, always the latest one: there is no API version to choose and nothing to re-point after a publish.
1def main(name: str = "world"):2 print(f"saying hello to {name}")3 return {"message": f"Hello, {name}!"}1curl -X POST "$WAISO_URL/exec/p_58e3011e/hello" \2 -H "Authorization: Bearer $WAISO_TOKEN" \3 -H "Content-Type: application/json" \4 -d '{"name":"world"}'The address is POST /exec/<project-id>/<path> on your Waiso address (on a self-hosted install, on the API’s public address). The project id is the project’s permanent id, not its name, so renaming the project never breaks a caller. The path defaults to the script’s folder path and name — daily-report here.
Turn it on and call it
- Turn on the endpoint
Open
daily-reportand the Triggers tab. The API card says Not on the API yet; press Turn on endpoint. It starts as POST, synchronous, protected by a token, with inputs read from the JSON body. Configure changes any of that. (The publish toast’s Turn on endpoint does the same.) - Create a token
Under Call it, follow Create token: the API page’s settings open with a new token for this endpoint. Choose how long it lasts and press Generate token. Copy your token — it will not be shown again. Store it in your caller’s secrets as
WAISO_TOKEN. - Call it
Press Copy curl on the Triggers tab — it carries your real address and project id — and run it in a terminal with
WAISO_TOKENset. The body below sendspassing= 90. - Find the call
Open Runs: the new row says Triggered by API, with the token that was used. The API page counts the call in the endpoint’s usage.
curl -X POST "https://<your-waiso-address>/exec/<project-id>/daily-report" \
-H "Authorization: Bearer $WAISO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"passing":90}'{
"runId": "7c0e5b9a-…",
"status": "success",
"flowRunId": null,
"output": {
"total": 3,
"average": 85,
"passed": 1
},
"error": null,
"errorCode": null,
"durationMs": 38,
"totalMs": 112
}Synchronous or asynchronous
A synchronous endpoint waits for the run and answers with its output — best for anything that finishes in a few seconds. It waits up to 30 seconds; after that it answers 504 with "status": "timeout" and the run keeps going. An asynchronous endpoint answers at once with 202 and a runId; the caller then polls /exec/<project-id>/runs/<runId> until the status is final.
curl -X POST "https://<your-waiso-address>/exec/<project-id>/daily-report" \
-H "Authorization: Bearer $WAISO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"passing":90}'
# → 202 {"runId": "…"}; then poll until it finishes:
curl "https://<your-waiso-address>/exec/<project-id>/runs/$RUN_ID" \
-H "Authorization: Bearer $WAISO_TOKEN"| HTTP status | Means |
|---|---|
200 | The run succeeded; read output. |
202 | Async call accepted (or a flow waiting for an approval); poll with the runId. |
401 | Token missing, invalid, revoked, expired or not allowed for this endpoint; code says which. |
422 | Your script ran and failed (it raised, timed out or was cancelled); errorCode says which. Retrying the same call fails the same way. |
429 | Over the calls-per-minute limit; no run started. |
503 | The platform lost the run (no worker available); worth retrying. |
Tokens and limits
- A token calls only the endpoints it lists — a new endpoint needs the token edited to include it. Prefer one token per caller, scoped to what it calls, so revoking one never breaks the others.
- Calls per minute (Triggers → Limits): callers over it get
429with aRetry-Afterheader and{"code": "rate_limited", "retryAfter": …}; no run starts and nothing is charged. - Runs at the same time: extra runs wait in the queue instead of failing. Both are empty by default — then only your plan’s limit applies.