Preview when a schedule would fire
Projects a schedule trigger's configuration into the cron it compiles to and the next 5 times it would actually fire. A schedule is the one trigger you cannot test by pressing a button, so this is the only feedback available before production; it is computed by the scheduler's own cron code, so the preview cannot disagree with the runtime.
The path is literal and static — schedule here is the piece id, not a path parameter. It always previews the schedule piece.
AN UNUSABLE SCHEDULE IS STILL A 200. An invalid cron or unknown frequency comes back as {"cron":"","timezone":"","error":"unknown frequency: ..."} — a normal answer carried in the body, never an HTTP error. When error is present, nextRuns is absent, and vice versa. Check for error before trusting the result.
The body is optional; an absent body previews the schedule piece's DEFAULTS (hourly, weekdays only). Note that run_on_weekends defaults to false, so frequency: every_day compiles to 0 H * * 1-5 and skips Saturday and Sunday — the preview is where you catch that.
The number of fire times is fixed at 5 and cannot be requested.
Runs on a worker, so it is 503 when the fleet is down. Send Content-Type: application/json if you send a body.
Authorization
bearerAuth An API token: Authorization: Bearer grt_…. Mint one in the app under Settings → Workspace → API tokens; the raw value is shown once. Scopes confine the token — see x-permission on each operation.
In: header
Request Body
application/json
The schedule trigger's config object, exactly as it would sit in the definition. Get its legal fields from GET /api/pieces/schedule/triggers/schedule?frequency=<value>.
TypeScript Definitions
Use the request body type in TypeScript.
The schedule trigger's configuration to preview.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/pieces/schedule/next-runs" \ -H "Content-Type: application/json" \ -d '{}'{ "data": { "cron": "string", "timezone": "string", "nextRuns": [ "2019-08-24T14:15:22Z" ], "error": "string" }}