Kubiya LogoKubiya Developer Docs

Tasks API

API endpoints for managing tasks in the Kubiya platform

Tasks API

The Tasks API allows you to manage tasks that can be executed by AI teammates. You can create, update, and delete tasks, as well as view their execution history.

This playground makes API calls to Kubiya API through a secure server-side proxy. Your requests never expose your API token directly to the browser.

Endpoints

MethodPathDescription
GET/api/v1/tasksList all tasks
GET/api/v1/tasks/{taskId}Get task by ID
POST/api/v1/tasksCreate a new task
PUT/api/v1/tasks/{taskId}Update a task
DELETE/api/v1/tasks/{taskId}Delete a task
POST/api/v1/tasks/plan/{taskId}Plan a task
POST/api/v1/tasks/apply/{taskId}Apply a task
GET/api/v1/tasks/logs/{taskId}Get task logs
POST/api/v1/tasks/inlineCreate an inline task
POST/api/v1/tasks/inline/planRun plan inline task
GET/api/v1/tasks/resources/{taskId}Get task resources
GET/api/v1/usecasesList all use cases
GET/api/v1/usecases/{useCaseId}Get use case by ID

List Tasks

Retrieve all tasks in your organization.

GET /api/v1/tasks

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

[
  {
    "id": "task123",
    "name": "Sample Task",
    "status": "completed"
  }
]

Get Task by ID

Retrieve details for a specific task.

GET /api/v1/tasks/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "id": "task123",
  "name": "Sample Task",
  "status": "completed"
}

Create Task

Create a new task.

POST /api/v1/tasks

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY
Content-TypeYesapplication/json

Request Body

{
  "name": "New Task",
  "description": "This is a new task"
}

Response

{
  "id": "task456",
  "name": "New Task",
  "status": "pending"
}

Update Task

Update an existing task.

PUT /api/v1/tasks/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task to update

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY
Content-TypeYesapplication/json

Request Body

{
  "name": "Updated Task",
  "description": "This task has been updated"
}

Response

{
  "id": "task123",
  "name": "Updated Task",
  "status": "pending"
}

Delete Task

Delete a task.

DELETE /api/v1/tasks/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task to delete

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

A successful delete operation returns an HTTP 200 status with no response body.

Plan Task

Plan a task.

POST /api/v1/tasks/plan/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task to plan

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "id": "task123",
  "plan": "Task plan details"
}

Apply Task

Apply a task.

POST /api/v1/tasks/apply/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task to apply

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "id": "task123",
  "status": "applied"
}

Get Task Logs

Retrieve logs for a specific task.

GET /api/v1/tasks/logs/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "logs": "Task execution logs"
}

Create Inline Task

Create an inline task.

POST /api/v1/tasks/inline

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY
Content-TypeYesapplication/json

Request Body

{
  "name": "Inline Task",
  "description": "This is an inline task"
}

Response

{
  "id": "task789",
  "name": "Inline Task",
  "status": "pending"
}

Run Plan Inline Task

Run a plan for an inline task.

POST /api/v1/tasks/inline/plan

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY
Content-TypeYesapplication/json

Request Body

{
  "name": "Inline Task",
  "description": "This is an inline task"
}

Response

{
  "id": "task789",
  "plan": "Inline task plan details"
}

Get Task Resources

Retrieve resources for a specific task.

GET /api/v1/tasks/resources/{taskId}

Path Parameters

NameTypeRequiredDescription
taskIdstringYesID of the task

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "resources": [
    {
      "id": "resource123",
      "type": "ec2",
      "name": "web-server"
    }
  ]
}

List Use Cases

Retrieve all use cases.

GET /api/v1/usecases

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

[
  {
    "id": "usecase123",
    "name": "Sample Use Case",
    "description": "This is a sample use case"
  }
]

Get Use Case by ID

Retrieve details for a specific use case.

GET /api/v1/usecases/{useCaseId}

Path Parameters

NameTypeRequiredDescription
useCaseIdstringYesID of the use case

Headers

NameRequiredDescription
AuthorizationYesUserKey YOUR_API_KEY

Response

{
  "id": "usecase123",
  "name": "Sample Use Case",
  "description": "This is a sample use case"
}

Example Usage

# List all tasks
curl -X GET "https://api.kubiya.ai/api/v1/tasks" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Get task details
curl -X GET "https://api.kubiya.ai/api/v1/tasks/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Create a new task
curl -X POST "https://api.kubiya.ai/api/v1/tasks" \
  -H "Authorization: UserKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Task",
    "description": "This is a new task"
  }'
 
# Update a task
curl -X PUT "https://api.kubiya.ai/api/v1/tasks/task123" \
  -H "Authorization: UserKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Task",
    "description": "This task has been updated"
  }'
 
# Delete a task
curl -X DELETE "https://api.kubiya.ai/api/v1/tasks/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Plan a task
curl -X POST "https://api.kubiya.ai/api/v1/tasks/plan/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Apply a task
curl -X POST "https://api.kubiya.ai/api/v1/tasks/apply/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Get task logs
curl -X GET "https://api.kubiya.ai/api/v1/tasks/logs/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Create an inline task
curl -X POST "https://api.kubiya.ai/api/v1/tasks/inline" \
  -H "Authorization: UserKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Inline Task",
    "description": "This is an inline task"
  }'
 
# Run plan inline task
curl -X POST "https://api.kubiya.ai/api/v1/tasks/inline/plan" \
  -H "Authorization: UserKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Inline Task",
    "description": "This is an inline task"
  }'
 
# Get task resources
curl -X GET "https://api.kubiya.ai/api/v1/tasks/resources/task123" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# List all use cases
curl -X GET "https://api.kubiya.ai/api/v1/usecases" \
  -H "Authorization: UserKey YOUR_API_KEY"
 
# Get use case details
curl -X GET "https://api.kubiya.ai/api/v1/usecases/usecase123" \
  -H "Authorization: UserKey YOUR_API_KEY"

Tasks are the core building blocks of automation in Kubiya. Make sure to test your tasks thoroughly before applying them in production.

Common Errors

HTTP StatusDescription
400Bad Request - Invalid request body or missing required fields
401Unauthorized - API key is missing or invalid
403Forbidden - The API key doesn't have permission to perform this action
404Not Found - The specified task or use case was not found
500Internal Server Error - An unexpected error occurred on the server

Next Steps

After setting up tasks, you can:

  • Monitor task execution through the Tasks API
  • Set up Webhooks to receive task execution notifications
  • Configure Agents to be used in tasks