Example Counter
Pricing
Pay per usage
Example Counter
This actor simply counts up from one. In each run it prints one number. Its state (counter position) is stored in a named key-value store called example-counter.
Pricing
Pay per usage
Rating
4.6
(3)
Developer
Apify
Maintained by ApifyActor stats
5
Bookmarked
16
Total users
0
Monthly active users
15 days ago
Last modified
Categories
Share
example-counter
A minimal actor that demonstrates persistent state across runs using a Key-Value Store.
Each run reads a counter, increments it (by incrementBy, default 1), and writes it back. The counter starts at 0 on the very first run and keeps climbing across subsequent runs.
Input
| Field | Type | Default | Description |
|---|---|---|---|
counterStore | KVS resource | — | Key-value store to persist the counter. Required under limited permissions — pick an existing store so the run token is granted access. |
incrementBy | integer | 1 | How much to add to the counter each run |
Output
Results are saved to the dataset and to OUTPUT in the default Key-Value Store:
{ "counter": 5, "previousValue": 4, "incrementBy": 1 }
Storage and permissions
With full permissions: the actor opens (or creates) a named store called example-counter automatically.
With limited permissions: provide a store via the counterStore input picker. The platform expands the run token to allow read/write on that specific store, and the counter persists across all subsequent runs that use the same store.


