Skip to main content
POST
/
tasks
Assign a new task to the Coding AI Agent
curl --request POST \
  --url https://api.workser.ai/tasks \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Implement user authentication",
  "text_requirement": "Use bcrypt for password hashing and implement rate limiting",
  "flow": "new_task"
}'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440001",
  "name": "Implement user authentication",
  "description": "Create login and registration functionality with JWT tokens",
  "status": "todo",
  "text_requirement": "Change coloe theme of landing page to be blue with white text and add a new button to the header",
  "files_requirement": [
    {
      "file_type": "image",
      "url": "https://example.com/image.png"
    }
  ],
  "created_at": "2024-01-01T00:00:00.000Z",
  "updated_at": "2024-01-15T12:00:00.000Z",
  "steps": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "task_id": "550e8400-e29b-41d4-a716-446655440001",
      "name": "Create user registration endpoint",
      "description": "Implement POST /auth/register endpoint with validation",
      "status": "in_progress",
      "type": "ai_agent_message",
      "metadata": {
        "path": "src/pages/index.tsx",
        "tool": "read_file_from_sandbox"
      },
      "created_at": "2024-01-01T00:00:00.000Z",
      "updated_at": "2024-01-15T12:00:00.000Z"
    }
  ],
  "branch": "dev",
  "total_price": 0.5
}

Authorizations

x-api-key
string
header
required

API key for authentication

Body

application/json
project_id
string
required

Project ID that this task belongs to

Example:

"550e8400-e29b-41d4-a716-446655440000"

name
string
required

Task name

Example:

"Implement user authentication"

text_requirement
string
required

Text-based requirements for the task

Example:

"Use bcrypt for password hashing and implement rate limiting"

flow
enum<string>
required

Workflow type that determines how the AI agent will execute this task.

Available options:
new_task
Example:

"new_task"

description
string

Task description

Example:

"Create login and registration functionality with JWT tokens"

files_requirement
object[]

File-based requirements (JSON array)

Example:
[
{
"file_type": "image",
"url": "https://example.com/image.png"
}
]

Response

Task created successfully

id
string

Task ID

Example:

"550e8400-e29b-41d4-a716-446655440000"

project_id
string

Project ID that this task belongs to

Example:

"550e8400-e29b-41d4-a716-446655440001"

name
string

Task name

Example:

"Implement user authentication"

description
string

Task description

Example:

"Create login and registration functionality with JWT tokens"

status
enum<string>

Task status

Available options:
todo,
in_progress,
completed,
failed,
cancelled
Example:

"todo"

text_requirement
string

Text-based requirements for the task

Example:

"Change coloe theme of landing page to be blue with white text and add a new button to the header"

files_requirement
object[]

File-based requirements (JSON array), For now receive only image url.

Example:
[
{
"file_type": "image",
"url": "https://example.com/image.png"
}
]
created_at
string<date-time>

Creation timestamp

Example:

"2024-01-01T00:00:00.000Z"

updated_at
string<date-time>

Last update timestamp

Example:

"2024-01-15T12:00:00.000Z"

steps
object[]

Task steps for this task

branch
string

Branch

Example:

"dev"

total_price
number

Total price used by this task in USD

Example:

0.5