Skip to main content
GET
/
redteam
/
list-tasks
Get List of Tasks
curl --request GET \
  --url https://api.enkryptai.com/redteam/list-tasks \
  --header 'apikey: <api-key>'
{
  "tasks": [
    {
      "status": "Finished",
      "model_name": "Mistral-7B-Instruct-v0.1",
      "task_id": "red-team-94f40d84-5b4e-4e97-a793-48357b71490a",
      "test_name": "Test 1"
    },
    {
      "status": "Queued",
      "model_name": "Mistral-7B-Instruct-v0.1",
      "task_id": "red-team-6c3babbe-3bc4-4553-a0b7-454df720579f",
      "test_name": "Test 2"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 10,
    "total_count": 25,
    "total_pages": 3,
    "has_next": true,
    "has_previous": false
  }
}

List All Tasks

Retrieve a paginated list of all redteam tasks in your account.

Query Parameters

ParameterTypeRequiredDefaultDescription
statusstringNo-Filter tasks by status. Valid values: Queued, Running, Finished, Failed
pageintegerNo1Page number (must be >= 1)
per_pageintegerNo10Number of items per page (must be between 1 and 100)

Example Request

curl -X GET "https://api.enkryptai.com/redteam/list-tasks?status=Finished&page=1&per_page=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "tasks": [
    {
      "status": "Finished",
      "model_name": "Mistral-7B-Instruct-v0.1",
      "task_id": "red-team-94f40d84-5b4e-4e97-a793-48357b71490a",
      "test_name": "Test 1",
      "project_name": "default"
    },
    {
      "status": "Queued",
      "model_name": "Mistral-7B-Instruct-v0.1",
      "task_id": "red-team-6c3babbe-3bc4-4553-a0b7-454df720579f",
      "test_name": "Test 2",
      "project_name": "default"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 10,
    "total_count": 25,
    "total_pages": 3,
    "has_next": true,
    "has_previous": false
  }
}

Error Responses

400 Bad Request - Invalid Pagination Parameters

{
  "error": "Invalid pagination parameters. Page must be >= 1, per_page must be between 1 and 100"
}

Pagination

The response includes pagination metadata to help you navigate through the results:
  • page: Current page number
  • per_page: Number of items per page
  • total_count: Total number of items across all pages
  • total_pages: Total number of pages
  • has_next: Boolean indicating if there’s a next page
  • has_previous: Boolean indicating if there’s a previous page
To get the next page, increment the page parameter. For example, to get page 2:
GET /redteam/list-tasks?page=2&per_page=10

Status Filtering

You can filter tasks by their status using the status parameter:
  • Queued: Tasks waiting to be processed
  • Running: Tasks currently being processed
  • Finished: Completed tasks
  • Failed: Tasks that failed to complete
Example: Get only finished tasks
GET /redteam/list-tasks?status=Finished&page=1&per_page=10

Authorizations

apikey
string
header
required

Query Parameters

status
enum<string>

The status of the task

Available options:
Queued,
Running,
Finished,
Failed
page
integer
default:1

Page number (must be >= 1)

Required range: x >= 1
Example:

1

per_page
integer
default:10

Number of items per page (must be between 1 and 100)

Required range: 1 <= x <= 100
Example:

10

Response

Successful Response

tasks
Task Β· object[]
pagination
object
⌘I