list-checkget_tasks

imerit_ango.sdk.SDK.

get_tasks(project_id, page, limit, status, stage, batches, include_answer, task_filter, sort, fields)

Retrieve detailed information for tasks.

Tasks in projects are paginated. A maximum of 1000 items per page can be obtained. See the code snippets below for an example of how to download all tasks from a project by flipping through the pages.

Parameters

  • project_id: string

  • page: integer, default 1

    • Current page.

    • Example: 1

  • limit: integer, default 10

    • Page size. Default 10, maximum 1000.

    • Example: 100

  • status: string, default None, {None, "TODO", "Completed"}

    • Filter tasks by status.

    • Example: 'Completed'

  • stage: string, default None

    • Pass a stage ID to filter tasks by stage. You can obtain a stage's ID by running get_export(project_id)on the project where you'd like to get the stage IDs.

    • Example: 'Label' or "1a1a2d88-ddad-457a-aac8-fe50a3a65272"

  • batches: list[str], default None

    • Filter tasks by batch (e.g., only get tasks belonging to the batch specified)

    • Example: ['batch_1', 'batch_2']

  • include_answer: bool, default False

    • If set to True, the response will contain the "answer" field which contains the annotations for each task.

  • task_filter: TaskFilter, Optional

    • Applies advanced filtering rules to narrow down the returned tasks.

    • Example: TaskFilter(stage=["Completed"])

    • More information about the TaskFilter class is available here.

  • sort: string, Optional

    • Specifies the ordering of the returned tasks based on a given rule.

    • Sort tasks in ascending order by specifying the field name directly (e.g., "externalId"), or in descending order by prefixing the field name with a minus sign (e.g., "-externalId").

    • Multiple sorting criteria can be combined using commas and are applied sequentially in the order they are specified. (e.g., "-priority, -createdAt")

    • Example: "-externalId"

  • fields: string, Optional

    • Limits the response to only the specified task fields.

    • Example: "externalId,createdBy,createdAt"


TaskFilter

Defines a structured and expressive way to filter tasks.

  • stage: List[str] or StringFilter

    • Filters tasks by workflow stage.

    • Examples:

      • TaskFilter(stage=["stage_id_1", "stage_id_2"])

      • TaskFilter(stage=[StringFilter(eq="stage_id_1")]

  • batches: List[str] or StringFilter

    • Filters tasks by batch identifiers.

    • Examples:

      • TaskFilter(batches=["batch_id_1", "batch_id_2"])

      • TaskFilter(batches=[StringFilter(eq="batch_id_1")]

  • status: TaskStatus, string, StringFilter

    • Filters tasks by status of tasks.

  • review_status: ReviewStatus, string, StringFilter

    • Filters tasks by review outcome.

  • task_type: TaskType, string, StringFilter

    • Filters tasks by type.

  • assignee: string or StringFilter

  • external_id: string or StringFilter

    • Filters tasks by external ID.

    • Examples:

      • TaskFilter(external_id="image-1.png")

      • TaskFilter(external_id=StringFilter(in_list=["image-1.png", "image-2.png"]))

  • created_at: DateRange

    • Filters tasks based on creation timestamp.

    • Example:

      • TaskFilter(created_at=DateRange(gte=datetime(2024, 1, 1)))

  • updated_at: DateRange

    • Filters tasks based on last update timestamp.

    • Example:

      • TaskFilter(updated_at=DateRange(lte=datetime(2025, 12, 31)))

  • created_by: string or StringFilter

  • updated_by: string or StringFilter

  • priority: int or NumberRange

    • Filters tasks by priority level.

    • Examples:

      • TaskFilter(priority=100)

      • TaskFilter(priority=NumberRange(gte=10))

  • duration: NumberRange

    • Filters tasks by the duration of the current stage (in seconds).

    • Example: TaskFilter(duration=NumberRange(gte=3600))

  • total_duration: NumberRange

    • Filters tasks by total accumulated duration across all stages (in seconds).

    • Example: TaskFilter(total_duration=NumberRange(lte=3600))

  • open_issues_count: int or NumberRange

    • Filters tasks by the number of open issues.

    • Examples:

      • TaskFilter(open_issues_count=1)

      • TaskFilter(open_issues_count=NumberRange(gte=1))

  • is_draft: bool

    • Filters tasks based on draft status.

    • Example: TaskFilter(is_draft=True)

  • is_skipped: bool

    • Filters tasks that were skipped during processing.

    • Example: TaskFilter(is_skipped=True)

  • is_benchmark: bool

    • Filters benchmark tasks.

    • Example: TaskFilter(is_benchmark=True)

StringFilter

Defines filtering rules for string-based task fields.

Parameters:

  • eq: string, Optional

    • Matches tasks where the field value is exactly equal to the specified string.

    • Example: StringFilter(eq="completed")

  • ne: string, Optional

    • Matches tasks where the field value is not equal to the specified string.

    • Example: StringFilter(neq="draft")

  • regex: string, Optional

    • Matches tasks where the field value satisfies the given regular expression.

    • Example: StringFilter(regex="^batch_.*")

  • in_list: List[string], Optional

    • Matches tasks where the field value is included in the provided list of strings.

    • Example: StringFilter(in_list=["batch-1", "batch-2"])

  • nin: List[string], Optional

    • Matches tasks where the field value is not included in the provided list of strings.

    • Example: StringFilter(nin=["batch-1", "batch-2"])

  • exists: bool, Optional

    • Matches tasks based on whether the field exists or is defined.

    • Example: StringFilter(exists=True)

circle-info

Each field is optional. You may specify one or more filters depending on your use case.

Returns:

  • output: dict

    • A dictionary containing the result of the operation.

Example

Retrieve the first ten tasks from the project:

Retrieve all tasks from the project:

Sort tasks by externalId and retrieve the first ten tasks from the project:

Filter the retrieved tasks:

circle-info

Last updated