Running your spell

Runs this spell from start to finish. Supply the inputs values for each block and the outputs will be based on the spell modelsโ€™ interactions with these inputs. To always run the latest version of the spell, omit the spell version ID.

Javascript
const response = await fetch('https://api.respell.ai/v1/run', {
  method: 'POST',
  headers: {
    authorization: 'Bearer ' + RESPELL_API_KEY,
    accept: 'application/json',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    spellId: RESPELL_SPELLID,
    // This field can be omitted to run the latest published version
    spellVersionId: RESPELL_SPELL_VERSIONID,
    // Fill in a value for your dynamic input block
    inputs: {
      input: 'Example text',
    },
  }),
});