Description
This endpoint allows you to execute a specific workflow by providing its ID and required input parameters.
Request Body
Content-Type: application/json
{
"story": "string" // The story input parameter for the workflow
}
Authentication
Requires a Bearer token in the Authorization header.
Example Request
curl --request POST \
--url https://aitutor-api.vercel.app/api/v1/run/wf_b1c45lj9pabaotitahwfk9gb \
--header 'Authorization: Bearer sk_h9e86nd9jfo5dyojrg9qaaq90bqo185p' \
--header 'Content-Type: application/json' \
--data '{"story":"a story about a dog named charlie"}'
Response
{
"success": true,
"run_id": "run_abc123xyz",
"status": "completed",
"output": {
"generated_story": "Once upon a time, there was a friendly dog named Charlie..."
}
}
Path Parameters
Name | Required | Type | Description |
---|
workflow_id | Yes | string | The ID of the workflow to run |
Request Parameters
Name | Required | Type | Description |
---|
story | Yes | string | The story prompt for the workflow |
Error Responses
{
"success": false,
"error": {
"message": "Invalid API key",
"code": "unauthorized"
}
}
{
"success": false,
"error": {
"message": "Workflow not found",
"code": "workflow_not_found"
}
}
{
"success": false,
"error": {
"message": "Missing required parameter: story",
"code": "invalid_request"
}
}
Code Examples
Python
import requests
url = "https://aitutor-api.vercel.app/api/v1/run/wf_b1c45lj9pabaotitahwfk9gb"
headers = {
"Authorization": "Bearer sk_h9e86nd9jfo5dyojrg9qaaq90bqo185p",
"Content-Type": "application/json"
}
data = {
"story": "a story about a dog named charlie"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
NodeJS
const axios = require('axios');
const url = 'https://aitutor-api.vercel.app/api/v1/run/wf_b1c45lj9pabaotitahwfk9gb';
const headers = {
'Authorization': 'Bearer sk_h9e86nd9jfo5dyojrg9qaaq90bqo185p',
'Content-Type': 'application/json'
};
const data = {
story: 'a story about a dog named charlie'
};
axios.post(url, data, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));