Skip to main content
Within your Workstation App you can create tasks and review their output to check if the answers are correct.

Creating tasks via API

Creating a new task is similar to making a call to your Canvas, except that instead of passing your canvas_id, you’re going to pass your application_id. Head to your Workstation App page and follow these steps:
1

Open the app settings

At the top bar, click on the three dots next to the Share button and select Settings.Connect via API
2

Get your app data

Open the API tab. Here you will find your App ID and all the necessary info to start creating tasks with our API. Choose your preferred language and use one of the snippets provided to get started!
By default, all tasks are created as if they were async completions. You’ll receive a success response and the task will have a running status. You have two options for consuming the result of the task:
  • Polling during execution
  • Passing a webhook URL

Polling tasks during execution

You can do a simple polling until the task leaves the running status. When the run finishes, the task moves to validating (the output is ready and waiting for review), or to failed. It only becomes completed after someone approves it in the App. To poll the status of a task after creating it we can make a request to our API /task endpoint.

Passing a webhook URL

You can pass a webhook_url to your API call. This way you’ll receive a POST request in your endpoint when the task finishes.

Webhook Response Structure

When a task completes, your webhook endpoint will receive a POST request with the following structure:
Key fields in the webhook response:
  • status: Can be “created”, “running”, “succeeded”, or “failed”
  • input_content: Contains the variables and messages sent in the request
  • output_content: Contains the structured output from your Canvas, matching your defined output schema
  • raw_output: The raw output data in the format defined by your Canvas outputs

Fetching tasks

To retrieve tasks from an app, you can send a GET request to the /task endpoint. This endpoint supports various optional parameters for filtering and pagination:

Pagination parameters

  • limit: Number of results per response (default: 10, range: 1-100)
  • offset: Starting position of results (default: 0)

Filtering parameters

  • status: Array of task statuses (options: “created”, “running”, “validating”, “completed”, “failed”)
  • since: Start date for filtering tasks (format: timestamp or ISO 8601)
  • until: End date for filtering tasks (format: timestamp or ISO 8601)
  • approvedBy: Email of the user who approved the task
  • revisionProcess: Type of revision received (options: “approvedWithRevisions”, “approvedDirectly”)
  • promptApplicationId: ID of the application where the task was created
  • promptVersionId: ID of the Canvas version used to create the task
  • ids: Array of specific task IDs to retrieve

Sorting parameters

  • orderBy: Field to sort by (options: “name”, “reference”, “approvedAt”, “createdAt”, “updatedAt”, “id”, “status”, “approvedBy”, “createdBy”)
  • order: Sort direction (options: “asc” or “desc”)

Example request

Here’s an example of fetching 50 completed tasks created after November 1st, 2024, sorted by name in ascending order: