Skip to main content

Create task

POST 

/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 Get task 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

Bodyrequired

  • actId string required
    Example: asADASadYvn4mBZmm
  • name string
    Example: my-task
  • options object
      anyOf
    • build string | null nullable
      Example: latest
    • timeoutSecs integer | null nullable
      Example: 300
    • memoryMbytes integer | null nullable
      Example: 1024
    • maxItems integer | null nullable
      Example: 1000
    • maxTotalChargeUsd number | null nullable
      Example: 5
    • restartOnError boolean | null nullable
      Example: false
  • input object
      anyOf
    • 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}
  • title string | null nullable
  • actorStandby object
      anyOf
    • isEnabled boolean | null nullable

      Whether standby mode is enabled for the Actor.

    • desiredRequestsPerActorRun integer | null nullable

      Target number of concurrent HTTP requests a single run is configured to handle.

    • maxRequestsPerActorRun integer | null nullable

      Maximum number of concurrent HTTP requests that can be routed to a single run.

    • idleTimeoutSecs integer | null nullable

      In seconds, how long a run can stay idle without incoming requests before it's terminated.

    • build string | null nullable

      Which build to run in standby mode. Either a build tag or a version number.

    • memoryMbytes integer | null nullable

      In MB, the amount of memory allocated to the run.

    • disableStandbyFieldsOverride boolean | null nullable

      If true, prevents the standby mode configuration from being overridden elsewhere.

    • shouldPassActorInput boolean | null nullable

      Whether to pass the Actor's input to the standby run. If false, the standby runs start with no input.

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"
}
}
}