Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 46 additions & 38 deletions apify-api/openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ info:
Actor ID code (e.g. `vKg4IjxZbEYTYeW8T`) or its name (e.g.
`janedoe~my-actor`):

`https://api.apify.com/v2/acts/[actor_id]/runs`
`https://api.apify.com/v2/actors/[actor_id]/runs`

If the Actor is not runnable anonymously, you will receive a 401 or 403
[response code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).
Expand Down Expand Up @@ -111,6 +111,14 @@ info:
minutes) for the run to finish and returns its output. If the run takes
longer, the request will time out and throw an error.

## Legacy `/v2/acts/` URL prefix
<span id="/introduction/legacy-acts-prefix"></span>

The `/v2/acts/` prefix is deprecated but still fully functional, and
such endpoint routes to the same handler as its `/v2/actors/...` counterpart.
New integrations should use the canonical /v2/actors/ prefix,
but existing clients keep working without changes.

## Response structure
<span id="/introduction/response-structure"></span>

Expand Down Expand Up @@ -480,79 +488,79 @@ servers:
- url: "https://api.apify.com"
variables: {}
paths:
/v2/acts:
Comment thread
mtrunkat marked this conversation as resolved.
/v2/actors:
$ref: paths/actors/acts.yaml
"/v2/acts/{actorId}":
"/v2/actors/{actorId}":
$ref: "paths/actors/acts@{actorId}.yaml"
"/v2/acts/{actorId}/versions":
"/v2/actors/{actorId}/versions":
$ref: "paths/actors/acts@{actorId}@versions.yaml"
"/v2/acts/{actorId}/versions/{versionNumber}":
"/v2/actors/{actorId}/versions/{versionNumber}":
$ref: "paths/actors/acts@{actorId}@versions@{versionNumber}.yaml"
"/v2/acts/{actorId}/versions/{versionNumber}/env-vars":
"/v2/actors/{actorId}/versions/{versionNumber}/env-vars":
$ref: "paths/actors/acts@{actorId}@versions@{versionNumber}@env-vars.yaml"
"/v2/acts/{actorId}/versions/{versionNumber}/env-vars/{envVarName}":
"/v2/actors/{actorId}/versions/{versionNumber}/env-vars/{envVarName}":
$ref: "paths/actors/acts@{actorId}@versions@{versionNumber}@env-vars@{envVarName}.yaml"
"/v2/acts/{actorId}/webhooks":
"/v2/actors/{actorId}/webhooks":
$ref: "paths/actors/acts@{actorId}@webhooks.yaml"
"/v2/acts/{actorId}/builds":
"/v2/actors/{actorId}/builds":
$ref: "paths/actors/acts@{actorId}@builds.yaml"
"/v2/acts/{actorId}/builds/default":
"/v2/actors/{actorId}/builds/default":
$ref: "paths/actors/acts@{actorId}@builds@default.yaml"
"/v2/acts/{actorId}/builds/{buildId}/openapi.json":
"/v2/actors/{actorId}/builds/{buildId}/openapi.json":
$ref: "paths/actors/acts@{actorId}@builds@{buildId}@openapi.json.yaml"
"/v2/acts/{actorId}/builds/{buildId}":
"/v2/actors/{actorId}/builds/{buildId}":
$ref: "paths/actors/acts@{actorId}@builds@{buildId}.yaml"
"/v2/acts/{actorId}/builds/{buildId}/abort":
"/v2/actors/{actorId}/builds/{buildId}/abort":
$ref: "paths/actors/acts@{actorId}@builds@{buildId}@abort.yaml"
"/v2/acts/{actorId}/runs":
"/v2/actors/{actorId}/runs":
$ref: "paths/actors/acts@{actorId}@runs.yaml"
"/v2/acts/{actorId}/run-sync":
"/v2/actors/{actorId}/run-sync":
$ref: "paths/actors/acts@{actorId}@run-sync.yaml"
"/v2/acts/{actorId}/run-sync-get-dataset-items":
"/v2/actors/{actorId}/run-sync-get-dataset-items":
$ref: "paths/actors/acts@{actorId}@run-sync-get-dataset-items.yaml"
"/v2/acts/{actorId}/validate-input":
"/v2/actors/{actorId}/validate-input":
$ref: "paths/actors/acts@{actorId}@validate-input.yaml"
"/v2/acts/{actorId}/runs/{runId}/resurrect":
"/v2/actors/{actorId}/runs/{runId}/resurrect":
$ref: "paths/actors/acts@{actorId}@runs@{runId}@resurrect.yaml"
"/v2/acts/{actorId}/runs/last":
"/v2/actors/{actorId}/runs/last":
$ref: "paths/actors/acts@{actorId}@runs@last.yaml"
"/v2/acts/{actorId}/runs/last/dataset":
"/v2/actors/{actorId}/runs/last/dataset":
$ref: "paths/actors/acts@{actorId}@runs@last@dataset.yaml"
"/v2/acts/{actorId}/runs/last/dataset/items":
"/v2/actors/{actorId}/runs/last/dataset/items":
$ref: "paths/actors/acts@{actorId}@runs@last@dataset@items.yaml"
"/v2/acts/{actorId}/runs/last/dataset/statistics":
"/v2/actors/{actorId}/runs/last/dataset/statistics":
$ref: "paths/actors/acts@{actorId}@runs@last@dataset@statistics.yaml"
"/v2/acts/{actorId}/runs/last/key-value-store":
"/v2/actors/{actorId}/runs/last/key-value-store":
$ref: "paths/actors/acts@{actorId}@runs@last@key-value-store.yaml"
"/v2/acts/{actorId}/runs/last/key-value-store/keys":
"/v2/actors/{actorId}/runs/last/key-value-store/keys":
$ref: "paths/actors/acts@{actorId}@runs@last@key-value-store@keys.yaml"
"/v2/acts/{actorId}/runs/last/key-value-store/records":
"/v2/actors/{actorId}/runs/last/key-value-store/records":
$ref: "paths/actors/acts@{actorId}@runs@last@key-value-store@records.yaml"
"/v2/acts/{actorId}/runs/last/key-value-store/records/{recordKey}":
"/v2/actors/{actorId}/runs/last/key-value-store/records/{recordKey}":
$ref: "paths/actors/acts@{actorId}@runs@last@key-value-store@records@{recordKey}.yaml"
"/v2/acts/{actorId}/runs/last/request-queue":
"/v2/actors/{actorId}/runs/last/request-queue":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/requests":
"/v2/actors/{actorId}/runs/last/request-queue/requests":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@requests.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/requests/batch":
"/v2/actors/{actorId}/runs/last/request-queue/requests/batch":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@requests@batch.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/requests/unlock":
"/v2/actors/{actorId}/runs/last/request-queue/requests/unlock":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@requests@unlock.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/requests/{requestId}":
"/v2/actors/{actorId}/runs/last/request-queue/requests/{requestId}":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@requests@{requestId}.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/requests/{requestId}/lock":
"/v2/actors/{actorId}/runs/last/request-queue/requests/{requestId}/lock":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@requests@{requestId}@lock.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/head":
"/v2/actors/{actorId}/runs/last/request-queue/head":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@head.yaml"
"/v2/acts/{actorId}/runs/last/request-queue/head/lock":
"/v2/actors/{actorId}/runs/last/request-queue/head/lock":
$ref: "paths/actors/acts@{actorId}@runs@last@request-queue@head@lock.yaml"
"/v2/acts/{actorId}/runs/last/log":
"/v2/actors/{actorId}/runs/last/log":
$ref: "paths/actors/acts@{actorId}@runs@last@log.yaml"
"/v2/acts/{actorId}/runs/{runId}":
"/v2/actors/{actorId}/runs/{runId}":
$ref: "paths/actors/acts@{actorId}@runs@{runId}.yaml"
"/v2/acts/{actorId}/runs/{runId}/abort":
"/v2/actors/{actorId}/runs/{runId}/abort":
$ref: "paths/actors/acts@{actorId}@runs@{runId}@abort.yaml"
"/v2/acts/{actorId}/runs/{runId}/metamorph":
"/v2/actors/{actorId}/runs/{runId}/metamorph":
$ref: "paths/actors/acts@{actorId}@runs@{runId}@metamorph.yaml"
/v2/actor-tasks:
$ref: paths/actor-tasks/actor-tasks.yaml
Expand Down
2 changes: 1 addition & 1 deletion apify-api/openapi/paths/actors/acts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ post:
text/plain:
schema:
type: string
example: https://api.apify.com/v2/acts/zdc3Pyhyz3m8vjDeM
example: https://api.apify.com/v2/actors/zdc3Pyhyz3m8vjDeM
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ post:
schema:
type: string
example: >-
https://api.apify.com/v2/acts/zdc3Pyhyz3m8vjDeM/runs/HG7ML7M8z78YcAPEB
https://api.apify.com/v2/actors/zdc3Pyhyz3m8vjDeM/runs/HG7ML7M8z78YcAPEB
content:
application/json:
schema:
Expand Down
2 changes: 1 addition & 1 deletion apify-api/openapi/paths/actors/acts@{actorId}@runs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ post:
schema:
type: string
example: >-
https://api.apify.com/v2/acts/zdc3Pyhyz3m8vjDeM/runs/HG7ML7M8z78YcAPEB
https://api.apify.com/v2/actors/zdc3Pyhyz3m8vjDeM/runs/HG7ML7M8z78YcAPEB
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ get:

