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/integrations/programming/api.md
+8-14Lines changed: 8 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,8 @@ To access the Apify API in your integrations, you need to authenticate using you
25
25

26
26
27
27
:::caution
28
-
29
28
Do not share the API token with untrusted parties, or use it directly from client-side code,
30
29
unless you fully understand the consequences! You can also consider [limiting the permission scope](#limited-permissions) of the token, so that it can only access what it really needs.
31
-
32
30
:::
33
31
34
32
## Authentication
@@ -54,6 +52,10 @@ By default, tokens can access all data in your account. If that is not desirable
54
52
55
53
**A scoped token can access only those resources that you'll explicitly allow it to.**
56
54
55
+
:::info
56
+
We currently do not allow scoped tokens to create or modify Actors. If you do need to create or modify Actors via Apify API, use an unscoped token.
57
+
:::
58
+
57
59
### How to create a scoped token
58
60
59
61
Scoped tokens behave like standard API tokens and are managed through the [Integrations](https://console.apify.com/settings/integrations) page in Apify Console. When creating a token (or updating an existing one), simply toggle "Limit token permissions" to make the token scoped.
@@ -71,9 +73,7 @@ We support two different types of permissions for tokens:
71
73
-**Resource-specific permissions**: These will apply only to specific, existing resources. For example, you can use these to allow the token to read from a particular dataset.
72
74
73
75
:::tip
74
-
75
76
A single token can combine both types. You can create a token that can _read_ any data storage, but _write_ only to one specific key-value store.
76
-
77
77
:::
78
78
79
79

@@ -85,9 +85,7 @@ If you need to create new resources with the token (for example, create a new Ta
85
85
Once you create a new resource with the token, _the token will gain full access to that resource_, regardless of other permissions. It is not possible to create a token that can create a dataset, but not write to it.
86
86
87
87
:::tip
88
-
89
88
This is useful if you want to for example create a token that can dynamically create & populate datasets, but without the need to access other datasets in your account.
90
-
91
89
:::
92
90
93
91
### Permission dependencies
@@ -108,9 +106,7 @@ Other dependencies are more complicated, and **it is your responsibility that th
108
106
- Similarly, to create or update a task, the token needs the additional permission to access the task's Actor itself.
109
107
110
108
:::tip
111
-
112
109
Let's say that you have an Actor and you want to programmatically create schedules for that Actor. Then you can create a token that has the account level _Create_ permission on schedules, but only the resource-specific _Run_ permission on the Actor. Such a token has exactly the permissions it needs, and nothing more.
113
-
114
110
:::
115
111
116
112
### Actor execution
@@ -142,18 +138,16 @@ When you run an Actor with a scoped token in this mode, Apify will inject a toke
142
138
143
139
This way you can be sure that Actors won't accidentally—or intentionally—access any data they shouldn't. However, Actors might not function properly if the scope is not sufficient.
144
140
145
-
:::note
146
-
The injected token also gets write access to its default storages, and to the run itself (for example, so that the Actor can abort itself). You don't need to configure this on your scoped token.
147
-
:::
148
-
149
141
:::tip
150
142
This restriction is _transitive_, which means that if the Actor runs another Actor, its access will be restricted as well.
151
143
:::
152
144
153
-
#### Limitations
145
+
#### Default run storages
146
+
147
+
When Apify runs an Actor, it automatically creates a set of default storages (a dataset, a key-value store and request queue) that the Actor can use in runtime.
154
148
149
+
- Regardless of mode, the injected token always gets write access to its default storages, and to the run itself (for example, so that the Actor can abort itself). You don't need to configure this on your scoped token.
155
150
- If a scoped token can run an Actor, it gets **write access to default storages of the runs it triggered**. Moreover, it gets **read access to default storages of _all_ runs of that Actor**. If this is not desirable, change your Actor to output data into an existing named storage, or have it create a new storage.
156
-
-**We currently do not allow scoped tokens to create or modify Actors**. If you do need to create or modify Actors via Apify API, use an unscoped token.
0 commit comments