Skip to main content
Retrieve tasks with various filtering options including status, date ranges, pagination, and more.

List Tasks

const API_KEY = process.env.TELA_API_KEY;

// Build URL with query parameters
const url = new URL('https://api.tela.ai/task');

// Optional parameters
url.searchParams.append('limit', '10');
url.searchParams.append('offset', '0');
url.searchParams.append('status', 'completed');
url.searchParams.append('order', 'desc');
url.searchParams.append('orderBy', 'createdAt');

const response = await fetch(url, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  }
});

const data = await response.json();
console.log(data);

Query Parameters

NameTypeRequiredDescription
limitstringNoNumber of tasks to return
offsetstringNoNumber of tasks to skip for pagination
objectLinksstringNoInclude object links in response
statusstringNoFilter by task status
sincestringNo[DEPRECATED] Use approvedAtSince instead
untilstringNo[DEPRECATED] Use approvedAtUntil instead
approvedAtSincestringNoFilter tasks approved after this date (ISO 8601)
approvedAtUntilstringNoFilter tasks approved before this date (ISO 8601)
createdAtSincestringNoFilter tasks created after this date (ISO 8601)
createdAtUntilstringNoFilter tasks created before this date (ISO 8601)
updatedAtSincestringNoFilter tasks updated after this date (ISO 8601)
updatedAtUntilstringNoFilter tasks updated before this date (ISO 8601)
approvedBystring[]NoFilter by users who approved the tasks
createdBystring[]NoFilter by users who created the tasks
promptApplicationIdstringNoFilter by prompt application ID
promptVersionIdstringNoFilter by prompt version ID
completionRunIdstringNoFilter by completion run ID
orderBystringNoField to order results by
orderstringNoSort order: asc or desc
idsstringNoFilter by specific task IDs (comma-separated)
taskNamestringNoFilter by task name
excludeInputOutputColumnsbooleanNoExclude input/output columns from response
tagsstringNoFilter by tags

Response

The response returns an array of task objects with the following properties:
FieldTypeDescription
idstringUnique identifier for the task (UUID)
namestringName of the task
statusstringCurrent status of the task
promptApplicationIdstringUUID of the associated prompt application
inputContentobjectInput content for the task
outputContentobject or nullOutput content from the task
tagsarrayTags associated with the task
createdAtstringCreation timestamp
updatedAtstringLast update timestamp
approvedAtstring or nullApproval timestamp

Example Response

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Document Analysis Task",
      "status": "completed",
      "promptApplicationId": "550e8400-e29b-41d4-a716-446655440001",
      "inputContent": {
        "variables": {
          "document": "Sample document content"
        }
      },
      "outputContent": {
        "content": {
          "summary": "This is a summary of the document."
        }
      },
      "tags": ["analysis", "documents"],
      "createdAt": "2023-01-01T00:00:00.000Z",
      "updatedAt": "2023-01-02T00:00:00.000Z",
      "approvedAt": "2023-01-02T12:00:00.000Z"
    }
  ],
  "metadata": {
    "total": 1,
    "limit": 10,
    "offset": 0
  }
}