The base path represents the last Actor run object is:

`/v2/acts/{actorId}/runs/last{?token,status}`
`/v2/actors/{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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ post:
text/plain:
schema:
type: string
example: https://api.apify.com/v2/acts/zdc3Pyhyz3m8vjDeM/versions/0.0
example: https://api.apify.com/v2/actors/zdc3Pyhyz3m8vjDeM/versions/0.0
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ post:
schema:
type: string
example: >-
https://api.apify.com/v2/acts/zdc3Pyhyz3m8vjDeM/versions/1.0/env-vars/ENV_VAR_NAME
https://api.apify.com/v2/actors/zdc3Pyhyz3m8vjDeM/versions/1.0/env-vars/ENV_VAR_NAME
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ Success: Actor was deployed to Apify cloud and built there.
The URLs tell us that our Actor's ID is `Yk1bieximsduYDydP`. With this `actorId`, and our `token`, which is retrievable through **Settings > API & Integrations** in Apify Console, we can construct a link which will call the Actor:

```text
https://api.apify.com/v2/acts/Yk1bieximsduYDydP/runs?token=YOUR_TOKEN_HERE
https://api.apify.com/v2/actors/Yk1bieximsduYDydP/runs?token=YOUR_TOKEN_HERE
```

We can also use our username and the name of the Actor like this:

```text
https://api.apify.com/v2/acts/USERNAME~filter-actor/runs?token=YOUR_TOKEN_HERE
https://api.apify.com/v2/actors/USERNAME~filter-actor/runs?token=YOUR_TOKEN_HERE
```

Whichever one you choose is totally up to your preference.
Expand Down
6 changes: 3 additions & 3 deletions sources/academy/platform/getting_started/apify_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Within one of your Actors on the [Apify Console](https://console.apify.com?asrc=
You should see a long list of API endpoints that you can copy and paste elsewhere, or even test right within the **API** modal. Go ahead and copy the endpoint labeled **Run Actor synchronously and get dataset items**. It should look something like this:

```text
https://api.apify.com/v2/acts/YOUR_USERNAME~adding-actor/run-sync?token=YOUR_TOKEN
https://api.apify.com/v2/actors/YOUR_USERNAME~adding-actor/run-sync?token=YOUR_TOKEN
```

:::note Single endpoint
Expand All @@ -44,7 +44,7 @@ Our **adding-actor** takes in two input values (`num1` and `num2`). When using t
Let's say we want to run our **adding-actor** via API and view its results in CSV format at the end. We'll achieve this by passing the **format** parameter with a value of **csv** to change the output format:

```text
https://api.apify.com/v2/acts/YOUR_USERNAME~adding-actor/run-sync-get-dataset-items?token=YOUR_TOKEN_HERE&format=csv
https://api.apify.com/v2/actors/YOUR_USERNAME~adding-actor/run-sync-get-dataset-items?token=YOUR_TOKEN_HERE&format=csv
```

Additional parameters can be passed to this endpoint. You can learn about them in our [API documentation](/api/v2/act-run-sync-get-dataset-items-post)
Expand All @@ -60,7 +60,7 @@ Network components can record visited URLs, so it's more secure to send the toke
If you're not using an HTTP client, you can send the request through your terminal with this command:

```curl
curl -d '{"num1":1, "num2":8}' -H "Content-Type: application/json" -X POST "https://api.apify.com/v2/acts/YOUR_USERNAME~adding-actor/run-sync-get-dataset-items?token=YOUR_TOKEN_HERE&format=csv"
curl -d '{"num1":1, "num2":8}' -H "Content-Type: application/json" -X POST "https://api.apify.com/v2/actors/YOUR_USERNAME~adding-actor/run-sync-get-dataset-items?token=YOUR_TOKEN_HERE&format=csv"
```

Here's the response we got:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To run, or **call**, an Actor/task, you will need a few things:
The URL of [POST request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) to run an Actor looks like this:

```cURL
https://api.apify.com/v2/acts/ACTOR_NAME_OR_ID/runs?token=YOUR_TOKEN
https://api.apify.com/v2/actors/ACTOR_NAME_OR_ID/runs?token=YOUR_TOKEN
```

For tasks, we can switch the path from **acts** to **actor-tasks** and keep the rest the same:
Expand All @@ -58,7 +58,7 @@ If we send a correct POST request to one of these endpoints, the Actor or task w
We can also add settings for the Actor (which will override the default settings) as additional query parameters. For example, if we wanted to change how much memory the Actor's run should be allocated and which build to run, we could add the `memory` and `build` parameters separated by `&`.

```cURL
https://api.apify.com/v2/acts/ACTOR_NAME_OR_ID/runs?token=YOUR_TOKEN&memory=8192&build=beta
https://api.apify.com/v2/actors/ACTOR_NAME_OR_ID/runs?token=YOUR_TOKEN&memory=8192&build=beta
```

This works in almost exactly the same way for both Actors and tasks; however, for tasks, there is no reason to specify a [`build`](/platform/actors/development/builds-and-runs/builds) parameter, as a task already has only one specific Actor build which cannot be changed with query parameters.
Expand All @@ -74,7 +74,7 @@ Good Actors have reasonable defaults for most input fields, so if you want to ru
Via API, let's quickly try to run [Web Scraper](https://apify.com/apify/web-scraper), which is the most popular Actor on Apify Store at the moment. The full input with all possible fields is [pretty long and ugly](https://apify.com/apify/web-scraper?section=example-run), so we will not show it here. Because it has default values for most fields, we can provide a JSON input containing only the fields we'd like to customize. We will send a POST request to the endpoint below and add the JSON as the **body** of the request:

```cURL
https://api.apify.com/v2/acts/apify~web-scraper/runs?token=YOUR_TOKEN
https://api.apify.com/v2/actors/apify~web-scraper/runs?token=YOUR_TOKEN
```

Here is how it looks in [Postman](https://www.postman.com/):
Expand Down Expand Up @@ -164,7 +164,7 @@ const myToken = '<YOUR_APIFY_TOKEN>';
// Start apify/google-search-scraper Actor
// and pass some queries into the JSON body
const response = await got({
url: `https://api.apify.com/v2/acts/apify~google-search-scraper/run-sync-get-dataset-items?token=${myToken}`,
url: `https://api.apify.com/v2/actors/apify~google-search-scraper/run-sync-get-dataset-items?token=${myToken}`,
method: 'POST',
json: {
queries: 'web scraping\nweb crawling',
Expand Down Expand Up @@ -209,7 +209,7 @@ There may be cases where we need to run the Actor and go away. But in any kind o
This solution is quite similar to the synchronous flow. To make the POST request wait, add the `waitForFinish` parameter. It can have a value from `0` to `60`, which is the maximum time in seconds to wait (the max value for `waitForFinish` is 1 minute). Knowing this, we can extend the example URL like this:

```cURL
https://api.apify.com/v2/acts/apify~web-scraper/runs?token=YOUR_TOKEN&waitForFinish=60
https://api.apify.com/v2/actors/apify~web-scraper/runs?token=YOUR_TOKEN&waitForFinish=60
```

You can also use the `waitForFinish` parameter with the [**GET Run** endpoint](/api/v2/actor-run-get) to implement a smarter [polling](#polling) system.
Expand Down Expand Up @@ -239,7 +239,7 @@ When we run the Actor with the [usual API call](#run-an-actor-or-task) shown abo
Replace the `RUN_ID` in the following URL with the ID you extracted earlier:

```cURL
https://api.apify.com/v2/acts/ACTOR_NAME_OR_ID/runs/RUN_ID
https://api.apify.com/v2/actors/ACTOR_NAME_OR_ID/runs/RUN_ID
```

Once a status of `SUCCEEDED` or `FAILED` has been received, we know the run has finished and can cancel the interval and finally [collect the data](#collect-the-data).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ You need to regularly grab SERP data about your target keywords? Apify provides

Hit `Save & Run` and you'll have the downloaded data as soon as the query finishes. To have it run at a regular frequency, you can set up the task to run on an [automatic schedule](/platform/schedules#setting-up-a-new-schedule).

To run from the API, send a [synchronous POST request](/api/v2/actor-task-run-sync-get-dataset-items-post) to an endpoint such as `https://api.apify.com/v2/acts/TASK_NAME_OR_ID/runs?token=YOUR_TOKEN`. Include any required input in a JSON object in the request's body.
To run from the API, send a [synchronous POST request](/api/v2/actor-task-run-sync-get-dataset-items-post) to an endpoint such as `https://api.apify.com/v2/actors/TASK_NAME_OR_ID/runs?token=YOUR_TOKEN`. Include any required input in a JSON object in the request's body.

Keep in mind that, as Google search uses a non-deterministic algorithm, output results may vary even if the input settings are exactly the same.
4 changes: 2 additions & 2 deletions sources/api/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The most common workflow involving Apify API consists of the following steps:
For shorter runs where you need immediate results:

```http title="Endpoint"
POST https://api.apify.com/v2/acts/:actorId/run-sync
POST https://api.apify.com/v2/actors/:actorId/run-sync
```

Expected response codes:
Expand All @@ -79,7 +79,7 @@ Expected response codes:
For longer-running operations or when you don't need immediate results.

```http title="Endpoint"
POST https://api.apify.com/v2/acts/:actorId/runs
POST https://api.apify.com/v2/actors/:actorId/runs
```

Expected response codes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Choose the method that best fits your workflow.
1. Go to your Actor's detail page in Apify Console, click on the API tab in the top right, then select API Endpoints. Copy the **Build Actor** API endpoint URL. The format is as follows:

```cURL
https://api.apify.com/v2/acts/YOUR-ACTOR-NAME/builds?token=YOUR-TOKEN-HERE&version=0.0&tag=beta&waitForFinish=60
https://api.apify.com/v2/actors/YOUR-ACTOR-NAME/builds?token=YOUR-TOKEN-HERE&version=0.0&tag=beta&waitForFinish=60
```

:::note API token
Expand Down Expand Up @@ -78,7 +78,7 @@ Now your Actor will automatically rebuild on every push to the GitHub repository
:::

```cURL
https://api.apify.com/v2/acts/YOUR-ACTOR-NAME/builds?token=YOUR-TOKEN-HERE&version=0.0&tag=latest&waitForFinish=60
https://api.apify.com/v2/actors/YOUR-ACTOR-NAME/builds?token=YOUR-TOKEN-HERE&version=0.0&tag=latest&waitForFinish=60
```

1. Name the secret & paste in your API endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ await apifyClient.actor(actorId).call(input, {
Or using the API:

```tsx
POST https://api.apify.com/v2/acts/<actor_id>/runs?forcePermissionLevel=LIMITED_PERMISSIONS
POST https://api.apify.com/v2/actors/<actor_id>/runs?forcePermissionLevel=LIMITED_PERMISSIONS
```

## Common migration paths
Expand Down
2 changes: 1 addition & 1 deletion sources/platform/actors/running/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Now you can go back to the **Input** tab and try again with different settings,
To invoke Actors with the Apify API, send an HTTP POST request to the [Run Actor](/api/v2/act-runs-post) endpoint. For example:

```text
https://api.apify.com/v2/acts/compass~crawler-google-places/runs?token=<YOUR_API_TOKEN>
https://api.apify.com/v2/actors/compass~crawler-google-places/runs?token=<YOUR_API_TOKEN>
```

An Actor's input and its content type can be passed as a payload of the POST request, and additional options can be specified using URL query parameters. To learn more, see [Run an Actor and retrieve data via API](/academy/api/run-actor-and-retrieve-data-via-api).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The webhook should look something like this:

```json5
{
"requestUrl": "https://api.apify.com/v2/acts/<integration-actor-id>/runs",
"requestUrl": "https://api.apify.com/v2/actors/<integration-actor-id>/runs",
"eventTypes": ["ACTOR.RUN.SUCCEEDED"],
"condition": {
"actorId": "<actor-id>",
Expand Down
Loading