You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sources/platform/actors/development/actor_definition/dataset_schema/validation.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,12 +104,13 @@ If the data you attempt to store in the dataset is _invalid_ (meaning any of the
104
104
}
105
105
```
106
106
107
-
The type of the AJV validation error object is [here](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts#L86).
107
+
For the complete AJV validation error object type definition, refer to the [AJV type definitions on GitHub](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts#L86).
108
108
109
109
If you use the Apify JS client or Apify SDK and call `pushData` function you can access the validation errors in a `try catch` block like this:
@@ -47,7 +47,9 @@ The default setting strikes a good balance for casual or internal use, but **Res
47
47
You can switch to **Restricted** access at any time. If it causes issues in your workflow, you can revert to the default setting just as easily.
48
48
49
49
:::note Support in public Actors
50
+
50
51
Because this is a new setting, some existing public Actors and integrations might not support it yet. Their authors need to update them to provide a valid token on all API calls.
### Sharing restricted resources with pre-signed URLs {#pre-signed-urls}
125
127
126
-
Even when a resource is restricted, you might still want to share it with someone outside your team — for example, to send a PDF report to a client, or include a screenshot in an automated email or Slack message. In these cases, **storage resources** (like key-value stores, datasets, and request queues) support generating **pre-signed URLs**. These are secure, time-limited links that let others access individual files without needing an Apify account or authentication.
128
+
Even when a resource is restricted, you might still want to share it with someone outside your team — for example, to send a PDF report to a client, or include a screenshot in an automated email or Slack message. In these cases, _storage resources_ (like key-value stores, datasets, and request queues) support generating _pre-signed URLs_. These are secure, time-limited links that let others access individual files without needing an Apify account or authentication.
129
+
130
+
#### How pre-signed URLs work
131
+
132
+
A pre-signed URL is a regular HTTPS link that includes a cryptographic signature verifying that access has been explicitly granted by someone with valid permissions.
133
+
When a pre-signed URL is used, Apify validates the signature and grants access without requiring an API token.
134
+
135
+
The signature can be temporary (set to expire after a specified duration) or permanent, depending on the expiration date set when it's generated.
136
+
137
+
#### What links can be pre-signed
138
+
139
+
Only selected _dataset_ and _key-value store_ endpoints support pre-signed URLs.
140
+
This allows fine-grained control over what data can be shared without authentication.
|_Datasets_|[Dataset items](/api/v2/dataset-items-get) (`/v2/datasets/:datasetId/items`) | Temporary or Permanent | The link provides access to all dataset items. |
145
+
|_Key-value stores_|[List of keys](/api/v2/key-value-store-keys-get) (`/v2/key-value-stores/:storeId/keys`) | Temporary or Permanent | Returns the list of keys in a store. |
146
+
|_Key-value stores_|[Single record](/api/v2/key-value-store-record-get) (`/v2/key-value-stores/:storeId/records/:recordKey`) |_Permanent only_| The public URL for a specific record is always permanent - it stays valid as long as the record exists. |
147
+
148
+
:::info Automatically generated signed URLs
149
+
150
+
When you retrieve dataset or key-value store details using:
the API response includes automatically generated fields:
156
+
157
+
-`itemsPublicUrl` – a pre-signed URL providing access to dataset items
158
+
-`keysPublicUrl` – a pre-signed URL providing access to key-value store keys
159
+
160
+
These automatically generated URLs are _valid for 14 days_.
161
+
162
+
The response also contains:
163
+
164
+
-`consoleUrl` - provides a stable link to the resource's page in the Apify Console. Unlike a direct API link, Console link will prompt unauthenticated users to sign in, ensuring they have required permissions to view the resource.
165
+
166
+
:::
167
+
168
+
You can create pre-signed URLs either through the Apify Console or programmatically via the Apify API client.
169
+
170
+
#### How to generate pre-signed URLs in Apify Console
127
171
128
-
Pre-signed URLs:
172
+
To generate a pre-signed link, you can use the **Export** button in Console.
129
173
130
-
- Work even when General resource access is restricted
131
-
- Expire automatically after 14 days (by default)
132
-
- Are scoped to a single resource (prevents access to other records)
133
-
- Are ideal for sharing screenshots, reports, or any other one-off files
174
+
:::note
134
175
135
-
To generate a pre-signed link, you can use the **Export** button in Console, or call the appropriate API client method.
176
+
The link will include a signature _only if the general resource access is set to Restricted_. For unrestricted datasets, the link will work without a signature.
177
+
178
+
:::
179
+
180
+
##### Dataset items
181
+
182
+
1. Click the **Export** button.
183
+
2. In the modal that appears, click **Copy shareable link**.
136
184
137
185

138
186
139
-
:::info Console links for resources
187
+
##### Key-value store records
188
+
189
+
1. Open a key-value store.
190
+
2. Navigate to the record you want to share.
191
+
3. In the **Actions** column, click the link icon to copy signed link.
140
192
141
-
Resource objects returned by the API and clients (like `apify-client-js`) include a `consoleUrl` property. This provides a stable link to the resource's page in the Apify Console. Unlike a direct API link, Console link will prompt unauthenticated users to sign in, ensuring they have required permissions to view the resource.
193
+

194
+
195
+
#### How to generate pre-signed URLs using Apify Client
196
+
197
+
You can generate pre-signed URLs programmatically for datasets and key-value stores:
If the `expiresInSecs` option is not specified, the generated link will be _permanent_.
144
235
145
236
:::
146
237
238
+
#### Signing URLs manually
239
+
240
+
If you need finer control — for example, generating links without using Apify client — you can sign URLs manually using our reference implementation.
241
+
242
+
[Check the reference implementation in Apify clients](https://github.com/apify/apify-client-js/blob/5efd68a3bc78c0173a62775f79425fad78f0e6d1/src/resource_clients/dataset.ts#L179)
243
+
244
+
Manual signing uses standard _HMAC (SHA-256)_ with `urlSigningSecretKey` of the resource and can be easily integrated.
245
+
147
246
### Sharing storages by name
148
247
149
248
A convenient feature of storages is that you can name them. If you choose to do so there is an extra access level setting that applies to storages only, which is **Anyone with name or ID can read**. In that case anyone that knows the storage name is able to read it via API or view it using the storages Console URL.
@@ -156,19 +255,76 @@ This is very useful if you wish to expose a storage publicly with an easy to rem
156
255
157
256
## Implications for public Actor developers
158
257
159
-
If you own a public Actor in the Apify Store, you need to make sure that your Actor will work even for users who have restricted access to their resources. Over time, you might see a growing number of users with **General resource access** set to **Restricted**.
258
+
If you own a public Actor in the Apify Store, you need to make sure that your Actor will work even for users who have restricted access to their resources. Over time, you might see a growing number of users with _General resource access_ set to _Restricted_.
259
+
260
+
In practice, this means that all API calls originating from the Actor need to have a valid API token. If you are using Apify SDK, this should be the default behavior. See the detailed guide below for more information.
261
+
262
+
263
+
:::caution Actor runs inherit user permissions
264
+
265
+
Keep in mind that when users run your public Actor, the Actor makes API calls under the user account, not your developer account. This means that it follows the _General resource access_ configuration of the user account. The configuration of your developer account has no effect on the Actor users.
266
+
267
+
:::
268
+
269
+
### Migration guide to support restricted general resource access
270
+
271
+
This section provides a practical guide and best practices to help you update your public Actors so they fully support _Restricted general resource access_.
272
+
273
+
---
274
+
275
+
#### Always authenticate API requests
276
+
277
+
All API requests from your Actor should be authenticated.
278
+
When using the [Apify SDK](https://docs.apify.com/sdk/js/) or [Apify Client](https://docs.apify.com/api/client/js/), this is done automatically.
279
+
280
+
If your Actor makes direct API calls, include the API token manually:
#### Generate pre-signed URLs for external sharing
289
+
290
+
If your Actor outputs or shares links to storages (such as datasets or key-value store records), make sure to generate pre-signed URLs instead of hardcoding API URLs.
160
291
161
-
:::tip Testing public access behavior
292
+
For example:
293
+
294
+
```js
295
+
import { ApifyClient } from"apify-client";
162
296
163
-
To test your public Actor, run it using an account with **General resource access** set to restricted. You can use your developer account, or create a temporary testing Apify account.
// Save pre-signed URL — accessible without authentication
305
+
awaitActor.pushData({ recordUrl });
306
+
```
307
+
308
+
To learn more about generating pre-signed URLs, refer to the section [Sharing restricted resources with pre-signed URLs](/platform/collaboration/general-resource-access#pre-signed-urls).
309
+
310
+
311
+
:::note Using Console URLs
312
+
313
+
Datasets and key-value stores also include a `consoleUrl` property.
314
+
Console URLs provide stable links to the resource’s page in Apify Console.
315
+
Unauthenticated users will be prompted to sign in, ensuring they have required permissions.
164
316
165
317
:::
166
318
167
-
In practice, this means that all API calls originating from the Actor need to have a valid API token. If you are using Apify SDK, this should be the default behavior.
319
+
#### Test your Actor under restricted access
168
320
321
+
Before publishing or updating your Actor, it’s important to verify that it works correctly for users with _restricted general resource access_.
169
322
170
-
:::caution Actor Runs Inherit User Permissions
323
+
You can easily test this by switching your own account’s setting to _Restricted_, or by creating an organization under your account and enabling restricted access there. This approach ensures your tests accurately reflect how your public Actor will behave for end users.
171
324
172
-
Keep in mind that when users run your public Actor, the Actor makes API calls under the user account, not your developer account. This means that it follows the **General resource access** configuration of the user account. The configuration of your developer account has no effect on the Actor users.
325
+
:::tip Make sure links work as expected
326
+
327
+
Once you’ve enabled restricted access, run your Actor and confirm that all links generated in logs, datasets, key-value stores, and status messages remain accessible as expected. Make sure any shared URLs — especially those stored in results or notifications — work without requiring an API token.
Copy file name to clipboardExpand all lines: sources/platform/integrations/programming/api.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,19 +168,20 @@ This restriction is _transitive_, which means that if the Actor runs another Act
168
168
169
169
When Apify [runs an Actor](/platform/actors/running/runs-and-builds#runs), it automatically creates a set of default storages (a dataset, a key-value store and request queue) that the Actor can use in runtime.
170
170
171
-
You can configure whether the scoped token you are going use to run the Actor should get **Write**
172
-
access to these default storages.
171
+
You can configure whether the scoped token you are going use to run the Actor should get access to these default storages.
173
172
174
173

175
174
176
-
:::tip
177
-
Let's say your Actor produces a lot of data that you want to delete just after the Actor finishes. If you enable this toggle, your scoped token will be allowed to do that.
178
-
:::
175
+
If it’s **on**, the token can implicitly access the default storage of the Actor runs it triggers, or in general, of any Actor run in your account that falls within its scope. This is useful if you want to allow a third-party service to run an Actor and then read the Actor’s output (think AI agents).
179
176
180
-
:::caution
181
-
Even if you disable this option, **the default storages can still be accessed anonymously using just their ID** (which can be obtained via the [run object](https://docs.apify.com/api/v2#tag/Actor-runsRun-object-and-its-storages)).
177
+
If the toggle is **off**, the token can still trigger and inspect runs, but access to the default storages is restricted:
182
178
183
-
Moreover, if a scoped token can run an Actor, it can also list all its runs, including their storage IDs, ultimately exposing their content as well. If this is not desirable, change your Actor to output data into an existing named storage, or have it create a new storage.
179
+
- For accounts with **Restricted general resource access**, the token cannot read or write to default storages. [Learn more about restricted general resource access](/platform/collaboration/general-resource-access).
180
+
- For accounts with **Unrestricted general resource access**, the default storages can still be read anonymously using their IDs, but writing is prevented.
181
+
182
+
183
+
:::tip
184
+
Let's say your Actor produces a lot of data that you want to delete just after the Actor finishes. If you enable this toggle, your scoped token will be allowed to do that.
0 commit comments