Create Task
POST
/api/v1/tasks
const url = 'https://example.com/api/v1/tasks';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"name":"example","database":"example","schema":"example","warehouse":"example","schedule":"example","sql_statement":"example","condition":"example","allow_overlapping_execution":false,"after_tasks":["example"],"comment":"example","state":"STARTED","task_timeout_minutes":60,"suspend_task_after_num_failures":10,"user_task_managed_initial_warehouse_size":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/tasks \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "database": "example", "schema": "example", "warehouse": "example", "schedule": "example", "sql_statement": "example", "condition": "example", "allow_overlapping_execution": false, "after_tasks": [ "example" ], "comment": "example", "state": "STARTED", "task_timeout_minutes": 60, "suspend_task_after_num_failures": 10, "user_task_managed_initial_warehouse_size": "example" }'Create a new task.
Args: request: Task creation parameters
Returns: TaskOperationResponse with operation result
Raises: HTTPException: If task creation fails
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
TaskCreateRequest
Request model for creating a task.
object
name
required
Name
Task name
string
database
required
Database
Database name
string
schema
required
Schema
Schema name
string
sql_statement
required
Sql Statement
SQL statement to execute
string
allow_overlapping_execution
Allow Overlapping Execution
Allow concurrent executions
boolean
after_tasks
After Tasks
List of predecessor task names (fully qualified or simple names)
Array<string>
state
TaskState
Initial task state
string
task_timeout_minutes
Task Timeout Minutes
Task execution timeout in minutes
integer
suspend_task_after_num_failures
Suspend Task After Num Failures
Auto-suspend after N consecutive failures
integer
Responses
Section titled “Responses”Successful Response
Media typeapplication/json
TaskOperationResponse
Response model for task operations.
object
Examplegenerated
{ "task_name": "example", "operation": "example", "success": true, "message": "example", "new_state": "example"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ]}