---
title: "Create an async operation."
method: POST
path: "/async_tasks"
tags: ["Async Tasks"]
---

# Create an async operation.

`POST /async_tasks`

## Request

- Base URL: `https://dataops.nexla.io/nexla-api`
- URL: `https://dataops.nexla.io/nexla-api/async_tasks`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nexla/apis/nexla-rest-api/docs/async_tasks/post.ts> (a function with typed inputs; its response is checked against the schema)

Create an async operation. Returns the task id and other related data. Checks if the user has permission to create the task with all entities, and other preconditions.

## Request body

- AsyncTaskPayload
  - `type` 'BulkDeleteNotifications' | 'BulkMarkAsReadNotifications' | 'BulkPauseFlows' | 'CallProbe' | 'ChownUserResources' | 'DeactivateUser' | 'GetAuditLogs': The type of the task.
  - `priority` integer: The priority of the task. At the moment doesn't have any effect.
  - `arguments` object: The arguments for the task. Use `GET /async_tasks/explain_arguments/{task_type}` to get the list of possible arguments for task.

## Response `200`

Success

- AsyncTask: Success
  - `id` string: The unique identifier of the task.
  - `type` 'BulkDeleteNotifications' | 'BulkMarkAsReadNotifications' | 'BulkPauseFlows' | 'CallProbe' | 'ChownUserResources' | 'DeactivateUser' | 'GetAuditLogs'
  - `status` 'pending' | 'running' | 'completed' | 'failed' | 'cancelled': The status of the task.
  - `progress` integer: The progress of the task.
  - `priority` integer: The priority of the task.
  - `created_at` string, date-time: The date and time the task was created.
  - `stopped_at` string, date-time: The date and time the task was completed, failed or stopped in another way.
  - `result` object: The result of the task.
  - `result_url` string: The URL to the result of the task.
  - `error` object: The error that occurred during the task.
  - `owner` Owner
    - `id` integer
    - `full_name` string
    - `email` string, email
  - `org` Org
    - `id` integer
    - `name` string
    - `email_domain` string
    - `email` unknown
    - `client_identifier` unknown

## Other responses

- `400`: Bad Request (e.g. invalid arguments)
- `401`: Unauthorized
- `403`: Forbidden

---

[API](https://skmtc.dev/nexla/apis/nexla-rest-api.md) - [All operations](https://skmtc.dev/nexla/apis/nexla-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nexla/apis/nexla-rest-api/revisions/ef02be92fe7b?raw)
