Apify API
Download OpenAPI specification:Download
UPDATE 2024-07-09: We have rolled out this new Apify API Documentation. In case of any issues, please report here. The old API Documentation is still available here.
The Apify API (version 2) provides programmatic access to the Apify platform. The API is organized around RESTful HTTP endpoints.
All requests and responses (including errors) are encoded in JSON format with UTF-8 encoding, with a few exceptions that are explicitly described in the reference.
To access the API using Node.js, we recommend the
apify-client
NPM
package.
To access the API using Python, we recommend the
apify-client
PyPI
package.
The clients' functions correspond to the API endpoints and have the same
parameters. This simplifies development of apps that depend on the Apify
platform.
Note: All requests with JSON payloads need to specify the Content-Type: application/json
HTTP header!
All API endpoints support the method
query parameter that can override the
HTTP method.
For example, if you want to call a POST endpoint using a GET request, simply
add the query parameter method=POST
to the URL and send the GET request.
This feature is especially useful if you want to call Apify API endpoints
from services that can only send GET requests.
You can find your API token on the Integrations page in the Apify Console.
To use your token in a request, either:
- Add the token to your request's
Authorization
header asBearer <token>
. E.g.,Authorization: Bearer xxxxxxx
. More info. (Recommended). - Add it as the
token
parameter to your request URL. (Less secure).
Using your token in the request header is more secure than using it as a URL parameter because URLs are often stored in browser history and server logs. This creates a chance for someone unauthorized to access your API token.
Do not share your API token or password with untrusted parties.
For more information, see our integrations documentation.
To run an actor, send a POST request to the Run
actor endpoint using either the
actor ID code (e.g. vKg4IjxZbEYTYeW8T
) or its name (e.g.
janedoe~my-actor
):
https://api.apify.com/v2/acts/[actor_id]/runs
If the actor is not runnable anonymously, you will receive a 401 or 403
response code.
This means you need to add your secret API
token to the request's
Authorization
header (recommended) or as a
URL query parameter ?token=[your_token]
(less secure).
Optionally, you can include the query parameters described in the Run actor section to customize your run.
If you're using Node.js, the best way to run an actor is using the
Apify.call()
method from the Apify
SDK. It
runs the actor using the account you are currently logged into (determined
by the secret API token).
The result is an actor run
object and its output (if
any).
A typical workflow is as follows:
- Run an actor or task using the Run actor or Run task API endpoints.
- Monitor the actor run by periodically polling its progress using the Get run API endpoint.
- Fetch the results from the Get
items API endpoint using the
defaultDatasetId
, which you receive in the Run request response. Additional data may be stored in a key-value store. You can fetch them from the Get record API endpoint using thedefaultKeyValueStoreId
and the store'skey
.
Note: Instead of periodic polling, you can also run your actor or task synchronously. This will ensure that the request waits for 300 seconds (5 minutes) for the run to finish and returns its output. If the run takes longer, the request will time out and throw an error.
Most API endpoints return a JSON object with the data
property:
{
"data": {
...
}
}
However, there are a few explicitly described exceptions, such as
Dataset Get items or
Key-value store Get record
API endpoints, which return data in other formats.
In case of an error, the response has the HTTP status code in the range of
4xx or 5xx and the data
property is replaced with error
. For example:
{
"error": {
"type": "record-not-found",
"message": "Store was not found."
}
}
See Errors for more details.
All API endpoints that return a list of records (e.g. Get list of actors) enforce pagination in order to limit the size of their responses.
Most of these API endpoints are paginated using the offset
and limit
query parameters.
The only exception is Get list of
keys,
which is paginated using the exclusiveStartKey
query parameter.
IMPORTANT: Each API endpoint that supports pagination enforces a certain
maximum value for the limit
parameter,
in order to reduce the load on Apify servers.
The maximum limit could change in future so you should never
rely on a specific value and check the responses of these API endpoints.
Using offset
Most API endpoints that return a list of records enable pagination using the following query parameters:
limit |
Limits the response to contain a specific maximum number of items, e.g. limit=20 . |
offset |
Skips a number of items from the beginning of the list, e.g. offset=100 . |
desc |
By default, items are sorted in the order in which they were created or added to the list.
This feature is useful when fetching all the items, because it ensures that items
created after the client started the pagination will not be skipped.
If you specify the desc=1 parameter, the items will be returned in the reverse order,
i.e. from the newest to the oldest items.
|
The response of these API endpoints is always a JSON object with the following structure:
{
"data": {
"total": 2560,
"offset": 250,
"limit": 1000,
"count": 1000,
"desc": false,
"items": [
{ 1st object },
{ 2nd object },
...
{ 1000th object }
]
}
}
The following table describes the meaning of the response properties:
Property | Description |
---|---|
total |
The total number of items available in the list. |
offset |
The number of items that were skipped at the start.
This is equal to the offset query parameter if it was provided, otherwise it is 0 . |
limit |
The maximum number of items that can be returned in the HTTP response.
It equals to the limit query parameter if it was provided or
the maximum limit enforced for the particular API endpoint, whichever is smaller. |
count |
The actual number of items returned in the HTTP response. |
desc |
true if data were requested in descending order and false otherwise. |
items |
An array of requested items. |
Using key
The records in the key-value store are not ordered based on numerical indexes, but rather by their keys in the UTF-8 binary order. Therefore the Get list of keys API endpoint only supports pagination using the following query parameters:
limit |
Limits the response to contain a specific maximum number items, e.g. limit=20 . |
exclusiveStartKey |
Skips all records with keys up to the given key including the given key, in the UTF-8 binary order. |
The response of the API endpoint is always a JSON object with following structure:
{
"data": {
"limit": 1000,
"isTruncated": true,
"exclusiveStartKey": "my-key",
"nextExclusiveStartKey": "some-other-key",
"items": [
{ 1st object },
{ 2nd object },
...
{ 1000th object }
]
}
}
The following table describes the meaning of the response properties:
Property | Description |
---|---|
limit |
The maximum number of items that can be returned in the HTTP response.
It equals to the limit query parameter if it was provided or
the maximum limit enforced for the particular endpoint, whichever is smaller. |
isTruncated |
true if there are more items left to be queried. Otherwise false . |
exclusiveStartKey |
The last key that was skipped at the start. Is `null` for the first page. |
nextExclusiveStartKey |
The value for the exclusiveStartKey parameter to query the next page of items. |
The Apify API uses common HTTP status codes: 2xx
range for success, 4xx
range for errors caused by the caller
(invalid requests) and 5xx
range for server errors (these are rare).
Each error response contains a JSON object defining the error
property,
which is an object with
the type
and message
properties that contain the error code and a
human-readable error description, respectively.
For example:
{
"error": {
"type": "record-not-found",
"message": "Store was not found."
}
}
Here is the table of the most common errors that can occur for many API endpoints:
status | type | message |
---|---|---|
400 |
invalid-request |
POST data must be a JSON object |
400 |
invalid-value |
Invalid value provided: Comments required |
400 |
invalid-record-key |
Record key contains invalid character |
401 |
token-not-provided |
Authentication token was not provided |
404 |
record-not-found |
Store was not found |
429 |
rate-limit-exceeded |
You have exceeded the rate limit of 30 requests per second |
405 |
method-not-allowed |
This API endpoint can only be accessed using the following HTTP methods: OPTIONS, POST |
All API endpoints limit the rate of requests in order to prevent overloading of Apify servers by misbehaving clients.
There are two kinds of rate limits - a global rate limit and a per-resource rate limit.
Global rate limit
The global rate limit is set to 250 000 requests per minute. For authenticated requests, it is counted per user, and for unauthenticated requests, it is counted per IP address.
Per-resource rate limit
The default per-resource rate limit is 30 requests per second per resource, which in this context means a single Actor, a single Actor run, a single dataset, single key-value store etc.
The default rate limit is applied to every API endpoint except a few select ones, which have higher rate limits.
Each API endpoint returns its rate limit in X-RateLimit-Limit
header.
These endpoints have a rate limit of 100 requests per second per resource:
These endpoints have a rate limit of 200 requests per second per resource:
- Run actor
- Run actor task asynchronously
- Run actor task synchronously
- Metamorph actor run
- Push items to dataset
- CRUD (add, get, update, delete) operations on requests in request queues
Rate limit exceeded errors
If the client is sending too many requests, the API endpoints respond with the HTTP status code 429 Too Many Requests
and the following body:
{
"error": {
"type": "rate-limit-exceeded",
"message": "You have exceeded the rate limit of ... requests per second"
}
}
Retrying rate-limited requests with exponential backoff
If the client receives the rate limit error, it should wait a certain period of time and then retry the request. If the error happens again, the client should double the wait period and retry the request, and so on. This algorithm is known as exponential backoff and it can be described using the following pseudo-code:
- Define a variable
DELAY=500
- Send the HTTP request to the API endpoint
- If the response has status code not equal to
429
then you are done. Otherwise:- Wait for a period of time chosen randomly from the interval
DELAY
to2*DELAY
milliseconds - Double the future wait period by setting
DELAY = 2*DELAY
- Continue with step 2
- Wait for a period of time chosen randomly from the interval
If all requests sent by the client implement the above steps, the client will automatically use the maximum available bandwidth for its requests.
Note that the Apify API clients for JavaScript and for Python use the exponential backoff algorithm transparently, so that you do not need to worry about it.
There are three main ways to refer to a resource you're accessing via API.
- the resource ID (e.g.
iKkPcIgVvwmztduf8
) username~resourcename
- when using this access method, you will need to use your API token, and access will only work if you have the correct permissions.~resourcename
- for this, you need to use an API token, and theresourcename
refers to a resource in the API token owner's account.
The API endpoints described in this section enable you to manage, build and run Apify actors. For more information, see the Actor documentation.
Note that for all the API endpoints that accept the actorId
parameter to specify an actor,
you can pass either the actor ID (e.g. HG7ML7M8z78YcAPEB
) or a tilde-separated
username of the actor owner and the actor name (e.g. janedoe~my-actor
).
Some of the API endpoints return runs objects. Note that if any such run object contains usage in dollars, your effective unit pricing at the time of query has been used for computation of this dollar equivalent, and hence it should be used only for informative purposes. You can learn more about platform usage in the documentation.
Get list of actors
ClientsGets the list of all Actors that the user created or used. The response is a list of objects, where each object contains a basic information about a single Actor.
To only get Actors created by the user, add the my=1
query parameter.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order, therefore you can use pagination to incrementally fetch all Actors while new
ones are still being created. To sort the records in descending order, use the desc=1
parameter.
Authorizations:
query Parameters
my | boolean Example: my=true If |
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the
maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actors() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "count": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "items": [
- {
- "id": "br9CKmk457",
- "createdAt": "2019-10-29T07:34:24.202Z",
- "modifiedAt": "2019-10-30T07:34:24.202Z",
- "name": "MyAct",
- "username": "janedoe"
}, - {
- "id": "ksiEKo23pz",
- "createdAt": "2019-11-30T07:34:24.202Z",
- "modifiedAt": "2019-12-12T07:34:24.202Z",
- "name": "MySecondAct",
- "username": "janedoe"
}
]
}
}
Create actor
ClientsCreates a new Actor with settings specified in an Actor object passed as JSON in the POST payload.
The response is the full Actor object as returned by the
Get Actor endpoint.
The HTTP request must have the Content-Type: application/json
HTTP header!
The Actor needs to define at least one version of the source code.
For more information, see Version object.
If you want to make your Actor
public using isPublic: true
, you will need to provide the Actor's title
and the categories
under which that Actor will be classified in Apify Store. For this, it's
best to use the constants from our apify-shared-js
package.
Authorizations:
Request Body schema: application/jsonrequired
name | string or null |
description | string or null |
title | string or null |
isPublic | boolean or null |
seoTitle | string or null |
seoDescription | string or null |
restartOnError | boolean or null |
Array of objects or null (Version) | |
categories | Array of strings or null |
(any or null) or defaultRunOptions (object) |
Responses
Location | any |
Response Schema: application/json
required | object (Actor) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "MyActor",
- "description": "My favourite Actor!",
- "title": "My Actor",
- "isPublic": false,
- "seoTitle": "My Actor",
- "seoDescription": "My Actor is the best",
- "restartOnError": false,
- "versions": [
- {
- "versionNumber": "0.0",
- "sourceType": "SOURCE_FILES",
- "envVars": [
- {
- "name": "SECRET_PASSWORD",
- "value": "MyTopSecretPassword123",
- "isSecret": true
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}
], - "categories": [ ],
- "defaultRunOptions": {
- "build": "latest",
- "timeoutSecs": 3600,
- "memoryMbytes": 2048
}
}
Response samples
- 201
{- "data": {
- "id": "zdc3Pyhyz3m8vjDeM",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "MyActor",
- "username": "jane35",
- "description": "My favourite Actor!",
- "restartOnError": false,
- "isPublic": false,
- "createdAt": "2019-07-08T11:27:57.401Z",
- "modifiedAt": "2019-07-08T14:01:05.546Z",
- "stats": {
- "totalBuilds": 9,
- "totalRuns": 16,
- "totalUsers": 6,
- "totalUsers7Days": 2,
- "totalUsers30Days": 6,
- "totalUsers90Days": 6,
- "totalMetamorphs": 2,
- "lastRunStartedAt": "2019-07-08T14:01:05.546Z"
}, - "versions": [
- {
- "versionNumber": "0.1",
- "envVars": null,
- "sourceType": "SOURCE_FILES",
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}, - {
- "versionNumber": "0.2",
- "sourceType": "GIT_REPO",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.3",
- "sourceType": "TARBALL",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.4",
- "sourceType": "GITHUB_GIST",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}
], - "defaultRunOptions": {
- "build": "latest",
- "timeoutSecs": 3600,
- "memoryMbytes": 2048
}, - "exampleRunInput": {
- "body": "{ \"helloWorld\": 123 }",
- "contentType": "application/json; charset=utf-8"
}, - "isDeprecated": false,
- "deploymentKey": "ssh-rsa AAAA ...",
- "title": "My Actor",
- "taggedBuilds": {
- "latest": {
- "buildId": "z2EryhbfhgSyqj6Hn",
- "buildNumber": "0.0.2",
- "finishedAt": "2019-06-10T11:15:49.286Z"
}
}
}
}
Get actor
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
Responses
Response Schema: application/json
required | object (Actor) | ||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const actor = await apifyClient .actor('<ACTOR ID>') .get(); console.log(actor);
Response samples
- 200
{- "data": {
- "id": "zdc3Pyhyz3m8vjDeM",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "MyActor",
- "username": "jane35",
- "description": "My favourite Actor!",
- "restartOnError": false,
- "isPublic": false,
- "createdAt": "2019-07-08T11:27:57.401Z",
- "modifiedAt": "2019-07-08T14:01:05.546Z",
- "stats": {
- "totalBuilds": 9,
- "totalRuns": 16,
- "totalUsers": 6,
- "totalUsers7Days": 2,
- "totalUsers30Days": 6,
- "totalUsers90Days": 6,
- "totalMetamorphs": 2,
- "lastRunStartedAt": "2019-07-08T14:01:05.546Z"
}, - "versions": [
- {
- "versionNumber": "0.1",
- "envVars": null,
- "sourceType": "SOURCE_FILES",
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}, - {
- "versionNumber": "0.2",
- "sourceType": "GIT_REPO",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.3",
- "sourceType": "TARBALL",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.4",
- "sourceType": "GITHUB_GIST",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}
], - "defaultRunOptions": {
- "build": "latest",
- "timeoutSecs": 3600,
- "memoryMbytes": 2048
}, - "exampleRunInput": {
- "body": "{ \"helloWorld\": 123 }",
- "contentType": "application/json; charset=utf-8"
}, - "isDeprecated": false,
- "deploymentKey": "ssh-rsa AAAA ...",
- "title": "My Actor",
- "taggedBuilds": {
- "latest": {
- "buildId": "z2EryhbfhgSyqj6Hn",
- "buildNumber": "0.0.2",
- "finishedAt": "2019-06-10T11:15:49.286Z"
}
}
}
}
Update actor
ClientsUpdates settings of an Actor using values specified by an Actor object passed as JSON in the POST payload.
If the object does not define a specific property, its value will not be updated.
The response is the full Actor object as returned by the Get Actor 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. (More
info).
If you want to make your Actor
public using isPublic: true
, you will need to provide the Actor's title
and the categories
under which that Actor will be classified in Apify Store. For this, it's
best to use the constants from our apify-shared-js
package.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
Request Body schema: application/jsonrequired
name required | string |
description | string or null |
isPublic required | boolean |
seoTitle | string or null |
seoDescription | string or null |
title | string or null |
restartOnError | boolean or null |
required | Array of objects (CreateOrUpdateEnvVarRequest) |
categories | Array of strings or null |
(any or null) or defaultRunOptions (object) |
Responses
Response Schema: application/json
required | object (Actor) | ||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "MyActor",
- "description": "My favourite Actor!",
- "isPublic": false,
- "seoTitle": "My Actor",
- "seoDescription": "My Actor is the best",
- "title": "My Actor",
- "restartOnError": false,
- "versions": [
- {
- "versionNumber": "0.0",
- "sourceType": "SOURCE_FILES",
- "envVars": [
- {
- "name": "SECRET_PASSWORD",
- "value": "MyTopSecretPassword123",
- "isSecret": true
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}
], - "categories": [ ],
- "defaultRunOptions": {
- "build": "latest",
- "timeoutSecs": 3600,
- "memoryMbytes": 2048
}
}
Response samples
- 200
{- "data": {
- "id": "zdc3Pyhyz3m8vjDeM",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "MyActor",
- "username": "jane35",
- "description": "My favourite Actor!",
- "restartOnError": false,
- "isPublic": false,
- "createdAt": "2019-07-08T11:27:57.401Z",
- "modifiedAt": "2019-07-08T14:01:05.546Z",
- "stats": {
- "totalBuilds": 9,
- "totalRuns": 16,
- "totalUsers": 6,
- "totalUsers7Days": 2,
- "totalUsers30Days": 6,
- "totalUsers90Days": 6,
- "totalMetamorphs": 2,
- "lastRunStartedAt": "2019-07-08T14:01:05.546Z"
}, - "versions": [
- {
- "versionNumber": "0.1",
- "envVars": null,
- "sourceType": "SOURCE_FILES",
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}, - {
- "versionNumber": "0.2",
- "sourceType": "GIT_REPO",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.3",
- "sourceType": "TARBALL",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.4",
- "sourceType": "GITHUB_GIST",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}
], - "defaultRunOptions": {
- "build": "latest",
- "timeoutSecs": 3600,
- "memoryMbytes": 2048
}, - "exampleRunInput": {
- "body": "{ \"helloWorld\": 123 }",
- "contentType": "application/json; charset=utf-8"
}, - "isDeprecated": false,
- "deploymentKey": "ssh-rsa AAAA ...",
- "title": "My Actor",
- "taggedBuilds": {
- "latest": {
- "buildId": "z2EryhbfhgSyqj6Hn",
- "buildNumber": "0.0.2",
- "finishedAt": "2019-06-10T11:15:49.286Z"
}
}
}
}
Delete actor
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient.actor('<ACTOR ID>').delete();
Response samples
- 204
{ }
Get list of versions
ClientsGets the list of versions of a specific Actor. The response is a JSON object with the list of Version objects, where each contains basic information about a single version.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
Responses
Response Schema: application/json
required | object | ||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actor('<ACTOR ID>') .versions() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 5,
- "items": [
- {
- "versionNumber": "0.1",
- "envVars": null,
- "sourceType": "SOURCE_FILES",
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}, - {
- "versionNumber": "0.2",
- "sourceType": "GIT_REPO",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.3",
- "sourceType": "TARBALL",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}, - {
- "versionNumber": "0.4",
- "sourceType": "GITHUB_GIST",
- "envVars": null,
- "applyEnvVarsToBuild": false,
- "buildTag": "latest",
}
]
}
}
Create version
ClientsCreates a version of an Actor using values specified in a Version object passed as JSON in the POST payload.
The request must specify versionNumber
and sourceType
parameters (as
strings) in the JSON payload and a Content-Type: application/json
HTTP
header.
Each sourceType
requires its own additional properties to be passed to the
JSON payload object. These are outlined in the Version
object table below and in more detail in
the Apify
documentation.
For example, if an Actor's source code is stored in a GitHub
repository,
you will set the sourceType
to GIT_REPO
and pass the repository's URL in
the gitRepoUrl
property.
{
"versionNumber": "0.1",
"sourceType": "GIT_REPO",
"gitRepoUrl": "https://github.com/my-github-account/actor-repo"
}
The response is the Version object as returned by the Get version endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
Request Body schema: application/jsonrequired
versionNumber | string or null |
(any or null) or VersionSourceType (string) | |
Array of objects or null (EnvVar) | |
applyEnvVarsToBuild | boolean or null |
buildTag | string or null |
Array of SourceCodeFile (object) or SourceCodeFolder (object) (VersionSourceFiles) |
Responses
Location | any |
Response Schema: application/json
required | object (Version) | ||||||||||||
|
Request samples
- Payload
- JS client
{- "versionNumber": "0.1",
- "sourceType": "GIT_REPO",
}
Response samples
- 201
{- "data": {
- "versionNumber": "0.0",
- "sourceType": { },
- "envVars": [
- {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [
- {
- "format": "TEXT",
- "content": "console.log('This is the main.js file');",
- "name": "src/main.js"
}
]
}
}
The Version object contains the source code of a specific version of an actor.
The sourceType
property indicates where the source code is hosted, and based
on its value the Version object has the following additional property:
"SOURCE_FILES" |
Source code is comprised of multiple files specified in the sourceFiles
array.
Each item of the array is an object with the following fields:
"TEXT"
or "BASE64" Source files can be shown and edited in the Apify Console's Web IDE. |
"GIT_REPO" |
Source code is cloned from a Git repository, whose URL is specified in
the gitRepoUrl field.
|
"TARBALL" |
Source code is downloaded using a tarball or Zip file from a URL specified
in the tarballUrl field.
|
"GITHUB_GIST" |
Source code is taken from a GitHub Gist, whose URL is specified in the
gitHubGistUrl field.
|
For more information about source code and actor versions, see Source code in Actors documentation.
Get version
ClientsThe Version object contains the source code of a specific version of an Actor.
The sourceType
property indicates where the source code is hosted, and
based on its value the Version object has the following additional property:
"SOURCE_FILES" |
Source code is comprised of multiple files specified in the sourceFiles array.
Each item of the array is an object with the following fields:
"TEXT" or "BASE64" Source files can be shown and edited in the Apify Console's Web IDE. |
"GIT_REPO" |
Source code is cloned from a Git repository, whose URL is specified in the gitRepoUrl field.
|
"TARBALL" |
Source code is downloaded using a tarball or Zip file from a URL specified in the tarballUrl field.
|
"GITHUB_GIST" |
Source code is taken from a GitHub Gist, whose URL is specified in the gitHubGistUrl field.
|
For more information about source code and Actor versions, see Source code in Actors documentation.Gets a Version object that contains all the details about a specific version of an Actor.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 1.0 Actor major and minor version of the Actor. |
Responses
Response Schema: application/json
required | object (Version) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const version = await apifyClient .actor('<ACTOR ID>') .version('0.1') .get(); console.log(version);
Response samples
- 200
{- "data": {
- "versionNumber": "0.0",
- "sourceType": { },
- "envVars": [
- {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [
- {
- "format": "TEXT",
- "content": "console.log('This is the main.js file');",
- "name": "src/main.js"
}
]
}
}
Update version
ClientsThe Version object contains the source code of a specific version of an Actor.
The sourceType
property indicates where the source code is hosted, and
based on its value the Version object has the following additional property:
"SOURCE_FILES" |
Source code is comprised of multiple files specified in the sourceFiles array.
Each item of the array is an object with the following fields:
"TEXT" or "BASE64" Source files can be shown and edited in the Apify Console's Web IDE. |
"GIT_REPO" |
Source code is cloned from a Git repository, whose URL is specified in the gitRepoUrl field.
|
"TARBALL" |
Source code is downloaded using a tarball or Zip file from a URL specified in the tarballUrl field.
|
"GITHUB_GIST" |
Source code is taken from a GitHub Gist, whose URL is specified in the gitHubGistUrl field.
|
For more information about source code and Actor versions, see Source code in Actors documentation.Updates Actor version using values specified by a Version object passed as JSON in the POST payload.
If the object does not define a specific property, its value will not be updated.
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. (More
info).
The response is the Version object as returned by the Get version endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 1.0 Actor major and minor version of the Actor. |
Request Body schema: application/jsonrequired
versionNumber | string or null |
(any or null) or VersionSourceType (string) | |
Array of objects or null (EnvVar) | |
applyEnvVarsToBuild | boolean or null |
buildTag | string or null |
Array of SourceCodeFile (object) or SourceCodeFolder (object) (VersionSourceFiles) |
Responses
Response Schema: application/json
required | object (Version) | ||||||||||||
|
Request samples
- Payload
- JS client
{- "versionNumber": "0.0",
- "sourceType": "SOURCE_FILES",
- "envVars": [
- {
- "name": "SECRET_PASSWORD",
- "value": "MyTopSecretPassword123",
- "isSecret": true
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [ ]
}
Response samples
- 200
{- "data": {
- "versionNumber": "0.0",
- "sourceType": { },
- "envVars": [
- {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
], - "applyEnvVarsToBuild": false,
- "buildTag": "latest",
- "sourceFiles": [
- {
- "format": "TEXT",
- "content": "console.log('This is the main.js file');",
- "name": "src/main.js"
}
]
}
}
Delete version
The Version object contains the source code of a specific version of an Actor.
The sourceType
property indicates where the source code is hosted, and
based
on its value the Version object has the following additional property:
"SOURCE_FILES" |
Source code is comprised of multiple files specified in the sourceFiles array.
Each item of the array is an object with the following fields:
"TEXT" or "BASE64" Source files can be shown and edited in the Apify Console's Web IDE. |
"GIT_REPO" |
Source code is cloned from a Git repository, whose URL is specified in the gitRepoUrl field.
|
"TARBALL" |
Source code is downloaded using a tarball or Zip file from a URL specified in the tarballUrl field.
|
"GITHUB_GIST" |
Source code is taken from a GitHub Gist, whose URL is specified in the gitHubGistUrl field.
|
For more information about source code and Actor versions, see Source code in Actors documentation.Deletes a specific version of Actor's source code.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 1.0 Actor major and minor version of the Actor. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .actor('<ACTOR ID>') .version('0.1') .delete();
Response samples
- 204
{ }
Get list of environment variables
ClientsGets the list of environment variables for a specific version of an Actor. The response is a JSON object with the list of EnvVar objects, where each contains basic information about a single environment variable.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 0.1 Actor version |
Responses
Response Schema: application/json
required | object | ||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actor('<ACTOR ID>') .version('0.1') .envVars() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 5,
- "items": [
- {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
]
}
}
Create environment variable
ClientsCreates an environment variable of an Actor using values specified in a EnvVar object passed as JSON in the POST payload.
The request must specify name
and value
parameters (as strings) in the
JSON payload and a Content-Type: application/json
HTTP header.
{
"name": "ENV_VAR_NAME",
"value": "my-env-var"
}
The response is the EnvVar object as returned by the Get environment variable endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 0.1 Actor version |
Request Body schema: application/jsonrequired
name required | string |
value required | string |
isSecret | boolean or null |
Responses
Location | any |
Response Schema: application/json
required | object (EnvVar) | ||||||
|
Request samples
- Payload
- JS client
{- "name": "ENV_VAR_NAME",
- "value": "my-env-var"
}
Response samples
- 201
{- "data": {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
}
Get environment variable
ClientsGets a EnvVar object that contains all the details about a specific environment variable of an Actor.
If isSecret
is set to true
, then value
will never be returned.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 0.1 Actor version |
envVarName required | string Example: MY_ENV_VAR The name of the environment variable |
Responses
Response Schema: application/json
required | object (EnvVar) | ||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const envVar = await apifyClient .actor('<ACTOR ID>') .version('0.1') .envVar('MY_ENV_VAR') .get(); console.log(envVar);
Response samples
- 200
{- "data": {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
}
Update environment variable
ClientsUpdates Actor environment variable using values specified by a EnvVar object
passed as JSON in the POST payload.
If the object does not define a specific property, its value will not be updated.
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. (More
info).
The response is the EnvVar object as returned by the
Get environment variable endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 0.1 Actor version |
envVarName required | string Example: MY_ENV_VAR The name of the environment variable |
Request Body schema: application/jsonrequired
name required | string |
value required | string |
isSecret | boolean or null |
Responses
Response Schema: application/json
required | object (EnvVar) | ||||||
|
Request samples
- Payload
- JS client
{- "name": "MY_ENV_VAR",
- "value": "my-new-value",
- "isSecret": false
}
Response samples
- 200
{- "data": {
- "name": "MY_ENV_VAR",
- "value": "my-value",
- "isSecret": false
}
}
Delete environment variable
Deletes a specific environment variable.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
versionNumber required | string Example: 0.1 Actor version |
envVarName required | string Example: MY_ENV_VAR The name of the environment variable |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .actor('<ACTOR ID>') .version('0.1') .envVar('MY_ENV_VAR') .delete();
Response samples
- 204
{ }
Get list of webhooks
Gets the list of webhooks of a specific Actor. The response is a JSON with the list of objects, where each object contains basic information about a single webhook.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order, to sort the records in descending order, use the desc=1
parameter.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The
default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as
the maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actor('<ACTOR ID>') .webhooks() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
]
}
}
Get list of builds
ClientsGets the list of builds of a specific Actor. The response is a JSON with the list of objects, where each object contains basic information about a single build.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the startedAt
field in ascending order,
therefore you can use pagination to incrementally fetch all builds while new
ones are still being started. To sort the records in descending order, use
the desc=1
parameter.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actor('<ACTOR ID>') .builds() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "status": "SUCCEEDED",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "usageTotalUsd": 0.02,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}
}
]
}
}
Build actor
ClientsBuilds an Actor. The response is the build object as returned by the Get build endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
version required | string Example: version=0.0 Actor version number to be built. |
useCache | boolean Example: useCache=true If |
betaPackages | boolean Example: betaPackages=true If |
tag | string Example: tag=latest Tag to be applied to the build on success. By default, the tag is taken
from Actor version's |
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the build to finish.
By default it is |
Responses
Location | any |
Response Schema: application/json
required | object (Build) | ||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const build = await apifyClient .actor('<ACTOR ID>') .build('0.0'); console.log(build);
Response samples
- 201
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "klmdEpoiojmdEMlk3",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "SUCCEEDED",
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "durationMillis": 1000,
- "runTimeSecs": 45.718,
- "computeUnits": 0.012699444444444444
}, - "options": {
- "useCache": false,
- "betaPackages": false,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "usage": {
- "ACTOR_COMPUTE_UNITS": 0.08
}, - "usageTotalUsd": 0.02,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.02
}, - "inputSchema": "{\\n \\\"title\\\": \\\"Schema for ... }",
- "readme": "# Magic Actor\\nThis Actor is magic.",
- "buildNumber": "0.1.1"
}
}
[DEPRECATED] API endpoints related to build of the actor were moved under new namespace actor-builds
.
Get build Deprecated
By passing the optional waitForFinish
parameter the API endpoint will
synchronously wait for the build to finish.
This is useful to avoid periodic polling when waiting for an Actor build to finish.
This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the build. However,
if you access the endpoint without the token, certain attributes, such as usageUsd
and usageTotalUsd
, will be hidden.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
buildId required | string Example: soSkq9ekdmfOslopH ID of the build you want to get, found in the build's |
query Parameters
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the build to finish.
By default it is |
Responses
Response Schema: application/json
required | object (Build) | ||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "klmdEpoiojmdEMlk3",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "SUCCEEDED",
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "durationMillis": 1000,
- "runTimeSecs": 45.718,
- "computeUnits": 0.012699444444444444
}, - "options": {
- "useCache": false,
- "betaPackages": false,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "usage": {
- "ACTOR_COMPUTE_UNITS": 0.08
}, - "usageTotalUsd": 0.02,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.02
}, - "inputSchema": "{\\n \\\"title\\\": \\\"Schema for ... }",
- "readme": "# Magic Actor\\nThis Actor is magic.",
- "buildNumber": "0.1.1"
}
}
[DEPRECATED] API endpoints related to build of the actor were moved under new namespace actor-builds
.
Abort build Deprecated
[DEPRECATED] API endpoints related to build of the Actor were moved
under new namespace actor-builds
. Aborts an
Actor build and returns an object that contains all the details about the
build.
Only builds that are starting or running are aborted. For builds with status
FINISHED
, FAILED
, ABORTING
and TIMED-OUT
this call does nothing.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
buildId required | string Example: 3KH8gEpp4d8uQSe8T Build ID. |
Responses
Response Schema: application/json
required | object (Build) | ||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "klmdEpoiojmdEMlk3",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "ABORTED",
- "meta": {
- "origin": "WEB"
}, - "stats": {
- "durationMillis": 1000,
- "runTimeSecs": 5.718
}, - "options": {
- "useCache": false,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "usage": {
- "ACTOR_COMPUTE_UNITS": 0.08
}, - "usageTotalUsd": 0.02,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.02
}
}
}
Get list of runs
ClientsGets the list of runs of a specific actor. The response is a list of objects, where each object contains basic information about a single actor run.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 array elements.
By default, the records are sorted by the startedAt
field in ascending
order, therefore you can use pagination to incrementally fetch all records while
new ones are still being created. To sort the records in descending order, use
desc=1
parameter. You can also filter runs by status (available
statuses).
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The
default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as
the maximum is |
desc | boolean Example: desc=true If |
status |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .actor('<ACTOR ID>') .runs() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "SUCCEEDED",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "buildId": "HG7ML7M8z78YcAPEB",
- "buildNumber": "0.0.2",
- "meta": {
- "origin": "WEB"
}, - "usageTotalUsd": 0.2,
- "defaultKeyValueStoreId": "sfAjeR4QmeJCQzTfe",
- "defaultDatasetId": "3ZojQDdFTsyE7Moy4",
- "defaultRequestQueueId": "so93g2shcDzK3pA85"
}, - {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "FAILED",
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-13T08:36:13.202Z",
- "buildId": "u78dML7M8z78YcAPEB",
- "buildNumber": "0.2.2",
- "meta": {
- "origin": "DEVELOPMENT"
}, - "usageTotalUsd": 0.6,
- "defaultKeyValueStoreId": "sffsouqlseJCQzTfe",
- "defaultDatasetId": "CFGggdjQDsyE7Moyw",
- "defaultRequestQueueId": "soowucklrmDzKpA8x"
}
]
}
}
Run actor
ClientsRuns an Actor and immediately returns without waiting for the run to finish.
The POST payload including its Content-Type
header is passed as INPUT
to
the Actor (usually application/json
).
The Actor is started with the default options; you can override them using various URL query parameters.
The response is the Run object as returned by the Get run API endpoint.
If you want to wait for the run to finish and receive the actual output of the Actor as the response, please use one of the Run Actor synchronously API endpoints instead.
To fetch the Actor run results that are typically stored in the default
dataset, you'll need to pass the ID received in the defaultDatasetId
field
received in the response JSON to the Get items
API endpoint.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the Actor run should return. This is
useful for pay-per-result Actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your Actor by using the
|
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the default run
configuration for the Actor (typically |
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the run to finish. By
default, it is |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see Webhooks documentation. |
Request Body schema: application/jsonrequired
Responses
Location | any |
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "foo": "bar"
}
Response samples
- 201
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
With input
Runs a specific Actor and returns its output.
The POST payload including its Content-Type
header is passed as INPUT
to
the Actor (usually application/json
).
The HTTP response contains Actors OUTPUT
record from its default
key-value store.
The Actor is started with the default options; you can override them using various URL query parameters.
If the Actor run exceeds 300 seconds, the HTTP response will have status 408 (Request Timeout).
Beware that it might be impossible to maintain an idle HTTP connection for a long period of time, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Actor asynchronously, use the Run Actor API endpoint instead.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
outputRecordKey | string Example: outputRecordKey=OUTPUT Key of the record from run's default key-value store to be returned
in the response. By default, it is |
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the Actor run should return. This is
useful for pay-per-result Actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your Actor by using the
|
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the default run
configuration for the Actor (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
Request Body schema: application/jsonrequired
Responses
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Request samples
- Payload
{- "foo": "bar"
}
Response samples
- 201
- 400
- 408
{- "bar": "foo"
}
Without input
Runs a specific Actor and returns its output.
The run must finish in 300 seconds otherwise the API endpoint returns a timeout error.
The Actor is not passed any input.
Beware that it might be impossible to maintain an idle HTTP connection for a long period of time,
due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Actor asynchronously, use the Run Actor API endpoint instead.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
outputRecordKey | string Example: outputRecordKey=OUTPUT Key of the record from run's default key-value store to be returned
in the response. By default, it is |
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the Actor run should return. This is
useful for pay-per-result Actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your Actor by using the
|
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the default run
configuration for the Actor (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
Responses
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Response samples
- 201
- 400
- 408
{- "foo": "bar"
}
Run actor synchronously with input and get dataset items
Runs a specific Actor and returns its dataset items.
The POST payload including its Content-Type
header is passed as INPUT
to
the Actor (usually application/json
).
The HTTP response contains the Actors dataset items, while the format of
items depends on specifying dataset items' format
parameter.
You can send all the same options in parameters as the Get Dataset Items API endpoint.
The Actor is started with the default options; you can override them using URL query parameters.
If the Actor run exceeds 300 seconds,
the HTTP response will return the 408 status code (Request Timeout).
Beware that it might be impossible to maintain an idle HTTP connection for a long period of time,
due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Actor asynchronously, use the Run Actor API endpoint instead.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the Actor run should return. This is
useful for pay-per-result Actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your Actor by using the
|
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the default run
configuration for the Actor (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
format | string Example: format=json Format of the results, possible values are: |
clean | boolean Example: clean=false If (i.e. fields starting with the # character). The Note that since some objects might be skipped from the output, that the
result might contain less items than the |
offset | number <double> Example: offset=0 Number of items that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of items to return. By default there is no limit. |
fields | string Example: fields=myValue,myOtherValue A comma-separated list of fields which should be picked from the items, only these fields will remain in the resulting record objects. Note that the fields in the outputted items are sorted the same way as
they are specified in the You can use this feature to effectively fix the output format. |
omit | string Example: omit=myValue,myOtherValue A comma-separated list of fields which should be omitted from the items. |
unwind | string Example: unwind=myValue,myOtherValue A comma-separated list of fields which should be unwound, in order which they should be processed. Each field should be either an array or an object. If the field is an array then every element of the array will become a separate record and merged with parent object. If the unwound field is an object then it is merged with the parent object If the unwound field is missing or its value is neither an array nor an object and therefore cannot be merged with a parent object then the item gets preserved as it is. Note that the unwound items ignore the |
flatten | string Example: flatten=myValue A comma-separated list of fields which should transform nested objects into flat structures. For example, with The original object with properties is replaced with the flattened object. |
desc | boolean Example: desc=true By default, results are returned in the same order as they were stored.
To reverse the order, set this parameter to |
attachment | boolean Example: attachment=true If |
delimiter | string Example: delimiter=; A delimiter character for CSV files, only used if |
bom | boolean Example: bom=false All text responses are encoded in UTF-8 encoding. By default, the
the UTF-8 Byte Order Mark (BOM), while If you want to override this default behavior, specify |
xmlRoot | string Example: xmlRoot=items Overrides default root element name of |
xmlRow | string Example: xmlRow=item Overrides default element name that wraps each page or page function
result object in |
skipHeaderRow | boolean Example: skipHeaderRow=true If |
skipHidden | boolean Example: skipHidden=false If |
skipEmpty | boolean Example: skipEmpty=false If Note that if used, the results might contain less items than the limit value. |
simplified | boolean Example: simplified=false If and legacy Apify Crawler product and it's not recommended to use it in new integrations. |
skipFailedPages | boolean Example: skipFailedPages=false If This feature is here to emulate functionality of API version 1 used for the legacy Apify Crawler product and it's not recommended to use it in new integrations. |
Request Body schema: application/jsonrequired
Responses
X-Apify-Pagination-Offset | any |
X-Apify-Pagination-Limit | any |
X-Apify-Pagination-Count | any |
X-Apify-Pagination-Total | any |
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Request samples
- Payload
{- "foo": "bar"
}
Response samples
- 201
- 400
- 408
[- {
- "myValue": "some value",
- "myOtherValue": "some other value"
}
]
Run actor synchronously without input and get dataset items
Runs a specific actor and returns its dataset items.
The run must finish in 300 seconds otherwise the API endpoint returns a timeout error.
The actor is not passed any input.
It allows to send all possible options in parameters from Get Dataset Items API endpoint.
Beware that it might be impossible to maintain an idle HTTP connection for a long period of time,
due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Actor asynchronously, use the Run Actor API endpoint instead.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the default run configuration for the Actor. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the default run configuration for the Actor. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the Actor run should return. This is
useful for pay-per-result Actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your Actor by using the
|
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the default run
configuration for the Actor (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the Actor run, which can be used to receive a notification e.g. when the Actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
format | string Example: format=json Format of the results, possible values are: |
clean | boolean Example: clean=false If (i.e. fields starting with the # character). The Note that since some objects might be skipped from the output, that the
result might contain less items than the |
offset | number <double> Example: offset=0 Number of items that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of items to return. By default there is no limit. |
fields | string Example: fields=myValue,myOtherValue A comma-separated list of fields which should be picked from the items, only these fields will remain in the resulting record objects. Note that the fields in the outputted items are sorted the same way as
they are specified in the You can use this feature to effectively fix the output format. |
omit | string Example: omit=myValue,myOtherValue A comma-separated list of fields which should be omitted from the items. |
unwind | string Example: unwind=myValue,myOtherValue A comma-separated list of fields which should be unwound, in order which they should be processed. Each field should be either an array or an object. If the field is an array then every element of the array will become a separate record and merged with parent object. If the unwound field is an object then it is merged with the parent object If the unwound field is missing or its value is neither an array nor an object and therefore cannot be merged with a parent object then the item gets preserved as it is. Note that the unwound items ignore the |
flatten | string Example: flatten=myValue A comma-separated list of fields which should transform nested objects into flat structures. For example, with The original object with properties is replaced with the flattened object. |
desc | boolean Example: desc=true By default, results are returned in the same order as they were stored.
To reverse the order, set this parameter to |
attachment | boolean Example: attachment=true If |
delimiter | string Example: delimiter=; A delimiter character for CSV files, only used if |
bom | boolean Example: bom=false All text responses are encoded in UTF-8 encoding. By default, the
the UTF-8 Byte Order Mark (BOM), while If you want to override this default behavior, specify |
xmlRoot | string Example: xmlRoot=items Overrides default root element name of |
xmlRow | string Example: xmlRow=item Overrides default element name that wraps each page or page function
result object in |
skipHeaderRow | boolean Example: skipHeaderRow=true If |
skipHidden | boolean Example: skipHidden=false If |
skipEmpty | boolean Example: skipEmpty=false If Note that if used, the results might contain less items than the limit value. |
simplified | boolean Example: simplified=false If and legacy Apify Crawler product and it's not recommended to use it in new integrations. |
skipFailedPages | boolean Example: skipFailedPages=false If This feature is here to emulate functionality of API version 1 used for the legacy Apify Crawler product and it's not recommended to use it in new integrations. |
Responses
X-Apify-Pagination-Offset | any |
X-Apify-Pagination-Limit | any |
X-Apify-Pagination-Count | any |
X-Apify-Pagination-Total | any |
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Response samples
- 201
- 400
- 408
[- {
- "myValue": "some value",
- "myOtherValue": "some other value"
}
]
[DEPRECATED] API endpoints related to run of the actor were moved under new namespace actor-runs
.
Get run Deprecated
[DEPRECATED] API endpoints related to run of the Actor were moved under
new namespace actor-runs
.
Gets an object that contains all the details about a specific run of an Actor.
By passing the optional waitForFinish
parameter the API endpoint will
synchronously wait for the run to finish.
This is useful to avoid periodic polling when waiting for Actor run to complete.
This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the run. However,
if you access the endpoint without the token, certain attributes, such as usageUsd
and usageTotalUsd
, will be hidden.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the run to finish. By
default it is |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
[DEPRECATED] API endpoints related to run of the actor were moved under new namespace actor-runs
.
Abort run Deprecated
[DEPRECATED] API endpoints related to run of the Actor were moved under
new namespace actor-runs
. Aborts an Actor run and
returns an object that contains all the details about the run.
Only runs that are starting or running are aborted. For runs with status
FINISHED
, FAILED
, ABORTING
and TIMED-OUT
this call does nothing.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
gracefully | boolean Example: gracefully=true If true passed, the Actor run will abort gracefully.
It will send |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "BPWZBd7Z9c746JAng",
- "actorTaskId": "rANaydYhUxjsnA3oz",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "ABORTED",
- "statusMessage": "Actor was aborted",
- "isStatusMessageTerminal": true,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 1,
- "memAvgBytes": 35914228.4,
- "memMaxBytes": 38244352,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 0.00955965,
- "cpuMaxUsage": 3.1546,
- "cpuCurrentUsage": 0,
- "netRxBytes": 2652,
- "netTxBytes": 1338,
- "durationMillis": 26239,
- "runTimeSecs": 26.239,
- "metamorph": 0,
- "computeUnits": 0.0072886
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "isContainerServerReady": false,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
[DEPRECATED] API endpoints related to run of the actor were moved under new namespace actor-runs
.
Metamorph run Deprecated
[DEPRECATED] API endpoints related to run of the actor were moved under
new namespace actor-runs
.Transforms an actor run
into a run of another actor with a new input.
This is useful if you want to use another actor to finish the work
of your current actor run, without the need to create a completely new run and waiting for its finish.
For the users of your actors, the metamorph operation is transparent, they will just see your actor got the work done.
There is a limit on how many times you can metamorph a single run. You can check the limit in the Actor runtime limits.
Internally, the system stops the Docker container corresponding to the actor run
and starts a new container using a different Docker image.
All the default storages are preserved and the new input is stored under the
INPUT-METAMORPH-1
key in the same default key-value store.
For more information, see the Actor docs.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
runId required | string Example: 3KH8gEpp4d8uQSe8T Actor run ID. |
query Parameters
targetActorId required | string Example: targetActorId=HDSasDasz78YcAPEB ID of a target Actor that the run should be transformed into. |
build | string Example: build=beta Optional build of the target Actor. It can be either a build tag or build number. By default, the run uses
the build specified in the default run configuration for the target
Actor (typically |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "PNWZBd7Z9c746JAnF",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": null,
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 1,
- "memAvgBytes": 35914228.4,
- "memMaxBytes": 38244352,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 0.00955965,
- "cpuMaxUsage": 3.1546,
- "cpuCurrentUsage": 0,
- "netRxBytes": 2652,
- "netTxBytes": 1338,
- "durationMillis": 26239,
- "runTimeSecs": 26.239,
- "metamorph": 0,
- "computeUnits": 0.0072886
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "HG7ML7M8z78YcAPEB",
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "metamorphs": [
- {
- "createdAt": "2019-11-30T07:39:24.202Z",
- "actorId": "nspoEjklmnsF2oosD",
- "buildId": "ME6oKecqy5kXDS4KQ",
- "inputKey": "INPUT-METAMORPH-1"
}
], - "buildNumber": "0.1.10",
- "isContainerServerReady": false,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
[DEPRECATED] API endpoints related to run of the actor were moved under new namespace actor-runs
.
Resurrect run
[DEPRECATED] API endpoints related to run of the Actor were moved under
new namespace actor-runs
.Resurrects a finished
Actor run and returns an object that contains all the details about the
resurrected run.
Only finished runs, i.e. runs with status FINISHED
, FAILED
, ABORTED
and TIMED-OUT
can be resurrected.
Run status will be updated to RUNNING and its container will be restarted with the same storages
(the same behaviour as when the run gets migrated to the new server).
For more information, see the Actor docs.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
build | string Example: build=0.1.234 Specifies the Actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the run that is
being resurrected (typically |
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the run that is being resurrected. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the run that is being resurrected. |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
This is not a single endpoint, but an entire group of endpoints that lets you to retrieve and manage the last run of given actor or any of its default storages. All the endpoints require an authentication token.
The endpoints accept the same HTTP methods and query parameters as the respective storage endpoints. The base path represents the last actor run object is:
/v2/acts/{actorId}/runs/last{?token,status}
Using the status
query parameter you can ensure to only get a run with a certain status
(e.g. status=SUCCEEDED
). The output of this endpoint and other query parameters
are the same as in the Run object endpoint.
In order to access the default storages of the last actor run, i.e. log, key-value store, dataset and request queue, use the following endpoints:
/v2/acts/{actorId}/runs/last/log{?token,status}
/v2/acts/{actorId}/runs/last/key-value-store{?token,status}
/v2/acts/{actorId}/runs/last/dataset{?token,status}
/v2/acts/{actorId}/runs/last/request-queue{?token,status}
These API endpoints have the same usage as the equivalent storage endpoints.
For example,
/v2/acts/{actorId}/runs/last/key-value-store
has the same HTTP method and parameters as the
Key-value store object endpoint.
Additionally, each of the above API endpoints supports all sub-endpoints of the original one:
Key-value store
/v2/acts/{actorId}/runs/last/key-value-store/keys{?token,status}
Key collection/v2/acts/{actorId}/runs/last/key-value-store/records/{recordKey}{?token,status}
Record
Dataset
/v2/acts/{actorId}/runs/last/dataset/items{?token,status}
Item collection
Request queue
/v2/acts/{actorId}/runs/last/request-queue/requests{?token,status}
Request collection/v2/acts/{actorId}/runs/last/request-queue/requests/{requestId}{?token,status}
Request collection/v2/acts/{actorId}/runs/last/request-queue/head{?token,status}
Queue head
For example, to download data from a dataset of the last succeeded actor run in XML format, send HTTP GET request to the following URL:
https://api.apify.com/v2/acts/{actorId}/runs/last/dataset/items?token={yourApiToken}&format=xml&status=SUCCEEDED
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL.
Get last run
This is not a single endpoint, but an entire group of endpoints that lets you to retrieve and manage the last run of given Actor or any of its default storages. All the endpoints require an authentication token.
The endpoints accept the same HTTP methods and query parameters as the respective storage endpoints. The base path represents the last Actor run object is:
/v2/acts/{actorId}/runs/last{?token,status}
Using the status
query parameter you can ensure to only get a run with a certain status
(e.g. status=SUCCEEDED
). The output of this endpoint and other query parameters
are the same as in the Run object endpoint.
In order to access the default storages of the last Actor run, i.e. log, key-value store, dataset and request queue, use the following endpoints:
/v2/acts/{actorId}/runs/last/log{?token,status}
/v2/acts/{actorId}/runs/last/key-value-store{?token,status}
/v2/acts/{actorId}/runs/last/dataset{?token,status}
/v2/acts/{actorId}/runs/last/request-queue{?token,status}
These API endpoints have the same usage as the equivalent storage endpoints.
For example,
/v2/acts/{actorId}/runs/last/key-value-store
has the same HTTP method and parameters as the
Key-value store object endpoint.
Additionally, each of the above API endpoints supports all sub-endpoints of the original one:
Key-value store
/v2/acts/{actorId}/runs/last/key-value-store/keys{?token,status}
Key collection/v2/acts/{actorId}/runs/last/key-value-store/records/{recordKey}{?token,status}
Record
Dataset
/v2/acts/{actorId}/runs/last/dataset/items{?token,status}
Item collection
Request queue
/v2/acts/{actorId}/runs/last/request-queue/requests{?token,status}
Request collection/v2/acts/{actorId}/runs/last/request-queue/requests/{requestId}{?token,status}
Request collection/v2/acts/{actorId}/runs/last/request-queue/head{?token,status}
Queue head
For example, to download data from a dataset of the last succeeded Actor run in XML format, send HTTP GET request to the following URL:
https://api.apify.com/v2/acts/{actorId}/runs/last/dataset/items?token={yourApiToken}&format=xml&status=SUCCEEDED
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL.
Authorizations:
path Parameters
actorId required | string Example: janedoe~my-actor Actor ID or a tilde-separated owner's username and Actor name. |
query Parameters
status | string Example: status=SUCCEEDED Filter for the run status. |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const lastRun = await apifyClient .actor('<ACTOR ID>') .lastRun(); console.log(lastRun);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
The API endpoints described in this section enable you to manage and run Apify actor tasks. For more information, see the Actor tasks documentation.
Note that for all the API endpoints that accept the actorTaskId
parameter to specify a task,
you can pass either the task ID (e.g. HG7ML7M8z78YcAPEB
) or a tilde-separated
username of the task's owner and the task's name (e.g. janedoe~my-task
).
Some of the API endpoints return runs objects. Note that if any such run object contains usage in dollars, your effective unit pricing at the time of query has been used for computation of this dollar equivalent, and hence it should be used only for informative purposes. You can learn more about platform usage in the documentation.
Get list of tasks
ClientsGets the complete list of tasks that a user has created or used. The response is a list of objects in which each object contains essential information about a single task.
The endpoint supports pagination using the limit
and offset
parameters,
and it does not return more than a 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order; therefore you can use pagination to incrementally fetch all tasks while new
ones are still being created. To sort the records in descending order, use
the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .tasks() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "zdc3Pyhyz3m8vjDeM",
- "userId": "wRsJZtadYvn4mBZmm",
- "actId": "asADASadYvn4mBZmm",
- "actName": "my-actor",
- "name": "my-task",
- "username": "janedoe",
- "actUsername": "janedoe",
- "createdAt": "2018-10-26T07:23:14.855Z",
- "modifiedAt": "2018-10-26T13:30:49.578Z",
- "stats": {
- "totalRuns": 15
}
}, - {
- "id": "aWE3asdas3m8vjDeM",
- "userId": "wRsJZtadYvn4mBZmm",
- "actId": "asADASadYvn4mBZmm",
- "actName": "my-actor",
- "actUsername": "janedoe",
- "name": "my-task-2",
- "username": "janedoe",
- "createdAt": "2018-10-26T07:23:14.855Z",
- "modifiedAt": "2018-10-26T13:30:49.578Z",
- "stats": {
- "totalRuns": 4
}
}
]
}
}
Create task
ClientsCreate 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. (More
info).
Authorizations:
Request Body schema: application/jsonrequired
actId required | string |
name required | string |
(any or null) or TaskOptions (object) | |
(any or null) or TaskInput (object) |
Responses
Location | any |
Response Schema: application/json
required | object (Task) | ||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "actId": "asADASadYvn4mBZmm",
- "name": "my-task",
- "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 128
}
}
Response samples
- 201
{- "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"
}
}
}
Get task
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
Responses
Response Schema: application/json
required | object (Task) | ||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const task = await apifyClient .task('<TASK ID>') .get(); console.log(task);
Response samples
- 200
{- "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"
}
}
}
Update task
ClientsUpdate settings of a task using values specified by an object passed as JSON in the POST payload.
If the object does not define a specific property, its value is not updated.
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. (More
info).
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
Request Body schema: application/jsonrequired
id required | string |
userId required | string |
actId required | string |
name required | string |
username | string or null |
createdAt required | string |
modifiedAt required | string |
removedAt | string or null |
(any or null) or TaskStats (object) | |
(any or null) or TaskOptions (object) | |
(any or null) or Task (object) |
Responses
Response Schema: application/json
required | object (Task) | ||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "id": "ZxLNxrRaZrSjuhT9y",
- "userId": "BPWZBd7Z9c746JAnF",
- "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"
}
}
Response samples
- 200
{- "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"
}
}
}
Delete task
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient.task('<TASK ID>').delete();
Response samples
- 204
{ }
Get task input
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const input = await apifyClient .task('<TASK ID>') .getInput(); console.log(input);
Response samples
- 200
{- "myField1": "some-value",
- "myField2": "another-value",
- "myField3": 1
}
Update task input
ClientsUpdates the input of a task using values specified by an object passed as JSON in the PUT payload.
If the object does not define a specific property, its value is not updated.
The response is the full task input as returned by the Get task input 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. (More
info).
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
Request Body schema: application/jsonrequired
Responses
Response Schema: application/json
Request samples
- Payload
- JS client
{- "myField2": "updated-value"
}
Response samples
- 200
{- "myField1": "some-value",
- "myField2": "updated-value",
- "myField3": 1
}
Get list of webhooks
Gets the list of webhooks of a specific actor task. The response is a JSON with the list of objects, where each object contains basic information about a single webhook.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order, to sort the records in descending order, use the desc=1
parameter.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The
default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as
the maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .task('<TASK ID>') .webhooks() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}, - {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
]
}
}
Get list of task runs
Get a list of runs of a specific task. The response is a list of objects, where each object contains essential information about a single task run.
The endpoint supports pagination using the limit
and offset
parameters,
and it does not return more than a 1000 array elements.
By default, the records are sorted by the startedAt
field in ascending
order; therefore you can use pagination to incrementally fetch all records while
new ones are still being created. To sort the records in descending order, use
the desc=1
parameter. You can also filter runs by status (available
statuses).
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as the maximum is |
desc | boolean Example: desc=true If |
status |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .task('<TASK ID>') .runs() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "SUCCEEDED",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "buildId": "HG7ML7M8z78YcAPEB",
- "buildNumber": "0.0.2",
- "meta": {
- "origin": "WEB"
}, - "usageTotalUsd": 0.2,
- "defaultKeyValueStoreId": "sfAjeR4QmeJCQzTfe",
- "defaultDatasetId": "3ZojQDdFTsyE7Moy4",
- "defaultRequestQueueId": "so93g2shcDzK3pA85"
}, - {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "FAILED",
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-13T08:36:13.202Z",
- "buildId": "u78dML7M8z78YcAPEB",
- "buildNumber": "0.2.2",
- "meta": {
- "origin": "DEVELOPMENT"
}, - "usageTotalUsd": 0.6,
- "defaultKeyValueStoreId": "sffsouqlseJCQzTfe",
- "defaultDatasetId": "CFGggdjQDsyE7Moyw",
- "defaultRequestQueueId": "soowucklrmDzKpA8x"
}
]
}
}
Run task
ClientsRuns an actor task and immediately returns without waiting for the run to finish.
Optionally, you can override the actor input configuration by passing a JSON
object as the POST payload and setting the Content-Type: application/json
HTTP header.
Note that if the object in the POST payload does not define a particular input property, the actor run uses the default value defined by the task (or actor's input schema if not defined by the task).
The response is the actor Run object as returned by the Get run endpoint.
If you want to wait for the run to finish and receive the actual output of the actor run as the response, use one of the Run task synchronously API endpoints instead.
To fetch the actor run results that are typically stored in the default
dataset, you'll need to pass the ID received in the defaultDatasetId
field
received in the response JSON to the
Get items API endpoint.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the task settings. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the task settings. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the actor run should return. This is
useful for pay-per-result actors, as it allows you to limit the number
of results that will be charged to your subscription. You can access the
maximum number of items in your actor by using the
|
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the task
settings (typically |
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the run to finish. By
default, it is If the build finishes in time then the returned run object will have a
terminal status (e.g. otherwise it will have a transitional status (e.g. |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. Note: if you already have a webhook set up for the actor or task, you do not have to add it again here. For more information, see Webhooks documentation. |
Request Body schema: application/jsonrequired
Responses
Location | any |
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "foo": "bar"
}
Response samples
- 201
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "BPWZBd9V9c746JAnF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "SUCCEEDED",
- "statusMessage": "Actor has finished",
- "isStatusMessageTerminal": true,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)",
- "scheduleId": "dWazFsPpxMigMSqHL",
- "scheduledAt": "2019-06-10T11:40:00.000Z"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 35914228.4,
- "memMaxBytes": 38244352,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 0.00955965,
- "cpuMaxUsage": 3.15469,
- "cpuCurrentUsage": 0,
- "netRxBytes": 2652,
- "netTxBytes": 1338,
- "durationMillis": 26239,
- "runTimeSecs": 26.239,
- "metamorph": 0,
- "computeUnits": 0.0072886
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.2.2",
- "isContainerServerReady": false,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Run task synchronously (POST)
Runs an actor task and synchronously returns its output.
The run must finish in 300 seconds otherwise the HTTP request fails with a timeout error (this won't abort the run itself).
Optionally, you can override the actor input configuration by passing a JSON
object as the POST payload and setting the Content-Type: application/json
HTTP header.
Note that if the object in the POST payload does not define a particular input property, the actor run uses the default value defined by the task (or actor's input schema if not defined by the task).
Beware that it might be impossible to maintain an idle HTTP connection for an extended period, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
Input fields from actor task configuration can be overloaded with values passed as the POST payload.
Just make sure to specify Content-Type
header to be application/json
and
input to be an object.
To run the task asynchronously, use the Run task API endpoint instead.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the task settings. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the task settings. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the task run should return. This is
useful for pay-per-result tasks, as it allows you to limit the number of
results that will be charged to your subscription. You can access the
maximum number of items in your actor by using the
|
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the task
settings (typically |
outputRecordKey | string Example: outputRecordKey=OUTPUT Key of the record from run's default key-value store to be returned
in the response. By default, it is |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
Request Body schema: application/jsonrequired
Responses
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Request samples
- Payload
{- "foo": "bar"
}
Response samples
- 201
- 400
{- "bar": "foo"
}
Run task synchronously (GET)
Run a specific task and return its output.
The run must finish in 300 seconds otherwise the HTTP request fails with a timeout error (this won't abort the run itself).
Beware that it might be impossible to maintain an idle HTTP connection for an extended period, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Task asynchronously, use the Run task asynchronously endpoint instead.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the task settings. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the task settings. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the task run should return. This is
useful for pay-per-result tasks, as it allows you to limit the number of
results that will be charged to your subscription. You can access the
maximum number of items in your actor by using the
|
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the task
settings (typically |
outputRecordKey | string Example: outputRecordKey=OUTPUT Key of the record from run's default key-value store to be returned
in the response. By default, it is |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
Responses
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Response samples
- 201
- 400
- 408
{- "bar": "foo"
}
Run task synchronously and get dataset items (POST)
Runs an actor task and synchronously returns its dataset items.
The run must finish in 300 seconds otherwise the HTTP request fails with a timeout error (this won't abort the run itself).
Optionally, you can override the actor input configuration by passing a JSON
object as the POST payload and setting the Content-Type: application/json
HTTP header.
Note that if the object in the POST payload does not define a particular input property, the actor run uses the default value defined by the task (or the actor's input schema if not defined by the task).
You can send all the same options in parameters as the Get Dataset Items API endpoint.
Beware that it might be impossible to maintain an idle HTTP connection for an extended period, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
Input fields from actor task configuration can be overloaded with values passed as the POST payload.
Just make sure to specify the Content-Type
header as application/json
and that the input is an object.
To run the task asynchronously, use the Run task API endpoint instead.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the task settings. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the task settings. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the task run should return. This is
useful for pay-per-result tasks, as it allows you to limit the number of
results that will be charged to your subscription. You can access the
maximum number of items in your actor by using the
|
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the task
settings (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
format | string Example: format=json Format of the results, possible values are: |
clean | boolean Example: clean=false If (i.e. fields starting with the # character). The Note that since some objects might be skipped from the output, that the
result might contain less items than the |
offset | number <double> Example: offset=0 Number of items that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of items to return. By default there is no limit. |
fields | string Example: fields=myValue,myOtherValue A comma-separated list of fields which should be picked from the items, only these fields will remain in the resulting record objects. Note that the fields in the outputted items are sorted the same way as
they are specified in the You can use this feature to effectively fix the output format. |
omit | string Example: omit=myValue,myOtherValue A comma-separated list of fields which should be omitted from the items. |
unwind | string Example: unwind=myValue,myOtherValue A comma-separated list of fields which should be unwound, in order which they should be processed. Each field should be either an array or an object. If the field is an array then every element of the array will become a separate record and merged with parent object. If the unwound field is an object then it is merged with the parent object If the unwound field is missing or its value is neither an array nor an object and therefore cannot be merged with a parent object then the item gets preserved as it is. Note that the unwound items ignore the |
flatten | string Example: flatten=myValue A comma-separated list of fields which should transform nested objects into flat structures. For example, with The original object with properties is replaced with the flattened object. |
desc | boolean Example: desc=true By default, results are returned in the same order as they were stored.
To reverse the order, set this parameter to |
attachment | boolean Example: attachment=true If |
delimiter | string Example: delimiter=; A delimiter character for CSV files, only used if |
bom | boolean Example: bom=false All text responses are encoded in UTF-8 encoding. By default, the
the UTF-8 Byte Order Mark (BOM), while If you want to override this default behavior, specify |
xmlRoot | string Example: xmlRoot=items Overrides default root element name of |
xmlRow | string Example: xmlRow=item Overrides default element name that wraps each page or page function
result object in |
skipHeaderRow | boolean Example: skipHeaderRow=true If |
skipHidden | boolean Example: skipHidden=false If |
skipEmpty | boolean Example: skipEmpty=false If Note that if used, the results might contain less items than the limit value. |
simplified | boolean Example: simplified=false If and legacy Apify Crawler product and it's not recommended to use it in new integrations. |
skipFailedPages | boolean Example: skipFailedPages=false If This feature is here to emulate functionality of API version 1 used for the legacy Apify Crawler product and it's not recommended to use it in new integrations. |
Request Body schema: application/jsonrequired
Responses
X-Apify-Pagination-Offset | any |
X-Apify-Pagination-Limit | any |
X-Apify-Pagination-Count | any |
X-Apify-Pagination-Total | any |
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Request samples
- Payload
{- "foo": "bar"
}
Response samples
- 201
- 400
{ }
Run task synchronously and get dataset items (GET)
Run a specific task and return its dataset items.
The run must finish in 300 seconds otherwise the HTTP request fails with a timeout error (this won't abort the run itself).
You can send all the same options in parameters as the Get Dataset Items API endpoint.
Beware that it might be impossible to maintain an idle HTTP connection for an extended period, due to client timeout or network conditions. Make sure your HTTP client is configured to have a long enough connection timeout.
If the connection breaks, you will not receive any information about the run and its status.
To run the Task asynchronously, use the Run task asynchronously endpoint instead.
Authorizations:
path Parameters
actorTaskId required | string Example: janedoe~my-task Task ID or a tilde-separated owner's username and task's name. |
query Parameters
timeout | number <double> Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the task settings. |
memory | number <double> Example: memory=256 Memory limit for the run, in megabytes. The amount of memory can be set to a power of 2 with a minimum of 128. By default, the run uses a memory limit specified in the task settings. |
maxItems | number <double> Example: maxItems=1000 The maximum number of items that the task run should return. This is
useful for pay-per-result tasks, as it allows you to limit the number of
results that will be charged to your subscription. You can access the
maximum number of items in your actor by using the
|
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build
number. By default, the run uses the build specified in the task
settings (typically |
webhooks | string Example: webhooks=dGhpcyBpcyBqdXN0IGV4YW1wbGUK... Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. The value is a Base64-encoded JSON array of objects defining the webhooks. For more information, see |
format | string Example: format=json Format of the results, possible values are: |
clean | boolean Example: clean=false If (i.e. fields starting with the # character). The Note that since some objects might be skipped from the output, that the
result might contain less items than the |
offset | number <double> Example: offset=0 Number of items that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of items to return. By default there is no limit. |
fields | string Example: fields=myValue,myOtherValue A comma-separated list of fields which should be picked from the items, only these fields will remain in the resulting record objects. Note that the fields in the outputted items are sorted the same way as
they are specified in the You can use this feature to effectively fix the output format. |
omit | string Example: omit=myValue,myOtherValue A comma-separated list of fields which should be omitted from the items. |
unwind | string Example: unwind=myValue,myOtherValue A comma-separated list of fields which should be unwound, in order which they should be processed. Each field should be either an array or an object. If the field is an array then every element of the array will become a separate record and merged with parent object. If the unwound field is an object then it is merged with the parent object If the unwound field is missing or its value is neither an array nor an object and therefore cannot be merged with a parent object then the item gets preserved as it is. Note that the unwound items ignore the |
flatten | string Example: flatten=myValue A comma-separated list of fields which should transform nested objects into flat structures. For example, with The original object with properties is replaced with the flattened object. |
desc | boolean Example: desc=true By default, results are returned in the same order as they were stored.
To reverse the order, set this parameter to |
attachment | boolean Example: attachment=true If |
delimiter | string Example: delimiter=; A delimiter character for CSV files, only used if |
bom | boolean Example: bom=false All text responses are encoded in UTF-8 encoding. By default, the
the UTF-8 Byte Order Mark (BOM), while If you want to override this default behavior, specify |
xmlRoot | string Example: xmlRoot=items Overrides default root element name of |
xmlRow | string Example: xmlRow=item Overrides default element name that wraps each page or page function
result object in |
skipHeaderRow | boolean Example: skipHeaderRow=true If |
skipHidden | boolean Example: skipHidden=false If |
skipEmpty | boolean Example: skipEmpty=false If Note that if used, the results might contain less items than the limit value. |
simplified | boolean Example: simplified=false If and legacy Apify Crawler product and it's not recommended to use it in new integrations. |
skipFailedPages | boolean Example: skipFailedPages=false If This feature is here to emulate functionality of API version 1 used for the legacy Apify Crawler product and it's not recommended to use it in new integrations. |
Responses
X-Apify-Pagination-Offset | any |
X-Apify-Pagination-Limit | any |
X-Apify-Pagination-Count | any |
X-Apify-Pagination-Total | any |
Response Schema: application/json
Response Schema: application/json
required | object | ||||
|
Response Schema: application/json
required | object | ||||
|
Response samples
- 201
- 400
- 408
{ }
This is not a single endpoint, but an entire group of endpoints that lets you to retrieve and manage the last run of given actor task or any of its default storages. All the endpoints require an authentication token.
The endpoints accept the same HTTP methods and query parameters as the respective storage endpoints. The base path represents the last actor task run object is:
/v2/actor-tasks/{actorTaskId}/runs/last{?token,status}
Using the status
query parameter you can ensure to only get a run with a certain status
(e.g. status=SUCCEEDED
). The output of this endpoint and other query parameters
are the same as in the Run object endpoint.
In order to access the default storages of the last actor task run, i.e. log, key-value store, dataset and request queue, use the following endpoints:
/v2/actor-tasks/{actorTaskId}/runs/last/log{?token,status}
/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store{?token,status}
/v2/actor-tasks/{actorTaskId}/runs/last/dataset{?token,status}
/v2/actor-tasks/{actorTaskId}/runs/last/request-queue{?token,status}
These API endpoints have the same usage as the equivalent storage endpoints.
For example,
/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store
has the same HTTP method and parameters as the
Key-value store object endpoint.
Additionally, each of the above API endpoints supports all sub-endpoints of the original one:
Key-value store
/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store/keys{?token,status}
Key collection/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store/records/{recordKey}{?token,status}
Record
Dataset
/v2/actor-tasks/{actorTaskId}/runs/last/dataset/items{?token,status}
Item collection
Request queue
/v2/actor-tasks/{actorTaskId}/runs/last/request-queue/requests{?token,status}
Request collection/v2/actor-tasks/{actorTaskId}/runs/last/request-queue/requests/{requestId}{?token,status}
Request collection/v2/actor-tasks/{actorTaskId}/runs/last/request-queue/head{?token,status}
Queue head
For example, to download data from a dataset of the last succeeded actor task run in XML format, send HTTP GET request to the following URL:
https://api.apify.com/v2/actor-tasks/{actorTaskId}/runs/last/dataset/items?token={yourApiToken}&format=xml&status=SUCCEEDED
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL.
The API endpoints described in this section enable you to manage Apify actor runs.
Note that if any returned run object contains usage in dollars, your effective unit pricing at the time of query has been used for computation of this dollar equivalent, and hence it should be used only for informative purposes. You can learn more about platform usage in the documentation.
Get user runs list
Gets a list of all runs for a user. The response is a list of objects, where each object contains basic information about a single actor run.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 array elements.
By default, the records are sorted by the startedAt
field in ascending
order. Therefore, you can use pagination to incrementally fetch all records while
new ones are still being created. To sort the records in descending order, use
desc=1
parameter. You can also filter runs by status (available
statuses).
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The
default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value (as well
as the maximum) is |
desc | boolean Example: desc=true If |
status |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .runs() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "SUCCEEDED",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "buildId": "HG7ML7M8z78YcAPEB",
- "buildNumber": "0.0.2",
- "meta": {
- "origin": "WEB"
}, - "usageTotalUsd": 0.2,
- "defaultKeyValueStoreId": "sfAjeR4QmeJCQzTfe",
- "defaultDatasetId": "3ZojQDdFTsyE7Moy4",
- "defaultRequestQueueId": "so93g2shcDzK3pA85"
}, - {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "status": "FAILED",
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-13T08:36:13.202Z",
- "buildId": "u78dML7M8z78YcAPEB",
- "buildNumber": "0.2.2",
- "meta": {
- "origin": "DEVELOPMENT"
}, - "usageTotalUsd": 0.6,
- "defaultKeyValueStoreId": "sffsouqlseJCQzTfe",
- "defaultDatasetId": "CFGggdjQDsyE7Moyw",
- "defaultRequestQueueId": "soowucklrmDzKpA8x"
}
]
}
}
This is not a single endpoint, but an entire group of endpoints that lets you retrieve the run or any of its default storages.
The endpoints accept the same HTTP methods and query parameters as the respective storage endpoints. The base path that represents the actor run object is:
/v2/actor-runs/{runId}{?token}
In order to access the default storages of the actor run, i.e. log, key-value store, dataset and request queue, use the following endpoints:
/v2/actor-runs/{runId}/log{?token}
/v2/actor-runs/{runId}/key-value-store{?token}
/v2/actor-runs/{runId}/dataset{?token}
/v2/actor-runs/{runId}/request-queue{?token}
These API endpoints have the same usage as the equivalent storage endpoints.
For example,
/v2/actor-runs/{runId}/key-value-store
has the same HTTP method and parameters as the
Key-value store object endpoint.
Additionally, each of the above API endpoints supports all sub-endpoints of the original one:
Log
/v2/actor-runs/{runId}/log
Log
Key-value store
/v2/actor-runs/{runId}/key-value-store/keys{?token}
Key collection/v2/actor-runs/{runId}/key-value-store/records/{recordKey}{?token}
Record
Dataset
/v2/actor-runs/{runId}/dataset/items{?token}
Item collection
Request queue
/v2/actor-runs/{runId}/request-queue/requests{?token}
Request collection/v2/actor-runs/{runId}/request-queue/requests/{requestId}{?token}
Request collection/v2/actor-runs/{runId}/request-queue/head{?token}
Queue head
For example, to download data from a dataset of the actor run in XML format, send HTTP GET request to the following URL:
https://api.apify.com/v2/actor-runs/{runId}/dataset/items?format=xml
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL.
Get run
This is not a single endpoint, but an entire group of endpoints that lets you retrieve the run or any of its default storages.
The endpoints accept the same HTTP methods and query parameters as the respective storage endpoints.
The base path that represents the actor run object is:
/v2/actor-runs/{runId}{?token}
In order to access the default storages of the actor run, i.e. log, key-value store, dataset and request queue, use the following endpoints:
/v2/actor-runs/{runId}/log{?token}
/v2/actor-runs/{runId}/key-value-store{?token}
/v2/actor-runs/{runId}/dataset{?token}
/v2/actor-runs/{runId}/request-queue{?token}
These API endpoints have the same usage as the equivalent storage endpoints.
For example, /v2/actor-runs/{runId}/key-value-store
has the same HTTP method and
parameters as the Key-value store object endpoint.
Additionally, each of the above API endpoints supports all sub-endpoints of the original one:
Log
/v2/actor-runs/{runId}/log
Log
Key-value store
/v2/actor-runs/{runId}/key-value-store/keys{?token}
Key collection/v2/actor-runs/{runId}/key-value-store/records/{recordKey}{?token}
Record
Dataset
/v2/actor-runs/{runId}/dataset/items{?token}
Item collection
Request queue
/v2/actor-runs/{runId}/request-queue/requests{?token}
Request collection/v2/actor-runs/{runId}/request-queue/requests/{requestId}{?token}
Request collection/v2/actor-runs/{runId}/request-queue/head{?token}
Queue head
For example, to download data from a dataset of the actor run in XML format, send HTTP GET request to the following URL:
https://api.apify.com/v2/actor-runs/{runId}/dataset/items?format=xml
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL.Gets an object that contains all the details about a specific run of an actor.
By passing the optional waitForFinish
parameter the API endpoint will
synchronously wait for the run to finish.
This is useful to avoid periodic polling when waiting for actor run to complete.
This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the run. However,
if you access the endpoint without the token, certain attributes, such as usageUsd
and usageTotalUsd
, will be hidden.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the run to finish. By
default it is |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const run = await apifyClient .run('<RUN ID>') .get(); console.log(run);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Abort run
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
gracefully | boolean Example: gracefully=true If true passed, the actor run will abort gracefully.
It will send |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const abortedRun = await apifyClient .run('<RUN ID>') .abort(); console.log(abortedRun);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "BPWZBd7Z9c746JAng",
- "actorTaskId": "rANaydYhUxjsnA3oz",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "ABORTED",
- "statusMessage": "Actor was aborted",
- "isStatusMessageTerminal": true,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 1,
- "memAvgBytes": 35914228.4,
- "memMaxBytes": 38244352,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 0.00955965,
- "cpuMaxUsage": 3.1546,
- "cpuCurrentUsage": 0,
- "netRxBytes": 2652,
- "netTxBytes": 1338,
- "durationMillis": 26239,
- "runTimeSecs": 26.239,
- "metamorph": 0,
- "computeUnits": 0.0072886
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "isContainerServerReady": false,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Metamorph run
ClientsTransforms an actor run into a run of another actor with a new input.
This is useful if you want to use another actor to finish the work of your current actor run, without the need to create a completely new run and waiting for its finish.
For the users of your actors, the metamorph operation is transparent, they will just see your actor got the work done.
Internally, the system stops the Docker container corresponding to the actor run and starts a new container using a different Docker image.
All the default storages are preserved and the new input is stored under the
INPUT-METAMORPH-1
key in the same default key-value store.
For more information, see the Actor docs.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Actor run ID. |
query Parameters
targetActorId required | string Example: targetActorId=HDSasDasz78YcAPEB ID of a target actor that the run should be transformed into. |
build | string Example: build=beta Optional build of the target actor. It can be either a build tag or build number. By default, the run uses
the build specified in the default run configuration for the target
actor (typically |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const metamorphedRun = await apifyClient .run('<RUN ID>') .metamorph('<ACTOR ID>'); console.log(metamorphedRun);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "PNWZBd7Z9c746JAnF",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": null,
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 1,
- "memAvgBytes": 35914228.4,
- "memMaxBytes": 38244352,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 0.00955965,
- "cpuMaxUsage": 3.1546,
- "cpuCurrentUsage": 0,
- "netRxBytes": 2652,
- "netTxBytes": 1338,
- "durationMillis": 26239,
- "runTimeSecs": 26.239,
- "metamorph": 0,
- "computeUnits": 0.0072886
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "HG7ML7M8z78YcAPEB",
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "metamorphs": [
- {
- "createdAt": "2019-11-30T07:39:24.202Z",
- "actorId": "nspoEjklmnsF2oosD",
- "buildId": "ME6oKecqy5kXDS4KQ",
- "inputKey": "INPUT-METAMORPH-1"
}
], - "buildNumber": "0.1.10",
- "isContainerServerReady": false,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Reboot run
ClientsReboots an actor run and returns an object that contains all the details about the rebooted run.
Only runs that are running, i.e. runs with status RUNNING
can be rebooted.
The run's container will be restarted, so any data not persisted in the key-value store, dataset, or request queue will be lost.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Actor run ID. |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const rebootedRun = await apifyClient .run('<RUN ID>') .reboot(); console.log(rebootedRun);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Resurrect run
ClientsResurrects a finished actor run and returns an object that contains all the details about the resurrected run.
Only finished runs, i.e. runs with status FINISHED
, FAILED
, ABORTED
and TIMED-OUT
can be resurrected.
Run status will be updated to RUNNING and its container will be restarted with the same storages
(the same behaviour as when the run gets migrated to the new server).
For more information, see the Actor docs.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
query Parameters
build | string Example: build=0.1.234 Specifies the actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the run that is being resurrected (typically |
timeout | number Example: timeout=60 Optional timeout for the run, in seconds. By default, the run uses a timeout specified in the run that is being resurrected. |
memory | number Example: memory=256 |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const resurrectedRun = await apifyClient .run('<RUN ID>') .resurrect(); console.log(resurrectedRun);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
Charge events in run
ClientsCharge for events in the run of your pay per event Actor. The event you are charging for must be one of the configured events in your Actor. If the Actor is not set up as pay per event, or if the event is not configured, the endpoint will return an error. The endpoint must be called from the Actor run itself, with the same API token that the run was started with.
Note that pay per events Actors are still in alpha. Please, reach out to us with any questions or feedback.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
header Parameters
idempotency-key | string Example: 2024-12-09T01:23:45.000Z-random-uuid Always pass a unique idempotency key (any unique string) for each charge to avoid double charging in case of retries or network errors. |
Request Body schema: application/jsonrequired
Define which event, and how many times, you want to charge for.
eventName required | string |
eventCount required | number |
Responses
Request samples
- Payload
{- "eventName": "ANALYZE_PAGE",
- "eventCount": 1
}
Update status message
You can set a single status message on your run that will be displayed in the Apify Console UI. During an actor run, you will typically do this in order to inform users of your actor about the actor's progress.
The request body must contain runId
and statusMessage
properties. The
isStatusMessageTerminal
property is optional and it indicates if the
status message is the very last one. In the absence of a status message, the
platform will try to substitute sensible defaults.
Authorizations:
path Parameters
runId required | string Example: 3KH8gEpp4d8uQSe8T Run ID. |
Request Body schema: application/jsonrequired
runId required | string |
statusMessage required | string |
isStatusMessageTerminal | boolean |
Responses
Response Schema: application/json
required | object (Run) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "runId": "3KH8gEpp4d8uQSe8T",
- "statusMessage": "Actor has finished",
- "isStatusMessageTerminal": true
}
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "HDSasDasz78YcAPEB",
- "userId": "7sT5jcggjjA9fNcxF",
- "actorTaskId": "KJHSKHausidyaJKHs",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "RUNNING",
- "statusMessage": "Actor is running",
- "isStatusMessageTerminal": false,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "inputBodyLen": 240,
- "restartCount": 0,
- "resurrectCount": 2,
- "memAvgBytes": 267874071.9,
- "memMaxBytes": 404713472,
- "memCurrentBytes": 0,
- "cpuAvgUsage": 33.75321011075384,
- "cpuMaxUsage": 169.65073553494125,
- "cpuCurrentUsage": 0,
- "netRxBytes": 103508042,
- "netTxBytes": 4854600,
- "durationMillis": 248472,
- "runTimeSecs": 248.472,
- "metamorph": 0,
- "computeUnits": 0.13804
}, - "options": {
- "build": "latest",
- "timeoutSecs": 300,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "buildId": "7sT5jcggjjA9fNcxF",
- "exitCode": 0,
- "defaultKeyValueStoreId": "eJNzqsbPiopwJcgGQ",
- "defaultDatasetId": "wmKPijuyDnPZAPRMk",
- "defaultRequestQueueId": "FL35cSF7jrxr3BY39",
- "buildNumber": "0.0.36",
- "isContainerServerReady": true,
- "gitBranchName": "master",
- "usage": {
- "ACTOR_COMPUTE_UNITS": 3,
- "DATASET_READS": 4,
- "DATASET_WRITES": 4,
- "KEY_VALUE_STORE_READS": 5,
- "KEY_VALUE_STORE_WRITES": 3,
- "KEY_VALUE_STORE_LISTS": 5,
- "REQUEST_QUEUE_READS": 2,
- "REQUEST_QUEUE_WRITES": 1,
- "DATA_TRANSFER_INTERNAL_GBYTES": 1,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 3,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 34,
- "PROXY_SERPS": 3
}, - "usageTotalUsd": 0.2654,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.072,
- "DATASET_READS": 0.0004,
- "DATASET_WRITES": 0.0002,
- "KEY_VALUE_STORE_READS": 0.0006,
- "KEY_VALUE_STORE_WRITES": 0.002,
- "KEY_VALUE_STORE_LISTS": 0.004,
- "REQUEST_QUEUE_READS": 0.005,
- "REQUEST_QUEUE_WRITES": 0.02,
- "DATA_TRANSFER_INTERNAL_GBYTES": 0.0004,
- "DATA_TRANSFER_EXTERNAL_GBYTES?": 0.0002,
- "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0.16,
- "PROXY_SERPS": 0.0006
}
}
}
The API endpoints described in this section enable you to manage Apify actor builds.
Note that if any returned build object contains usage in dollars, your effective unit pricing at the time of query has been used for computation of this dollar equivalent, and hence it should be used only for informative purposes. You can learn more about platform usage in the documentation.
Delete build
Authorizations:
path Parameters
buildId required | string Example: soSkq9ekdmfOslopH ID of the build you want to get, found in the build's |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient.build('<BUILD ID>').delete();
Get user builds list
Gets a list of all builds for a user. The response is a JSON array of objects, where each object contains basic information about a single build.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the startedAt
field in ascending
order. Therefore, you can use pagination to incrementally fetch all builds while
new ones are still being started. To sort the records in descending order, use
the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the
maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .builds() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "status": "SUCCEEDED",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "usageTotalUsd": 0.02,
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}
}
]
}
}
Get build
ClientsGets an object that contains all the details about a specific build of an Actor.
By passing the optional waitForFinish
parameter the API endpoint will
synchronously wait for the build to finish. This is useful to avoid periodic
polling when waiting for an Actor build to finish.
This endpoint does not require the authentication token. Instead, calls are authenticated using a hard-to-guess ID of the build. However,
if you access the endpoint without the token, certain attributes, such as usageUsd
and usageTotalUsd
, will be hidden.
Authorizations:
path Parameters
buildId required | string Example: soSkq9ekdmfOslopH ID of the build you want to get, found in the build's |
query Parameters
waitForFinish | number <double> Example: waitForFinish=60 The maximum number of seconds the server waits for the build to finish.
By default it is If the build finishes in time then the returned build object will have a
terminal status (e.g. |
Responses
Response Schema: application/json
required | object (Build) | ||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const build = await apifyClient .build('<BUILD ID>') .get(); console.log(build);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "klmdEpoiojmdEMlk3",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "SUCCEEDED",
- "meta": {
- "origin": "WEB",
- "clientIp": "172.234.12.34",
- "userAgent": "Mozilla/5.0 (iPad)"
}, - "stats": {
- "durationMillis": 1000,
- "runTimeSecs": 45.718,
- "computeUnits": 0.012699444444444444
}, - "options": {
- "useCache": false,
- "betaPackages": false,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "usage": {
- "ACTOR_COMPUTE_UNITS": 0.08
}, - "usageTotalUsd": 0.02,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.02
}, - "inputSchema": "{\\n \\\"title\\\": \\\"Schema for ... }",
- "readme": "# Magic Actor\\nThis Actor is magic.",
- "buildNumber": "0.1.1",
- "actorDefinition": {
- "actorSpecification": 1,
- "name": "exmpla-actor",
- "version": "1.0",
- "buildTag": "latest",
- "environmentVariables": {
- "DEBUG_MODE": "false"
}, - "input": {
- "type": "object",
- "properties": {
- "prompt": {
- "type": "string",
- "description": "The text prompt to generate completions for."
}, - "maxTokens": {
- "type": "integer",
- "description": "The maximum number of tokens to generate."
}
}, - "required": [
- "prompt"
]
}, - "storages": {
- "dataset": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "description": "Unique identifier for the generated text."
}, - "text": {
- "type": "string",
- "description": "The generated text output from the model."
}
}, - "required": [
- "id",
- "text"
]
}
}, - "minMemoryMbytes": 512,
- "maxMemoryMbytes": 2048,
- "usesStandbyMode": false
}
}
}
Abort build
Authorizations:
path Parameters
buildId required | string Example: 3KH8gEpp4d8uQSe8T Build ID. |
Responses
Response Schema: application/json
required | object (Build) | ||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const abortedBuild = await apifyClient .build('<BUILD ID>') .abort(); console.log(abortedBuild);
Response samples
- 200
{- "data": {
- "id": "HG7ML7M8z78YcAPEB",
- "actId": "janedoe~my-actor",
- "userId": "klmdEpoiojmdEMlk3",
- "startedAt": "2019-11-30T07:34:24.202Z",
- "finishedAt": "2019-12-12T09:30:12.202Z",
- "status": "ABORTED",
- "meta": {
- "origin": "WEB"
}, - "stats": {
- "durationMillis": 1000,
- "runTimeSecs": 5.718
}, - "options": {
- "useCache": false,
- "memoryMbytes": 1024,
- "diskMbytes": 2048
}, - "usage": {
- "ACTOR_COMPUTE_UNITS": 0.08
}, - "usageTotalUsd": 0.02,
- "usageUsd": {
- "ACTOR_COMPUTE_UNITS": 0.02
}
}
}
Check out Logs for full reference.
Get log
Check out Logs for full reference.
Authorizations:
path Parameters
buildId required | string Example: HG7ML7M8z78YcAPEB ID of the Actor build. |
query Parameters
stream required | boolean Example: stream=false If |
download required | boolean Example: download=false If |
Responses
Response Schema: text/plain
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const buildLog = await apifyClient .build('<BUILD ID>') .log() .get(); console.log(buildLog);
Response samples
- 200
2017-07-14T06:00:49.733Z Application started. 2017-07-14T06:00:49.741Z Input: { test: 123 } 2017-07-14T06:00:49.752Z Some useful debug information follows.
This section describes API endpoints to manage Key-value stores. Key-value store is a simple storage for saving and reading data records or files. Each data record is represented by a unique key and associated with a MIME content type. Key-value stores are ideal for saving screenshots, actor inputs and outputs, web pages, PDFs or to persist the state of crawlers. For more information, see the Key-value store documentation.
Note that some of the endpoints do not require the authentication token, the calls are authenticated using a hard-to-guess ID of the key-value store.
Get list of key-value stores
ClientsGets the list of key-value stores owned by the user.
The response is a list of objects, where each objects contains a basic information about a single key-value store.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 array elements.
By default, the records are sorted by the createdAt
field in ascending
order, therefore you can use pagination to incrementally fetch all key-value stores
while new ones are still being created. To sort the records in descending order, use
the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the
maximum is |
desc | boolean Example: desc=true If |
unnamed | boolean Example: unnamed=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .keyValueStores() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "BPWDBd7Z9c746JAnF",
- "username": "janedoe",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "actId": null,
- "actRunId": null
}, - {
- "id": "YiKoxjkaS9gjGTqhF",
- "name": "eshop-items",
- "userId": "BPWDBd7Z9c746JAnF",
- "username": "janedoe",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "actId": null,
- "actRunId": null
}
]
}
}
Create key-value store
ClientsCreates a key-value store and returns its object. The response is the same object as returned by the Get store endpoint.
Keep in mind that data stored under unnamed store follows data retention period.
It creates a store with the given name if the parameter name is used. If there is another store with the same name, the endpoint does not create a new one and returns the existing object instead.
Authorizations:
query Parameters
name | string Example: name=eshop-values Custom unique name to easily identify the store in the future. |
Responses
Location | any |
Response Schema: application/json
required | object (KeyValueStore) | ||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const store = await apifyClient .keyValueStores() .getOrCreate('<STORE NAME>'); console.log(store);
Response samples
- 201
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "actId": null,
- "actRunId": null
}
}
Get store
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
Responses
Response Schema: application/json
required | object (KeyValueStore) | ||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const store = await apifyClient .keyValueStore('<STORE ID>') .get(); console.log(store);
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "BPWDBd7Z9c746JAnF",
- "username": "janedoe",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "actId": null,
- "actRunId": null,
- "stats": {
- "readCount": 9,
- "writeCount": 3,
- "deleteCount": 6,
- "listCount": 2,
- "s3StorageBytes": 18
}
}
}
Update store
ClientsUpdates a key-value store's name using a value specified by a JSON object passed in the PUT payload.
The response is the updated key-value store object, as returned by the Get store API endpoint.
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
Request Body schema: application/jsonrequired
name required | string |
Responses
Response Schema: application/json
required | object (KeyValueStore) | ||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "new-store-name"
}
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "BPWDBd7Z9c746JAnF",
- "username": "janedoe",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "actId": null,
- "actRunId": null,
- "stats": {
- "readCount": 9,
- "writeCount": 3,
- "deleteCount": 6,
- "listCount": 2,
- "s3StorageBytes": 18
}
}
}
Delete store
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .keyValueStore('<STORE ID>') .delete();
Get list of keys
ClientsReturns a list of objects describing keys of a given key-value store, as well as some information about the values (e.g. size).
This endpoint is paginated using exclusiveStartKey
and limit
parameters
- see Pagination for more details.
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
query Parameters
exclusiveStartKey | string Example: exclusiveStartKey=Ihnsp8YrvJ8102Kj All keys up to this one (including) are skipped from the result. |
limit | number <double> Example: limit=100 Number of keys to be returned. Maximum value is |
Responses
Response Schema: application/json
required | object (ListOfKeysResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .keyValueStore('<STORE ID>') .listKeys(); console.log(items);
Response samples
- 200
{- "data": {
- "items": [
- {
- "key": "second-key",
- "size": 36
}, - {
- "key": "third-key",
- "size": 128
}
], - "count": 2,
- "limit": 2,
- "exclusiveStartKey": "some-key",
- "isTruncated": true,
- "nextExclusiveStartKey": "third-key"
}
}
Get record
ClientsGets a value stored in the key-value store under a specific key.
The response body has the same Content-Encoding
header as it was set in
Put record.
If the request does not define the Accept-Encoding
HTTP header with the
right encoding, the record will be decompressed.
Most HTTP clients support decompression by default. After using the HTTP
client with decompression support, the Accept-Encoding
header is set by
the client and body is decompressed automatically.
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
recordKey required | string Example: some key Key of the record. |
Responses
Response Schema: application/json
foo required | string |
Location | any |
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const record = await apifyClient .keyValueStore('<STORE ID>') .getRecord('<RECORD KEY>'); console.log(record);
Response samples
- 200
{- "foo": "bar"
}
Put record
ClientsStores a value under a specific key to the key-value store.
The value is passed as the PUT payload and it is stored with a MIME content
type defined by the Content-Type
header and with encoding defined by the
Content-Encoding
header.
To save bandwidth, storage, and speed up your upload, send the request
payload compressed with Gzip compression and add the Content-Encoding: gzip
header. It is possible to set up another compression type with Content-Encoding
request header.
Below is a list of supported Content-Encoding
types.
- Gzip compression:
Content-Encoding: gzip
- Deflate compression:
Content-Encoding: deflate
- Brotli compression:
Content-Encoding: br
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
recordKey required | string Example: some key Key of the record. |
header Parameters
Content-Encoding required | string Value: "gzip" Example: gzip |
Request Body schema: application/jsonrequired
foo | string |
Responses
Location | any |
Response Schema: application/json
Request samples
- Payload
- JS client
{- "foo": "bar"
}
Response samples
- 201
{ }
Delete record
Authorizations:
path Parameters
storeId required | string Example: WkzbQMuFYuamGv3YF Key-value store ID or |
recordKey required | string Example: some key Key of the record. |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .keyValueStore('<STORE ID>') .deleteRecord('<RECORD KEY>');
This section describes API endpoints to manage Datasets.
Dataset is a storage for structured data, where each record stored has the same attributes, such as online store products or real estate offers. You can imagine it as a table, where each object is a row and its attributes are columns. Dataset is an append-only storage - you can only add new records to it but you cannot modify or remove existing records. Typically it is used to store crawling results. For more information, see the Datasets documentation.
Note that some of the endpoints do not require the authentication token, the calls are authenticated using the hard-to-guess ID of the dataset.
Get list of datasets
ClientsLists all of a user's datasets. The response is a JSON array of objects,
where each object contains basic information about one dataset.
By default, the objects are sorted by the createdAt
field in ascending
order, therefore you can use pagination to incrementally fetch all datasets while new
ones are still being created. To sort them in descending order, use desc=1
parameter. The endpoint supports pagination using limit
and offset
parameters and it will not return more than 1000 array elements.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as the maximum is |
desc | boolean Example: desc=true If |
unnamed | boolean Example: unnamed=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .datasets() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "wkzbqmufyuamgv3yf",
- "name": "d7b9mdysbtx5l7xaj",
- "userId": "tbXmWu7GCxnyYtSiL",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "itemCount": 7,
- "cleanItemCount": 5,
- "actId": null,
- "actRunId": null
}, - {
- "id": "YiKoxjkaS9gjGTqhF",
- "name": "eshop-items",
- "userId": "tbXmWu7GCxnyYtSiL",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "itemCount": 2,
- "cleanItemCount": 2,
- "actId": null,
- "actRunId": null
}
]
}
}
Create dataset
ClientsCreates a dataset and returns its object. Keep in mind that data stored under unnamed dataset follows data retention period. It creates a dataset with the given name if the parameter name is used. If a dataset with the given name already exists then returns its object.
Authorizations:
query Parameters
name | string Example: name=eshop-items Custom unique name to easily identify the dataset in the future. |
Responses
Location | any |
Response Schema: application/json
required | object (Dataset) | ||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const dataset = await apifyClient .datasets() .getOrCreate('<DATASET NAME>'); console.log(dataset);
Response samples
- 201
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "itemCount": 7,
- "cleanItemCount": 5,
- "actId": null,
- "actRunId": null,
- "fields": [ ]
}
}
Get dataset
ClientsReturns dataset object for given dataset ID.
NOTE: Keep in mind that attributes itemCount
and cleanItemCount
are not propagated right away after data are pushed into a dataset.
There is a short period (up to 5 seconds) during which these counters may not match with exact counts in dataset items.
Authorizations:
path Parameters
datasetId required | string Example: WkzbQMuFYuamGv3YF Dataset ID or |
query Parameters
token | string Example: token=soSkq9ekdmfOslopH API authentication token. It is required only when using the |
Responses
Response Schema: application/json
required | object (Dataset) | ||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const dataset = await apifyClient .dataset('<DATASET ID>') .get(); console.log(dataset);
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "itemCount": 7,
- "cleanItemCount": 5,
- "actId": null,
- "actRunId": null,
- "fields": [ ]
}
}
Update dataset
ClientsUpdates a dataset's name using a value specified by a JSON object passed in the PUT payload. The response is the updated dataset object, as returned by the Get dataset API endpoint.
Authorizations:
path Parameters
datasetId required | string Example: WkzbQMuFYuamGv3YF Dataset ID or |
Request Body schema: application/jsonrequired
name required | string |
Responses
Response Schema: application/json
required | object (Dataset) | ||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "new-dataset-name"
}
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "d7b9MDYsbtX5L7XAj",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "itemCount": 7,
- "cleanItemCount": 5,
- "actId": null,
- "actRunId": null,
- "fields": [ ]
}
}
Delete dataset
Authorizations:
path Parameters
datasetId required | string Example: WkzbQMuFYuamGv3YF Dataset ID or |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .dataset('<DATASET ID>') .delete();
Get items
ClientsReturns data stored in the dataset in a desired format.
Response format
The format of the response depends on format
query parameter.
The format
parameter can have one of the following values:
json
, jsonl
, xml
, html
,
csv
, xlsx
and rss
.
The following table describes how each format is treated.
Format | Items | |
---|---|---|
json |
The response is a JSON, JSONL or XML array of raw item objects. | |
jsonl |
||
xml |
||
html |
The response is a HTML, CSV or XLSX table, where columns correspond to the properties of the item and rows correspond to each dataset item. | |
csv |
||
xlsx |
||
rss |
The response is a RSS file. Each item is displayed as child elements of one
<item> . |
Note that CSV, XLSX and HTML tables are limited to 500 columns and the column names cannot be longer than 200 characters. JSON, XML and RSS formats do not have such restrictions.
Hidden fields
The top-level fields starting with the #
character are considered hidden.
These are useful to store debugging information and can be omitted from the output by providing the skipHidden=1
or clean=1
query parameters.
For example, if you store the following object to the dataset:
{
productName: "iPhone Xs",
description: "Welcome to the big screens."
#debug: {
url: "https://www.apple.com/lae/iphone-xs/",
crawledAt: "2019-01-21T16:06:03.683Z"
}
}
The #debug
field will be considered as hidden and can be omitted from the
results. This is useful to
provide nice cleaned data to end users, while keeping debugging info available if needed. The Dataset object
returned by the API contains the number of such clean items in thedataset.cleanItemCount
property.
XML format extension
When exporting results to XML or RSS formats, the names of object properties become XML tags and the corresponding values become tag's children. For example, the following JavaScript object:
{
name: "Paul Newman",
address: [
{ type: "home", street: "21st", city: "Chicago" },
{ type: "office", street: null, city: null }
]
}
will be transformed to the following XML snippet:
<name>Paul Newman</name>
<address>
<type>home</type>
<street>21st</street>
<city>Chicago</city>
</address>
<address>
<type>office</type>
<street/>
<city/>
</address>
If the JavaScript object contains a property named @
then its sub-properties are exported as attributes of the parent XML
element.
If the parent XML element does not have any child elements then its value is taken from a JavaScript object property named #
.
For example, the following JavaScript object:
{
"address": [{
"@": {
"type": "home"
},
"street": "21st",
"city": "Chicago"
},
{
"@": {
"type": "office"
},
"#": 'unknown'
}]
}
will be transformed to the following XML snippet:
<address type="home">
<street>21st</street>
<city>Chicago</city>
</address>
<address type="office">unknown</address>
This feature is also useful to customize your RSS feeds generated for various websites.
By default the whole result is wrapped in a <items>
element and each page object is wrapped in a <item>
element.
You can change this using xmlRoot
and xmlRow
url parameters.
Pagination
The generated response supports pagination.
The pagination is always performed with the granularity of a single item, regardless whether unwind
parameter was provided.
By default, the Items in the response are sorted by the time they were stored to the database, therefore you can use pagination to incrementally fetch the items as they are being added.
The maximum number of items that will be returned in a single API call is limited to 250,000.
If you specify desc=1
query parameter, the results are returned in the reverse order than they were stored (i.e. from newest to oldest items).
Note that only the order of Items is reversed, but not the order of the unwind
array elements.
Authorizations:
path Parameters
datasetId required | string Example: WkzbQMuFYuamGv3YF Dataset ID or |
query Parameters
format | string Example: format=json Format of the results, possible values are: |
clean | boolean Example: clean=false If |
offset | number <double> Example: offset=0 Number of items that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of items to return. By default there is no limit. |
fields | string Example: fields=myValue,myOtherValue A comma-separated list of fields which should be picked from the items, only these fields will remain in the resulting record objects.
Note that the fields in the outputted items are sorted the same way as they are specified in the |
omit | string Example: omit=myValue,myOtherValue A comma-separated list of fields which should be omitted from the items. |
unwind | string Example: unwind=myValue,myOtherValue A comma-separated list of fields which should be unwound, in order which they should be processed. Each field should be either an array or an object.
If the field is an array then every element of the array will become a separate record and merged with parent object.
If the unwound field is an object then it is merged with the parent object.
If the unwound field is missing or its value is neither an array nor an object and therefore cannot be merged with a parent object then the item gets preserved as it is.
Note that the unwound items ignore the |
flatten | string Example: flatten=myValue A comma-separated list of fields which should transform nested objects into flat structures. For example, with The original object with properties is replaced with the flattened object. |
desc | boolean Example: desc=true By default, results are returned in the same order as they were stored.
To reverse the order, set this parameter to |
attachment | boolean Example: attachment=true If |
delimiter | string Example: delimiter=; A delimiter character for CSV files, only used if |
bom | boolean Example: bom=false All text responses are encoded in UTF-8 encoding. By default, the
If you want to override this default behavior, specify |
xmlRoot | string Example: xmlRoot=items Overrides default root element name of |
xmlRow | string Example: xmlRow=item Overrides default element name that wraps each page or page function result object in |
skipHeaderRow | boolean Example: skipHeaderRow=true If |
skipHidden | boolean Example: skipHidden=false If |
skipEmpty | boolean Example: skipEmpty=false If Note that if used, the results might contain less items than the limit value. |
simplified | boolean Example: simplified=false If |
skipFailedPages | boolean Example: skipFailedPages=false If This feature is here to emulate functionality of API version 1 used for the legacy Apify Crawler product and it's not recommended to use it in new integrations. |
Responses
X-Apify-Pagination-Offset | any |
X-Apify-Pagination-Limit | any |
X-Apify-Pagination-Count | any |
X-Apify-Pagination-Total | any |
Response Schema:
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .dataset('<DATASET ID>') .listItems(); console.log(items);
Response samples
- 200
[- {
- "foo": "bar"
}, - {
- "foo2": "bar2"
}
]
Put items
ClientsAppends an item or an array of items to the end of the dataset.
The POST payload is a JSON object or a JSON array of objects to save into the dataset.
If the data you attempt to store in the dataset is invalid (meaning any of the items received by the API fails the validation), the whole request is discarded and the API will return a response with status code 400. For more information about dataset schema validation, see Dataset schema.
IMPORTANT: The limit of request payload size for the dataset is 5 MB. If the array exceeds the size, you'll need to split it into a number of smaller arrays.
Authorizations:
path Parameters
datasetId required | string Example: WkzbQMuFYuamGv3YF Dataset ID or |
Request Body schema: application/jsonrequired
foo required | string |
Responses
Location | any |
Response Schema: application/json
Response Schema: application/json
required | object | ||||||||||
|
Request samples
- Payload
- JS client
[- {
- "foo": "bar"
}, - {
- "foo": "hotel"
}, - {
- "foo": "restaurant"
}
]
Response samples
- 201
- 400
{ }
This section describes API endpoints to manage request queues. Request queue is a storage for a queue of HTTP URLs to crawl, which is typically used for deep crawling of websites where you start with several URLs and then recursively follow links to other pages. The storage supports both breadth-first and depth-first crawling orders. For more information, see the Request queue documentation.
Note that some of the endpoints do not require the authentication token, the calls are authenticated using the hard-to-guess ID of the queue.
Get list of request queues
ClientsLists all of a user's request queues. The response is a JSON array of objects, where each object
contains basic information about one queue.
By default, the objects are sorted by the createdAt
field in ascending
order,
therefore you can use pagination to incrementally fetch all queues while new
ones are still being created. To sort them in descending order, use desc=1
parameter. The endpoint supports pagination using limit
and offset
parameters and it will not return more than 1000
array elements.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of array elements that should be skipped at the start. The
default value is |
limit | number <double> Example: limit=99 Maximum number of array elements to return. The default value as well as
the maximum is |
desc | boolean Example: desc=true If |
unnamed | boolean Example: unnamed=true If |
Responses
Response Schema: application/json
required | object | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .requestQueues() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "some-name",
- "userId": "wRsJZtadYvn4mBZmm",
- "username": "janedoe",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "expireAt": "2019-06-02T17:15:06.751Z",
- "totalRequestCount": 100,
- "handledRequestCount": 50,
- "pendingRequestCount": 50,
- "actId": "string",
- "actRunId": "string",
- "hadMultipleClients": true
}
]
}
}
Create request queue
ClientsCreates a request queue and returns its object.
Keep in mind that requests stored under unnamed queue follows data retention period.
It creates a queue of given name if the parameter name is used. If a queue with the given name already exists then the endpoint returns
its object.
Authorizations:
query Parameters
name | string Example: name=example-com Custom unique name to easily identify the queue in the future. |
Responses
Location | any |
Response Schema: application/json
required | object (RequestQueue) | ||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const queue = await apifyClient .requestQueues() .getOrCreate('<QUEUE NAME>'); console.log(queue);
Response samples
- 201
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "some-name",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "totalRequestCount": 870,
- "handledRequestCount": 100,
- "pendingRequestCount": 670,
- "hadMultipleClients": true
}
}
Get request queue
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
Responses
Response Schema: application/json
required | object (RequestQueue) | ||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const queue = await apifyClient .requestQueue('<QUEUE ID>') .get(); console.log(queue);
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "some-name",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "totalRequestCount": 870,
- "handledRequestCount": 100,
- "pendingRequestCount": 670,
- "hadMultipleClients": true
}
}
Update request queue
ClientsUpdates a request queue's name using a value specified by a JSON object passed in the PUT payload.
The response is the updated request queue object, as returned by the
Get request queue API endpoint.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
Request Body schema: application/jsonrequired
name required | string |
Responses
Response Schema: application/json
required | object (RequestQueue) | ||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "new-request-queue-name"
}
Response samples
- 200
{- "data": {
- "id": "WkzbQMuFYuamGv3YF",
- "name": "some-name",
- "userId": "wRsJZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "accessedAt": "2019-12-14T08:36:13.202Z",
- "totalRequestCount": 870,
- "handledRequestCount": 100,
- "pendingRequestCount": 670,
- "hadMultipleClients": true
}
}
Delete request queue
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .requestQueue('<QUEUE ID>') .delete();
Get request
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
requestId required | string Example: xpsmkDlspokDSmklS Request ID. |
Responses
Response Schema: application/json
required | object (RequestQueueItems) | ||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const request = await apifyClient .requestQueue('<QUEUE ID>') .getRequest('<REQUEST ID>'); console.log(request);
Response samples
- 200
{- "data": {
- "id": "dnjkDMKLmdlkmlkmld",
- "retryCount": 0,
- "method": "GET",
- "payload": null,
- "noRetry": false,
- "errorMessages": null,
- "headers": null,
- "handledAt": "2019-06-16T10:23:31.607Z"
}
}
Update request
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
requestId required | string Example: xpsmkDlspokDSmklS Request ID. |
query Parameters
forefront | string Example: forefront=false Determines if request should be added to the head of the queue or to the
end. Default value is |
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must
be a string between 1 and 32 characters long. This identifier is used to
determine whether the queue was accessed by multiple clients. If
the system considers this API call to come from a new client. For
details, see the |
Request Body schema: application/jsonrequired
id required | string |
retryCount required | number |
uniqueKey required | string |
url required | string |
method required | string |
loadedUrl | string or null |
payload | object or null |
noRetry | boolean or null |
errorMessages | Array of strings or null |
headers | object or null |
object (UserData) | |
handledAt | string or null |
Responses
Response Schema: application/json
required | object (RequestOperationInfo) | ||||||
|
Request samples
- Payload
- JS client
{- "id": "dnjkDMKLmdlkmlkmld",
- "retryCount": 0,
- "method": "GET",
- "payload": null,
- "noRetry": false,
- "errorMessages": null,
- "headers": null,
- "handledAt": "2019-06-16T10:23:31.607Z"
}
Response samples
- 200
{- "data": {
- "requestId": "YiKoxjkaS9gjGTqhF",
- "wasAlreadyPresent": true,
- "wasAlreadyHandled": false
}
}
Delete request
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
requestId required | string Example: xpsmkDlspokDSmklS Request ID. |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must
be a string between 1 and 32 characters long. This identifier is used to
determine whether the queue was accessed by multiple clients. If
the system considers this API call to come from a new client. For
details, see the |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .requestQueue('<QUEUE ID>') .deleteRequest('<REQUEST ID>');
List requests
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must
be a string between 1 and 32 characters long. This identifier is used to
determine whether the queue was accessed by multiple clients. If
the system considers this API call to come from a new client. For
details, see the |
exclusiveStartId | string Example: exclusiveStartId=Ihnsp8YrvJ8102Kj All requests up to this one (including) are skipped from the result. |
limit | number <double> Example: limit=100 Number of keys to be returned. Maximum value is |
Responses
Response Schema: application/json
required | object | ||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .requestQueue('<QUEUE ID>') .listRequests(); console.log(items);
Response samples
- 200
{- "data": {
- "items": [
- {
- "id": "dnjkDMKLmdlkmlkmld",
- "retryCount": 0,
- "method": "GET",
- "payload": null,
- "noRetry": false,
- "errorMessages": null,
- "headers": null,
- "handledAt": "2019-06-16T10:23:31.607Z"
}, - {
- "id": "dnjkDMKLmdlkmlkmld",
- "retryCount": 0,
- "method": "GET",
- "payload": null,
- "noRetry": false,
- "errorMessages": null,
- "headers": null,
- "handledAt": "2019-06-16T10:23:31.607Z"
}
], - "count": 2,
- "limit": 2,
- "exclusiveStartId": "Ihnsp8YrvJ8102Kj"
}
}
Add request
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must
be a string between 1 and 32 characters long. This identifier is used to
determine whether the queue was accessed by multiple clients. If
the system considers this API call to come from a new client. For
details, see the |
forefront | string Example: forefront=false Determines if request should be added to the head of the queue or to the
end. Default value is |
Request Body schema: application/jsonrequired
uniqueKey required | string |
url required | string |
method required | string |
Responses
Response Schema: application/json
required | object (RequestOperationInfo) | ||||||
|
Request samples
- Payload
- JS client
{- "method": "GET"
}
Response samples
- 201
{- "data": {
- "requestId": "YiKoxjkaS9gjGTqhF",
- "wasAlreadyPresent": true,
- "wasAlreadyHandled": false
}
}
Prolong request lock
ClientsProlongs request lock. The request lock can be prolonged only by the client that has locked it using Get and lock head operation.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
requestId required | string Example: xpsmkDlspokDSmklS Request ID. |
query Parameters
lockSecs required | number <double> Example: lockSecs=60 For how long second request will be locked. |
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long. This identifier is used to for locking and unlocking requests. You can delete or prolong lock only for requests that were locked by by same client key or from the same Actor run. |
forefront | string Example: forefront=false Determines if request should be added to the head of the queue or to the end after lock expires. |
Responses
Response Schema: application/json
object | |||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const result = await apifyClient .requestQueue('<QUEUE ID>') .prolongRequestLock( '<REQUEST ID>', { lockSecs: 3600, }, ); console.log(result);
Response samples
- 200
{- "data": {
- "lockExpiresAt": "2022-01-01T00:00:00.000Z"
}
}
Delete request lock
ClientsDeletes a request lock. The request lock can be deleted only by the client that has locked it using Get and lock head operation.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
requestId required | string Example: xpsmkDlspokDSmklS Request ID. |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long. This identifier is used to for locking and unlocking requests. You can delete or prolong lock only for requests that were locked by by same client key or from the same Actor run. |
forefront | string Example: forefront=false Determines if request should be added to the head of the queue or to the end after lock was removed. |
header Parameters
Content-Type required | string Value: "application/json" Example: application/json |
Responses
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .requestQueue('<QUEUE ID>') .deleteRequestLock('<REQUEST ID>');
Get head
ClientsReturns given number of first requests from the queue.
The response contains the hadMultipleClients
boolean field which indicates
that the queue was accessed by more than one client (with unique or empty
clientKey
).
This field is used by Apify SDK to determine whether the local cache is consistent with the request queue, and thus optimize performance of certain operations.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
limit | number <double> Example: limit=100 How many items from queue should be returned. |
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must
be a string between 1 and 32 characters long. This identifier is used to
determine whether the queue was accessed by multiple clients. If
the system considers this API call to come from a new client. For
details, see the |
Responses
Response Schema: application/json
required | object | ||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const head = await apifyClient .requestQueue('<QUEUE ID>') .listHead(); console.log(head);
Response samples
- 200
{- "data": {
- "limit": 1000,
- "queueModifiedAt": "2018-03-14T23:00:00.000Z",
- "hadMultipleClients": false,
- "items": [
- {
- "id": "8OamqXBCpPHxyH9",
- "retryCount": 0,
- "method": "GET"
}, - {
- "id": "ZJAoqlRijenMQIn",
- "retryCount": 0,
- "method": "GET"
}, - {
- "id": "hAhkwyk5oOBHKQC",
- "retryCount": 1,
- "method": "GET"
}
]
}
}
Get head and lock
ClientsReturns the given number of first requests from the queue and locks them for the given time.
If this endpoint locks the request, no other client or run will be able to get and lock these requests.
The response contains the hadMultipleClients
boolean field which indicates
that the queue was accessed by more than one client (with unique or empty
clientKey
).
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
lockSecs required | number <double> Example: lockSecs=60 How long the requests will be locked for (in seconds). |
limit | number <double> <= 25 Example: limit=25 How many items from the queue should be returned. |
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long. |
Responses
Response Schema: application/json
required | object | ||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const result = await apifyClient .requestQueue('<QUEUE ID>') .listAndLockHead({ lockSecs: 300, }); console.log(result);
Response samples
- 200
{- "data": {
- "limit": 3,
- "queueModifiedAt": "2018-03-14T23:00:00.000Z",
- "hadMultipleClients": true,
- "lockSecs": 60,
- "items": [
- {
- "id": "8OamqXBCpPHxyj9",
- "retryCount": 0,
- "method": "GET",
- "lockExpiresAt": "2022-06-14T23:00:00.000Z"
}, - {
- "id": "8OamqXBCpPHxyx9",
- "retryCount": 0,
- "method": "GET",
- "lockExpiresAt": "2022-06-14T23:00:00.000Z"
}, - {
- "id": "8OamqXBCpPHxy08",
- "retryCount": 0,
- "method": "GET",
- "lockExpiresAt": "2022-06-14T23:00:00.000Z"
}
]
}
}
Add requests
ClientsAdds requests to the queue in batch. The maximum requests in batch is limit to 25. The response contains an array of unprocessed and processed requests.
If any add operation fails because the request queue rate limit is exceeded or an internal failure occurs,
the failed request is returned in the unprocessedRequests response parameter.
You can resend these requests to add. It is recommended to use exponential backoff algorithm for these retries.
If a request with the same uniqueKey
was already present in the queue,
then it returns an ID of the existing request.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long |
forefront | string Example: forefront=false Determines if request should be added to the head of the queue or to the
end. Default value is |
Request Body schema: application/jsonrequired
uniqueKey required | string |
url required | string |
method required | string |
Responses
Response Schema: application/json
required | object | ||||
|
Request samples
- Payload
- JS client
[
]
Response samples
- 201
{- "data": {
- "processedRequests": [
- {
- "requestId": "YiKoxjkaS9gjGTqhF",
- "wasAlreadyPresent": true,
- "wasAlreadyHandled": false
}
], - "unprocessedRequests": [
]
}
}
Delete requests
ClientsBatch-deletes given requests from the queue. The number of requests in a batch is limited to 25. The response contains an array of unprocessed and processed requests.
If any delete operation fails because the request queue rate limit is exceeded or an internal failure occurs,
the failed request is returned in the unprocessedRequests
response
parameter.
You can re-send these delete requests. It is recommended to use an exponential backoff algorithm for these retries.
Each request is identified by its ID or uniqueKey parameter. You can use either of them to identify the request.
Authorizations:
path Parameters
queueId required | string Example: WkzbQMuFYuamGv3YF Queue ID or |
query Parameters
clientKey | string Example: clientKey=client-abc A unique identifier of the client accessing the request queue. It must be a string between 1 and 32 characters long |
header Parameters
Content-Type required | string Value: "application/json" Example: application/json |
Responses
Response Schema: application/json
required | object | ||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const result = await apifyClient .requestQueue('<QUEUE ID>') .batchDeleteRequests([ { uniqueKey: 'http://example.com' }, { uniqueKey: 'http://example.com/2' }, ]); console.log(result);
Response samples
- 204
{- "data": {
- "unprocessedRequests": [
- {
- "id": "sbJ7klsdf7ujN9l"
}
]
}
}
This section describes API endpoints to manage webhooks.
Webhooks provide an easy and reliable way to configure the Apify platform to carry out an action (e.g. a HTTP request to another service) when a certain system event occurs. For example, you can use webhooks to start another actor when an actor run finishes or fails. For more information see Webhooks documentation.
Get list of webhooks
ClientsGets the list of webhooks that the user created.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order. To sort the records in descending order, use the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the
maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (PaginationResponse) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .webhooks() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
]
}
}
Create webhook
ClientsCreates a new webhook with settings provided by the webhook object passed as JSON in the payload.
The response is the created webhook object.
To avoid duplicating a webhook, use the idempotencyKey
parameter in the
request body.
Multiple calls to create a webhook with the same idempotencyKey
will only
create the webhook with the first call and return the existing webhook on
subsequent calls.
Idempotency keys must be unique, so use a UUID or another random string with enough entropy.
To assign the new webhook to an actor or task, the request body must contain
requestUrl
, eventTypes
, and condition
properties.
requestUrl
is the webhook's target URL, to which data is sent as a POST request with a JSON payload.eventTypes
is a list of events that will trigger the webhook, e.g. when the actor run succeeds.condition
should be an object containing the ID of the actor or task to which the webhook will be assigned.payloadTemplate
is a JSON-like string, whose syntax is extended with the use of variables.headersTemplate
is a JSON-like string, whose syntax is extended with the use of variables. Following values will be re-written to defaults: "host", "Content-Type", "X-Apify-Webhook", "X-Apify-Webhook-Dispatch-Id", "X-Apify-Request-Origin"description
is an optional string.shouldInterpolateStrings
is a boolean indicating whether to interpolate variables contained inside strings in thepayloadTemplate
"isAdHoc" : false,
"requestUrl" : "https://example.com",
"eventTypes" : [
"ACTOR.RUN.SUCCEEDED",
"ACTOR.RUN.ABORTED"
],
"condition" : {
"actorId": "janedoe~my-actor",
"actorTaskId" : "W9bs9JE9v7wprjAnJ"
},
"payloadTemplate": "",
"headersTemplate": "",
"description": "my awesome webhook",
"shouldInterpolateStrings": false,
Important: The request must specify the Content-Type: application/json
HTTP header.
Authorizations:
query Parameters
limit | string |
offset | string |
desc | string |
Request Body schema: application/jsonrequired
isAdHoc | boolean or null |
eventTypes required | Array of strings |
required | object (WebhookCondition) |
idempotencyKey | string or null |
ignoreSslErrors | boolean or null |
doNotRetry | boolean or null |
requestUrl required | string |
payloadTemplate | string or null |
headersTemplate | string or null |
description | string or null |
shouldInterpolateStrings | boolean or null |
Responses
Location | any |
Response Schema: application/json
required | object (Webhook) | ||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "isAdHoc": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "idempotencyKey": "fdSJmdP3nfs7sfk3y",
- "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "shouldInterpolateStrings": false
}
Response samples
- 201
{- "data": {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
}
Get webhook
Authorizations:
path Parameters
webhookId required | string Example: Zib4xbZsmvZeK55ua Webhook ID. |
Responses
Response Schema: application/json
required | object (Webhook) | ||||||||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const webhook = await apifyClient .webhook('<WEBHOOK ID>') .get(); console.log(webhook);
Response samples
- 200
{- "data": {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
}
Update webhook
ClientsUpdates a webhook using values specified by a webhook object passed as JSON in the POST payload.
If the object does not define a specific property, its value will not be updated.
The response is the full webhook object as returned by the
Get webhook 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. (More
info).
Authorizations:
path Parameters
webhookId required | string Example: Zib4xbZsmvZeK55ua Webhook ID. |
Request Body schema: application/jsonrequired
isAdHoc | boolean or null |
eventTypes | Array of strings or null |
object or null (WebhookCondition) | |
ignoreSslErrors | boolean or null |
doNotRetry | boolean or null |
requestUrl | string or null |
payloadTemplate | string or null |
headersTemplate | string or null |
description | string or null |
shouldInterpolateStrings | boolean or null |
Responses
Response Schema: application/json
required | object (Webhook) | ||||||||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "isAdHoc": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "shouldInterpolateStrings": false
}
Response samples
- 200
{- "data": {
- "id": "YiKoxjkaS9gjGTqhF",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-13T08:36:13.202Z",
- "userId": "wRsJZtadYvn4mBZmm",
- "isAdHoc": false,
- "shouldInterpolateStrings": false,
- "eventTypes": [
- "ACTOR.RUN.SUCCEEDED"
], - "condition": {
- "actorId": "hksJZtadYvn4mBuin",
- "actorTaskId": "asdLZtadYvn4mBZmm",
- "actorRunId": "hgdKZtadYvn4mBpoi"
}, - "ignoreSslErrors": false,
- "doNotRetry": false,
- "payloadTemplate": "{\\n \\\"userId\\\": {{userId}}...",
- "headersTemplate": "{\\n \\\"Authorization\\\": Bearer...",
- "description": "this is webhook description",
- "lastDispatch": {
- "status": "SUCCEEDED",
- "finishedAt": "2019-12-13T08:36:13.202Z"
}, - "stats": {
- "totalDispatches": 1
}
}
}
Delete webhook
Authorizations:
path Parameters
webhookId required | string Example: Zib4xbZsmvZeK55ua Webhook ID. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .webhook('<WEBHOOK ID>') .delete();
Response samples
- 204
{ }
Test webhook
Authorizations:
path Parameters
webhookId required | string Example: Zib4xbZsmvZeK55ua Webhook ID. |
Responses
Response Schema: application/json
required | object (WebhookDispatch) | ||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const result = await apifyClient .webhook('<WEBHOOK ID>') .test(); console.log(result);
Response samples
- 201
{- "data": {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "webhookId": "asdLZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "status": "SUCCEEDED",
- "eventType": "ACTOR.RUN.SUCCEEDED",
- "eventData": {
- "actorId": "vvE7iMKuMc5qTHHsR",
- "actorRunId": "JgwXN9BdwxGcu9MMF"
}, - "calls": {
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-12T07:34:14.202Z",
- "errorMessage": "Cannot send request",
- "responseStatus": 200,
- "responseBody": {
- "foo": "bar"
}
}
}
}
Get collection
Authorizations:
path Parameters
webhookId required | string Example: pVJtoTelgYUq4qJOt ID number of the webhook. |
Responses
Response Schema: application/json
object (PaginationResponse) | |||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .webhook('<WEBHOOK ID>') .dispatches() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "webhookId": "asdLZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "status": "SUCCEEDED",
- "eventType": "ACTOR.RUN.SUCCEEDED",
- "eventData": {
- "actorId": "vvE7iMKuMc5qTHHsR",
- "actorRunId": "JgwXN9BdwxGcu9MMF"
}, - "calls": {
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-12T07:34:14.202Z",
- "errorMessage": "Cannot send request",
- "responseStatus": 200,
- "responseBody": {
- "foo": "bar"
}
}
}
]
}
}
Get list of webhook dispatches
ClientsGets the list of webhook dispatches that the user have.
The endpoint supports pagination using the limit
and offset
parameters
and it will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order. To sort the records in descending order, use the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value
is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value as well as the
maximum is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
object (PaginationResponse) | |||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .webhookDispatches() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "webhookId": "asdLZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "status": "SUCCEEDED",
- "eventType": "ACTOR.RUN.SUCCEEDED",
- "eventData": {
- "actorId": "vvE7iMKuMc5qTHHsR",
- "actorRunId": "JgwXN9BdwxGcu9MMF"
}, - "calls": {
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-12T07:34:14.202Z",
- "errorMessage": "Cannot send request",
- "responseStatus": 200,
- "responseBody": {
- "foo": "bar"
}
}
}
]
}
}
Get webhook dispatch
Authorizations:
path Parameters
dispatchId required | string Example: Zib4xbZsmvZeK55ua Webhook dispatch ID. |
Responses
Response Schema: application/json
required | object (WebhookDispatch) | ||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const dispatch = await apifyClient .webhookDispatch('<DISPATCH ID>') .get(); console.log(dispatch);
Response samples
- 200
{- "data": {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "webhookId": "asdLZtadYvn4mBZmm",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "status": "SUCCEEDED",
- "eventType": "ACTOR.RUN.SUCCEEDED",
- "eventData": {
- "actorId": "vvE7iMKuMc5qTHHsR",
- "actorRunId": "JgwXN9BdwxGcu9MMF"
}, - "calls": {
- "startedAt": "2019-12-12T07:34:14.202Z",
- "finishedAt": "2019-12-12T07:34:14.202Z",
- "errorMessage": "Cannot send request",
- "responseStatus": 200,
- "responseBody": {
- "foo": "bar"
}
}
}
}
This section describes API endpoints for managing schedules.
Schedules are used to automatically start your actors at certain times. Each schedule can be associated with a number of actors and actor tasks. It is also possible to override the settings of each actor (task) similarly to when invoking the actor (task) using the API. For more information, see Schedules documentation.
Each schedule is assigned actions for it to perform. Actions can be of two types - RUN_ACTOR
and RUN_ACTOR_TASK
. For details, see the documentation of the
Get schedule endpoint.
Get list of schedules
ClientsGets the list of schedules that the user created.
The endpoint supports pagination using the limit
and offset
parameters.
It will not return more than 1000 records.
By default, the records are sorted by the createdAt
field in ascending
order. To sort the records in descending order, use the desc=1
parameter.
Authorizations:
query Parameters
offset | number <double> Example: offset=10 Number of records that should be skipped at the start. The default value is |
limit | number <double> Example: limit=99 Maximum number of records to return. The default value, as well as the maximum, is |
desc | boolean Example: desc=true If |
Responses
Response Schema: application/json
required | object (GetListOfSchedulesResponseData) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .schedules() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 2,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 2,
- "items": [
- {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "my-schedule",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-20T06:33:11.202Z",
- "lastRunAt": "2019-04-12T07:33:10.202Z",
- "nextRunAt": "2019-04-12T07:34:10.202Z",
- "isEnabled": true,
- "isExclusive": true,
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "actions": [
- {
- "id": "ZReCs7hkdieq8ZUki",
- "type": "RUN_ACTOR",
- "actorId": "HKhKmiCMrDgu9eXeE"
}
]
}
]
}
}
Create schedule
ClientsCreates a new schedule with settings provided by the schedule object passed as JSON in the payload. The response is the created schedule object.
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. (More
info).
Authorizations:
Request Body schema: application/jsonrequired
name | string or null |
isEnabled | boolean or null |
isExclusive | boolean or null |
cronExpression | string or null |
timezone | string or null |
description | string or null |
Array of objects or null (CreateScheduleActions) |
Responses
Location | any |
Response Schema: application/json
required | object (Schedule) | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "my-schedule",
- "isEnabled": true,
- "isExclusive": true,
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "description": "Schedule of actor ...",
- "actions": [
- {
- "type": "RUN_ACTOR",
- "actorId": "jF8GGEvbEg4Au3NLA",
- "runInput": {
- "body": "{\\n \\\"foo\\\": \\\"actor\\\"\\n}",
- "contentType": "application/json; charset=utf-8"
}, - "runOptions": {
- "build": "latest",
- "timeoutSecs": 60,
- "memoryMbytes": 1024
}
}
]
}
Response samples
- 201
{- "data": {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "my-schedule",
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "isEnabled": true,
- "isExclusive": true,
- "description": "Schedule of actor ...",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-20T06:33:11.202Z",
- "nextRunAt": "2019-04-12T07:34:10.202Z",
- "lastRunAt": "2019-04-12T07:33:10.202Z",
- "actions": [
- {
- "id": "c6KfSgoQzFhMk3etc",
- "type": "RUN_ACTOR",
- "actorId": "jF8GGEvbEg4Au3NLA",
- "runInput": {
- "body": "{\\n \\\"foo\\\": \\\"actor\\\"\\n}",
- "contentType": "application/json; charset=utf-8"
}, - "runOptions": {
- "build": "latest",
- "timeoutSecs": 60,
- "memoryMbytes": 1024
}
}
]
}
}
Get schedule
Authorizations:
path Parameters
scheduleId required | string Example: asdLZtadYvn4mBZmm Schedule ID. |
Responses
Response Schema: application/json
required | object (Schedule) | ||||||||||||||||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const schedule = await apifyClient .schedule('<SCHEDULE ID>') .get(); console.log(schedule);
Response samples
- 200
{- "data": {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "my-schedule",
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "isEnabled": true,
- "isExclusive": true,
- "description": "Schedule of actor ...",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-20T06:33:11.202Z",
- "nextRunAt": "2019-04-12T07:34:10.202Z",
- "lastRunAt": "2019-04-12T07:33:10.202Z",
- "actions": [
- {
- "id": "c6KfSgoQzFhMk3etc",
- "type": "RUN_ACTOR",
- "actorId": "jF8GGEvbEg4Au3NLA",
- "runInput": {
- "body": "{\\n \\\"foo\\\": \\\"actor\\\"\\n}",
- "contentType": "application/json; charset=utf-8"
}, - "runOptions": {
- "build": "latest",
- "timeoutSecs": 60,
- "memoryMbytes": 1024
}
}
]
}
}
Update schedule
ClientsUpdates a schedule using values specified by a schedule object passed as JSON in the POST payload. If the object does not define a specific property, its value will not be updated.
The response is the full schedule object as returned by the Get schedule 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. (More
info).
Authorizations:
path Parameters
scheduleId required | string Example: asdLZtadYvn4mBZmm Schedule ID. |
Request Body schema: application/jsonrequired
name | string or null |
isEnabled | boolean or null |
isExclusive | boolean or null |
cronExpression | string or null |
timezone | string or null |
description | string or null |
Array of objects or null (CreateScheduleActions) |
Responses
Response Schema: application/json
required | object (Schedule) | ||||||||||||||||||||||||||
|
Request samples
- Payload
- JS client
{- "name": "my-schedule",
- "isEnabled": true,
- "isExclusive": true,
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "description": "Schedule of actor ...",
- "actions": [
- {
- "type": "RUN_ACTOR",
- "actorId": "jF8GGEvbEg4Au3NLA",
- "runInput": {
- "body": "{\\n \\\"foo\\\": \\\"actor\\\"\\n}",
- "contentType": "application/json; charset=utf-8"
}, - "runOptions": {
- "build": "latest",
- "timeoutSecs": 60,
- "memoryMbytes": 1024
}
}
]
}
Response samples
- 200
{- "data": {
- "id": "asdLZtadYvn4mBZmm",
- "userId": "wRsJZtadYvn4mBZmm",
- "name": "my-schedule",
- "cronExpression": "* * * * *",
- "timezone": "UTC",
- "isEnabled": true,
- "isExclusive": true,
- "description": "Schedule of actor ...",
- "createdAt": "2019-12-12T07:34:14.202Z",
- "modifiedAt": "2019-12-20T06:33:11.202Z",
- "nextRunAt": "2019-04-12T07:34:10.202Z",
- "lastRunAt": "2019-04-12T07:33:10.202Z",
- "actions": [
- {
- "id": "c6KfSgoQzFhMk3etc",
- "type": "RUN_ACTOR",
- "actorId": "jF8GGEvbEg4Au3NLA",
- "runInput": {
- "body": "{\\n \\\"foo\\\": \\\"actor\\\"\\n}",
- "contentType": "application/json; charset=utf-8"
}, - "runOptions": {
- "build": "latest",
- "timeoutSecs": 60,
- "memoryMbytes": 1024
}
}
]
}
}
Delete schedule
Authorizations:
path Parameters
scheduleId required | string Example: asdLZtadYvn4mBZmm Schedule ID. |
Responses
Response Schema: application/json
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); await apifyClient .schedule('<SCHEDULE ID>') .delete();
Response samples
- 204
{ }
Get schedule log
Authorizations:
path Parameters
scheduleId required | string Example: asdLZtadYvn4mBZmm Schedule ID. |
Responses
Response Schema: application/json
required | Array of objects (ScheduleInvoked) | ||||||
Array
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const log = await apifyClient .schedule('<SCHEDULE ID>') .getLog(); console.log(log);
Response samples
- 200
{- "data": [
- {
- "message": "Schedule invoked",
- "level": "INFO",
- "createdAt": "2019-03-26T12:28:00.370Z"
}, - {
- "message": "Cannot start actor task \\\"iEvfA6pm6DWjRTGxS\\\": Provided input must be object, got \\\"string\\\" instead.",
- "level": "ERROR",
- "createdAt": "2019-03-26T12:30:00.325Z"
}
]
}
Apify Store is home to hundreds of public Actors available to the Apify community. The API endpoints described in this section are used to retrieve these Actors.
Note that the endpoints do not require the authentication token.
Get list of Actors in store
Gets the list of public Actors in Apify Store. You can use search
parameter to search Actors by string in title, name, description, username
and readme.
If you need detailed info about a specific Actor, use the Get actor endpoint.
The endpoint supports pagination using the limit
and offset
parameters.
It will not return more than 1,000 records.
Authorizations:
query Parameters
limit | number <double> Example: limit=99 Maximum number of elements to return. The default and maximum value is
|
offset | number <double> Example: offset=10 Number of elements that should be skipped at the start. The default
value is |
search | string Example: search=web scraper String to search by. The search runs on the following fields: |
sortBy | string Example: sortBy='popularity' Specifies the field by which to sort the results. The supported values
are |
category | string Example: category='AI' Filters the results by the specified category. |
username | string Example: username='apify' Filters the results by the specified username. |
pricingModel | string Example: pricingModel='FREE' Filters the results by the specified pricing model. The supported values
are |
Responses
Response Schema: application/json
required | object (StoreData) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const { items } = await apifyClient .store() .list(); console.log(items);
Response samples
- 200
{- "data": {
- "total": 100,
- "offset": 0,
- "limit": 1000,
- "desc": false,
- "count": 1,
- "items": [
- {
- "id": "zdc3Pyhyz3m8vjDeM",
- "title": "My Public Actor",
- "name": "my-public-actor",
- "username": "jane35",
- "description": "My public actor!",
- "stats": {
- "totalBuilds": 9,
- "totalRuns": 16,
- "totalUsers": 6,
- "totalUsers7Days": 2,
- "totalUsers30Days": 6,
- "totalUsers90Days": 6,
- "totalMetamorphs": 2,
- "lastRunStartedAt": "2019-07-08T14:01:05.546Z"
}, - "currentPricingInfo": {
- "pricingModel": "FREE"
}
}, - {
- "id": "zdc3Pyhyz3m8vjDeM",
- "title": "My Public Actor",
- "name": "my-public-actor",
- "username": "jane35",
- "userFullName": "Jane H. Doe",
- "categories": [
- "MARKETING",
- "LEAD_GENERATION"
], - "description": "My public actor!",
- "stats": {
- "totalBuilds": 9,
- "totalRuns": 16,
- "totalUsers": 6,
- "totalUsers7Days": 2,
- "totalUsers30Days": 6,
- "totalUsers90Days": 6,
- "totalMetamorphs": 2,
- "lastRunStartedAt": "2019-07-08T14:01:05.546Z"
}, - "currentPricingInfo": {
- "pricingModel": "FREE"
}
}
]
}
}
The API endpoints described in this section are used the download the logs generated by actor builds and runs. Note that only the trailing 5M characters of the log are stored, the rest is discarded.
Note that the endpoints do not require the authentication token, the calls are authenticated using a hard-to-guess ID of the actor build or run.
Get log
Authorizations:
path Parameters
buildOrRunId required | string Example: HG7ML7M8z78YcAPEB ID of the actor build or run. |
query Parameters
stream required | boolean Example: stream=false If |
download required | boolean Example: download=false If |
Responses
Response Schema: text/plain
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const log = await apifyClient .log('<BUILD OR RUN ID>') .get(); console.log(log);
Response samples
- 200
2017-07-14T06:00:49.733Z Application started. 2017-07-14T06:00:49.741Z Input: { test: 123 } 2017-07-14T06:00:49.752Z Some useful debug information follows.
Get public user data
Returns public information about a specific user account, similar to what can be seen on public profile pages (e.g. https://apify.com/apify).
This operation requires no authentication token.
Authorizations:
path Parameters
userId required | string Example: HGzIk8z78YcAPEB User ID or username. |
Responses
Response Schema: application/json
required | object (UserPublicInfo) | ||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const user = await apifyClient .user('<USER ID>') .get(); console.log(user);
Response samples
- 200
{- "data": {
- "username": "d7b9MDYsbtX5L7XAj",
- "profile": {
- "bio": "I started web scraping in 1985 using Altair BASIC.",
- "name": "Jane Doe",
- "pictureUrl": "/img/anonymous_user_picture.png",
- "githubUsername": "torvalds.",
- "twitterUsername": "@BillGates"
}
}
}
Get private user data
Returns information about the current user account, including both public and private information.
The user account is identified by the provided authentication token.
The fields plan
, email
and profile
are omitted when this endpoint is accessed from Actor run.
Authorizations:
Responses
Response Schema: application/json
required | object (UserPrivateInfo) | ||||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const user = await apifyClient .user('me') .get(); console.log(user);
Response samples
- 200
{- "data": {
- "id": "YiKoxjkaS9gjGTqhF",
- "username": "myusername",
- "profile": {
- "bio": "I started web scraping in 1985 using Altair BASIC.",
- "name": "Jane Doe",
- "pictureUrl": "/img/anonymous_user_picture.png",
- "githubUsername": "torvalds.",
- "twitterUsername": "@BillGates"
}, - "email": "bob@example.com",
- "proxy": {
- "password": "ad78knd9Jkjd86",
- "groups": [
- {
- "name": "Group1",
- "description": "Group1 description",
- "availableCount": 10
}
]
}, - "plan": {
- "id": "Personal",
- "description": "Cost-effective plan for freelancers, developers and students.",
- "isEnabled": true,
- "monthlyBasePriceUsd": 49,
- "monthlyUsageCreditsUsd": 49,
- "usageDiscountPercent": 0,
- "enabledPlatformFeatures": [
- [
- "ACTORS"
], - [
- "STORAGE"
], - [
- "PROXY_SERPS"
], - [
- "SCHEDULER"
], - [
- "WEBHOOKS"
]
], - "maxMonthlyUsageUsd": 9999,
- "maxActorMemoryGbytes": 32,
- "maxMonthlyActorComputeUnits": 1000,
- "maxMonthlyResidentialProxyGbytes": 10,
- "maxMonthlyProxySerps": 30000,
- "maxMonthlyExternalDataTransferGbytes": 1000,
- "maxActorCount": 100,
- "maxActorTaskCount": 1000,
- "dataRetentionDays": 14,
- "availableProxyGroups": {
- "SOMEGROUP": 20,
- "ANOTHERGROUP": 200
}, - "teamAccountSeatCount": 1,
- "supportLevel": "COMMUNITY",
- "availableAddOns": [ ]
}
}
}
Get monthly usage
Returns a complete summary of your usage for the current usage cycle, an overall sum, as well as a daily breakdown of usage. It is the same information you will see on your account's Billing page. The information includes your use of storage, data transfer, and request queue usage.
Using the date
parameter will show your usage in the usage cycle that
includes that date.
Authorizations:
query Parameters
date | string Example: date=2020-06-14 Date in the YYYY-MM-DD format. |
Responses
Response Schema: application/json
required | object (MonthlyUsage) | ||||||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const usage = await apifyClient .user('me') .monthlyUsage(); console.log(usage);
Response samples
- 200
{- "data": {
- "usageCycle": {
- "startAt": "2022-10-02T00:00:00.000Z",
- "endAt": "2022-11-01T23:59:59.999Z"
}, - "monthlyServiceUsage": {
- "USAGE_ITEM": {
- "quantity": 2.784475,
- "baseAmountUsd": 0.69611875,
- "baseUnitPriceUsd": 0.25,
- "amountAfterVolumeDiscountUsd": 0.69611875,
- "priceTiers": [
- {
- "quantityAbove": 0,
- "discountPercent": 100,
- "tierQuantity": 0.39,
- "unitPriceUsd": 0,
- "priceUsd": 0
}
]
}
}, - "dailyServiceUsages": [
- {
- "date": "2022-10-02T00:00:00.000Z",
- "serviceUsage": {
- "SERVICE_USAGE_ITEM": {
- "quantity": 60,
- "baseAmountUsd": 0.00030000000000000003
}
}, - "totalUsageCreditsUsd": 0.0474385791970591
}
], - "totalUsageCreditsUsdBeforeVolumeDiscount": 0.786143673840067,
- "totalUsageCreditsUsdAfterVolumeDiscount": 0.786143673840067
}
}
Get limits
Returns a complete summary of your account's limits. It is the same information you will see on your account's Limits page. The returned data includes the current usage cycle, a summary of your limits, and your current usage.
Authorizations:
Responses
Response Schema: application/json
required | object (AccountLimits) | ||||||
|
Request samples
- JS client
import { ApifyClient } from 'apify-client'; const apifyClient = new ApifyClient({ token: '<TOKEN>', }); const limits = await apifyClient .user('me') .limits(); console.log(limits);
Response samples
- 200
{- "data": {
- "monthlyUsageCycle": {
- "startAt": "2022-10-02T00:00:00.000Z",
- "endAt": "2022-11-01T23:59:59.999Z"
}, - "limits": {
- "maxMonthlyUsageUsd": 300,
- "maxMonthlyActorComputeUnits": 1000,
- "maxMonthlyExternalDataTransferGbytes": 7,
- "maxMonthlyProxySerps": 50,
- "maxMonthlyResidentialProxyGbytes": 0.5,
- "maxActorMemoryGbytes": 16,
- "maxActorCount": 100,
- "maxActorTaskCount": 1000,
- "maxConcurrentActorJobs": 256,
- "maxTeamAccountSeatCount": 9,
- "dataRetentionDays": 90
}, - "current": {
- "monthlyUsageUsd": 43,
- "monthlyActorComputeUnits": 500.784475,
- "monthlyExternalDataTransferGbytes": 3.00861903931946,
- "monthlyProxySerps": 34,
- "monthlyResidentialProxyGbytes": 0.4,
- "actorMemoryGbytes": 8,
- "actorCount": 31,
- "actorTaskCount": 130,
- "activeActorJobCount": 0,
- "teamAccountSeatCount": 5
}
}
}
Update limits
Updates the account's limits manageable on your account's Limits page.
Specifically the: maxMonthlyUsageUsd
and dataRetentionDays
limits (see request body schema for more details).
Authorizations:
Request Body schema: application/json
maxMonthlyUsageUsd | number If your platform usage in the billing period exceeds the prepaid usage, you will be charged extra. Setting this property you can update your hard limit on monthly platform usage to prevent accidental overage or to limit the extra charges |
dataRetentionDays | number Apify securely stores your ten most recent Actor runs indefinitely, ensuring they are always accessible. Unnamed storages and other Actor runs are automatically deleted after the retention period. If you're subscribed, you can change it to keep data for longer or to limit your usage. Lear more |
Responses
Response Schema: application/json
Request samples
- Payload
- JS client
{- "maxMonthlyUsageUsd": 300,
- "dataRetentionDays": 90
}
Response samples
- 201
{ }