Run Spell
The Run Spell endpoint lets you call your spell programmatically. We have two modes you can use:
- Wait Mode (
wait: true
): Will keep the connection open until the spell returns. Best for spells that run quickly (< 60s). - Polling Mode (
wait: false
): Will return a spell run ID for you to poll for results.
Wait Mode is simpler to implement, and works for most spells. Polling Mode is best for long-running spells, or if your architecture isn’t suited for handling long-running connections.
To call a spell, you’ll need to enter the spell ID (found in the URL or on the spell page’s API tab) and the JSON representation of the inputs (found in the spell page’s API tab).
Wait Mode
To start the spell run:
The spell run results will be returned as JSON in the response body:
Polling Mode
To start the spell run:
The spell run ID will be returned as JSON in the response body:
You can use the spell run ID to poll for results:
The spell run results will be returned as JSON in the response body once the run is successful: