# Create task


```
POST 
https://api.apify.com/v2/actor-tasks
```


Create a new task with settings specified by the object passed as JSON in the POST payload.

The response is the full task object as returned by the  endpoint.

The request needs to specify the `Content-Type: application/json` HTTP header!

When providing your API authentication token, we recommend using the request's `Authorization` header, rather than the URL. ().

## Request

<!-- -->

### Body**required**

* **actId** string required\
  **Example:** `asADASadYvn4mBZmm`

* **name** string required\
  **Example:** `my-task`

* **options** object

  * anyOf
    * TaskOptions
    * null
    **build** string | null nullable\
    **Example:** `latest`
  * **timeoutSecs** integer | null nullable\
    **Example:** `300`
  * **memoryMbytes** integer | null nullable\
    **Example:** `128`
  * **restartOnError** boolean | null nullable\
    **Example:** `false`

* **input** object

  * anyOf

    * TaskInput
    * null

    object

    The input configuration for the Actor task. This is a user-defined JSON object that will be passed to the Actor when the task is run.

    **Example:** `{"startUrls":[{"url":"https://example.com"}],"maxRequestsPerCrawl":100}`

### Status 201

**Response Headers**

* **Location**


```
{
  "data": {
    "id": "zdc3Pyhyz3m8vjDeM",
    "userId": "wRsJZtadYvn4mBZmm",
    "actId": "asADASadYvn4mBZmm",
    "name": "my-task",
    "username": "janedoe",
    "createdAt": "2018-10-26T07:23:14.855Z",
    "modifiedAt": "2018-10-26T13:30:49.578Z",
    "removedAt": null,
    "stats": {
      "totalRuns": 15
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 128
    },
    "input": {
      "hello": "world"
    }
  }
}
```


**Schema**

* **data** object required

  * **id** string required\
    **Example:** `zdc3Pyhyz3m8vjDeM`

  * **userId** string required\
    **Example:** `wRsJZtadYvn4mBZmm`

  * **actId** string required\
    **Example:** `asADASadYvn4mBZmm`

  * **name** string required\
    **Example:** `my-task`

  * **username** string | null nullable\
    **Example:** `janedoe`

  * **createdAt** string\<date-time> required\
    **Example:** `2018-10-26T07:23:14.855Z`

  * **modifiedAt** string\<date-time> required\
    **Example:** `2018-10-26T13:30:49.578Z`

  * **removedAt** string,null\<date-time> nullable

  * **stats** object

    * anyOf
      * TaskStats
      * null
      **totalRuns** integer\
      **Example:** `15`

  * **options** object

    * anyOf
      * TaskOptions
      * null
      **build** string | null nullable\
      **Example:** `latest`
    * **timeoutSecs** integer | null nullable\
      **Example:** `300`
    * **memoryMbytes** integer | null nullable\
      **Example:** `128`
    * **restartOnError** boolean | null nullable\
      **Example:** `false`

  * **input** object

    * anyOf

      * TaskInput
      * null

      object

      The input configuration for the Actor task. This is a user-defined JSON object that will be passed to the Actor when the task is run.

      **Example:** `{"startUrls":[{"url":"https://example.com"}],"maxRequestsPerCrawl":100}`

  * **standbyUrl** string,null\<uri> nullable

### Status 400

Bad request - invalid input parameters or request body.


```
{
  "error": {
    "type": "invalid-input",
    "message": "Invalid input: The request body contains invalid data."
  }
}
```


**Schema**

* **error** object required

  * **type** string required\
    **Example:** `run-failed`
  * **message** string required\
    **Example:** `Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)`
