Requests and Responses

Currently we only have 2 API endpoints, which are execute Prompts and execute Workflows. You can use the endpoints to deploy individual prompts or the whole workflow.

Prompt ID

All prompts have a unique id used to reference it. You can find the id at the end of the URL:

Execute Prompt

API Examples

This example API involves a prompt that takes the information of a character and generate the character's background story.

These are some body parameters that requires user input:

Body ParametersDescriptionExample

{{ Your API Key }}

Your API token

input

Your list of inputs in the prompt.

{
    "name": "",
    "age": "",
    "physical_traits": ""
  }

fetch

The prompt ID retrieved from the URL

https://pms.chasm.net/api/prompts/execute/3129

Sample Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{ Your API Key }}");

var raw = JSON.stringify({
  "input": {
    "name": "Alaric",
    "age": 30,
    "physical_traits": "strong, kind"
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://pms.chasm.net/api/prompts/execute/3129", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Sample Response

{
    "output": "Name: Alaric\n Age: 30\n Physical Traits: Strong and muscular, with a commanding presence\n Backstory: Alaric is a seasoned warrior, known for his strength and kindness. He hails from a noble lineage and has been a protector of his people for many years. His unwavering dedication to justice and his ability to inspire others make him a natural leader.",
}


Workflow ID

All workflows have a unique id used to reference it. You can find the id at the end of the URL:

Execute Workflow

API Examples

This example API involves a workflow that combines the information of two characters from a previously generated prompt and creates a story based on the given input.

These are some body parameters that requires user input:

Body ParametersDescriptionExample

{{ Your API Key }}

Your API token

input

The list of global inputs in the workflow does not take any input from previous outputs.

{
    "name": "",
    "age": "",
    "physical_traits": "",
    "name2": "",
    "age2": "",
    "physical_traits2": ""
  }

fetch

The workflow ID retrieved from the URL

https://pms.chasm.net/api/workflows/execute/785

Sample Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer {{ Your API Key }}");

var raw = JSON.stringify({
  "input": {
    "name": "Alaric",
    "age": "30",
    "physical_traits": "strong, kind",
    "name2": "Mary",
    "age2": "28",
    "physical_traits2": "Swift"
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://pms.chasm.net/api/workflows/execute/785", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Sample Response

{
    "output": "Alaric and Mary found themselves face to face on the battlefield, their swords clashing with a resounding clang. Alaric, with his imposing stature, swung his sword with the force of a thunderstorm, while Mary, swift and agile, darted around him like a playful breeze. Their fight was a dance of strength and speed, each trying to gain the upper hand.\n\"Ha! You're quick, I'll give you that,\" Alaric grunted, impressed by Mary's nimbleness as she dodged his attacks.\n\"And you're strong, but a little slow,\" Mary teased, her eyes sparkling with mischief as she evaded Alaric's powerful strikes with ease.\nTheir banter continued as they fought, the clash of their swords accompanied by laughter and light-hearted taunts. Despite their differences in fighting styles, they found a strange harmony in their battle, a mutual respect growing between them with every exchange.\nAs their fight drew to a close, both combatants paused, panting and grinning at each other. \"You fight well, Mary,\" Alaric said, a hint of admiration in his voice.\n\"Likewise, Alaric. I didn't think a big guy like you could move so fast,\" Mary replied, a playful glint in her eyes.\nWith a nod of mutual respect, they sheathed their swords, their fight ending not with animosity, but with newfound camaraderie. As they walked away from the battlefield, their laughter echoed in the air, two warriors who had met as adversaries and emerged as unlikely friends."
}

Last updated