Skip to content
Merged
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
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ All notable changes to the Rust Apify API client are documented here. The format
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project adheres
to [Semantic Versioning](https://semver.org/).

## [0.19.0] - 2026-12-03

### Added
- `StoreCollectionClient::search` with `StoreSearchOptions` and `StoreSearchResult`. It sends one
request and returns the Actors that match a query best, at most 100, with the `limit` the API
applied. An empty `search` is an `InvalidArgument` error.
- `TaskClient::call` redirects the log of the run while it waits, like `ActorClient::call`.
`TaskCallOptions` has the new `log` option.
- `StreamedLog::last_redirected_at` and `StreamedLogOptions::since`.

### Changed
- **Breaking:** `StoreListOptions` loses `search`, `sort_by`, and `allows_agentic_users`. Use
`StoreCollectionClient::search` to search. The API ignores `sort_by`, so a listing comes in Store
order and a search comes by relevance. The API dropped `allowsAgenticUsers` from the spec.
- **Breaking:** `TaskClient::call` takes `TaskCallOptions { start, wait_secs, log }` instead of
`TaskStartOptions` and `wait_secs`. It now redirects the log to the standard output by default;
pass `LogRedirect::Disabled` to opt out.
- **Breaking:** `StreamedLogOptions::from_start` is replaced by `since`, an
`Option<DateTime<Utc>>`. Use `since: None` for the whole log.
- A log stream that is cut off while the run is still going is reopened, and the redirection
resumes after the last redirected message.
- Documented that the signature of `DatasetClient::create_items_public_url`,
`create_items_public_url_with_format`, and `KeyValueStoreClient::create_keys_public_url` grants
access to all items or all keys until it expires, and that the list options of an items URL are
not covered by it.
- `ActorVersionCollectionClient::create` and `ActorVersionClient::update` use the `Long` timeout
tier by default, since a version can carry its source files.
- Synced with Apify OpenAPI spec `v2-2026-12-02T102104Z` (`API_SPEC_VERSION`). It documents that
the build OpenAPI definition needs a token unless the Actor is public or the build owner allows
anyone with the ID to read it, and removes agentic payments.

## [0.18.0] - 2026-11-20

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apify-client"
version = "0.18.0"
version = "0.19.0"
authors = ["Apify Technologies <support@apify.com>"]
description = "Rust client for the Apify API (https://apify.com)."
license = "Apache-2.0"
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ It provides a resource-oriented, async interface that follows the

```toml
[dependencies]
apify-client = "0.18"
apify-client = "0.19"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde_json = "1" # for the `serde_json::Value` responses used in the Quick start
```
Expand All @@ -32,7 +32,8 @@ project needs `serde_json`. Two more dependencies are needed only for specific f
`stream_with_options()`); it provides the `StreamExt` trait used to poll the returned stream.
The [`raw_log`](examples/raw_log.rs) example imports `futures_util::StreamExt` for this. See
[`docs/misc.md`](docs/misc.md#logs--clientlogbuild_or_run_id). Log redirection
(`ActorClient::call`, `RunClient::get_streamed_log`) needs no extra dependency.
(`ActorClient::call`, `TaskClient::call`, `RunClient::get_streamed_log`) needs no extra
dependency.
- `chrono = "0.4"` — only if you construct or read timestamp values yourself. Model timestamp
fields (e.g. `Actor::created_at`, `ActorRun::started_at`) are typed as `Option<chrono::DateTime<Utc>>`
and `chrono` is **not** re-exported, so snippets that call `chrono::Utc::now()` (e.g. the
Expand All @@ -49,7 +50,7 @@ instead, disable the default features and name `rustls`. The `"zstd"` entry keep
so drop it if you do not need it:

```toml
apify-client = { version = "0.18", default-features = false, features = ["rustls", "zstd"] }
apify-client = { version = "0.19", default-features = false, features = ["rustls", "zstd"] }
```

The `rustls` feature requires `rustls-webpki` 0.103.16 or newer and `webpki-roots` 1.0.10 or
Expand Down Expand Up @@ -215,7 +216,7 @@ rest pass through). `isAtHome` reflects the `APIFY_IS_AT_HOME` environment varia
| `client.schedules()` / `client.schedule(id)` | collection / single | Schedules |
| `client.webhooks()` / `client.webhook(id)` | collection / single | Webhooks |
| `client.webhook_dispatches()` / `client.webhook_dispatch(id)` | collection / single | Webhook dispatches |
| `client.store()` | collection | Browse the Apify Store |
| `client.store()` | collection | Browse and search the Apify Store |
| `client.me()` / `client.user(id)` | single | User accounts |
| `client.log(build_or_run_id)` | single | Build/run logs |

Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Add the crate and an async runtime:

```toml
[dependencies]
apify-client = "0.18"
apify-client = "0.19"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```

Expand Down Expand Up @@ -75,12 +75,12 @@ root, so you can import them directly from `apify_client` — you never need the
`apify_client::clients::<module>::<Type>` path. The complete set of re-exported option/parameter
types is:

- Actors: `ActorStartOptions`, `ActorCallOptions`, `TaskStartOptions`, `ActorBuildOptions`, `ActorListOptions`, `WaitForResources`
- Actors: `ActorStartOptions`, `ActorCallOptions`, `TaskStartOptions`, `TaskCallOptions`, `ActorBuildOptions`, `ActorListOptions`, `WaitForResources`
- Runs: `RunListOptions`, `RunResurrectOptions`, `RunMetamorphOptions`, `RunChargeOptions`, `LastRunOptions`
- Datasets: `DatasetListItemsOptions`, `DatasetDownloadOptions`, `DownloadItemsFormat`
- Key-value stores: `ListKeysOptions`, `GetRecordOptions`, `SetRecordOptions`
- Request queues: `ListRequestsOptions`, `BatchAddRequestsOptions`
- Store: `StoreListOptions`
- Store: `StoreListOptions`, `StoreSearchOptions`, `StoreSearchResult`
- Logs: `LogOptions`, `LogRedirect`, `LogSink`, `StdoutLogSink`, `StreamedLog`, `StreamedLogOptions`
- Shared: `ListOptions`, `StorageListOptions`, `Timeout`
- Server Actors: `ActorServerRequestOptions`, `ActorServerBody`, `ActorServerCompression`
Expand Down
9 changes: 5 additions & 4 deletions docs/actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ be an Actor ID or a `username~name` (or `username/name`) reference.

All fields are optional. Used by `start` and `start_raw`, and as `ActorCallOptions::start` by
`call` and `call_raw` (there, `wait_for_finish` is server-side; `ActorCallOptions::wait_secs`
controls client-side polling). [Tasks](tasks.md) take `TaskStartOptions`, which has the same
fields except `content_type` and `force_permission_level`, because `POST /actor-tasks/{id}/runs`
documents neither.
controls client-side polling). [Tasks](tasks.md) take `TaskStartOptions` (inside
`TaskCallOptions` for `call`), which has the same fields except `content_type` and
`force_permission_level`, because `POST /actor-tasks/{id}/runs` documents neither.

| Field | Type | Description |
|---|---|---|
Expand Down Expand Up @@ -407,4 +407,5 @@ when it is `None`.
Creating a version needs `versionNumber` and `sourceType` in the body, and so does every item of
the `versions` array in an Actor create or update body. The writable source types are
`SOURCE_FILES`, `GIT_REPO`, `TARBALL` and `GITHUB_GIST`; `SOURCE_CODE` can be read but not sent.
Updating a version needs no required field.
Updating a version needs no required field. `create` and `update` use the `Long` timeout tier by
default, since a version can carry its source files; set another one with `with_timeout`.
2 changes: 1 addition & 1 deletion docs/builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ collections are available via `actor.builds()`.
| `abort()` | — | `Build` | Aborts the build. |
| `delete()` | — | `()` | Deletes the build. |
| `wait_for_finish(wait_secs)` | `Option<i64>` | `Build` | Polls until the build is terminal. `None` waits indefinitely, without a client-side timeout on the polls; `Some(n)` bounds the wait and gives each poll the `Medium` tier plus the hold it asks the API for. A timeout set with `with_timeout` replaces both. A build ID that keeps 404ing past a 3-second grace period (reset by any successful fetch) returns the `404` as an error instead of polling forever. |
| `get_openapi_definition()` | — | `serde_json::Value` | Fetches the OpenAPI definition generated for the build (raw JSON, endpoint `.../openapi.json`). A `404` is an error. |
| `get_openapi_definition()` | — | `serde_json::Value` | Fetches the OpenAPI definition generated for the build (raw JSON, endpoint `.../openapi.json`). A `404` is an error. No token is needed for a build of a public Actor, or one whose owner set the general resource access to `Anyone with ID can read`; otherwise the token must have access to the build. |
| `log()` | — | `LogClient` | Access the build's log. |

The returned `Build` model's fields (`id`, `status`, `build_number`, …) are documented in
Expand Down
50 changes: 44 additions & 6 deletions docs/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,51 @@

| Method | Arguments | Returns | Description |
|---|---|---|---|
| `list(options)` | `StoreListOptions` | `PaginationList<ActorStoreListItem>` | One page of Store Actors. |
| `iterate(options)` | `StoreListOptions` | `StoreActorIterator` | Lazy, page-fetching iterator. |
| `list(options)` | `StoreListOptions` | `PaginationList<ActorStoreListItem>` | One page of Store Actors, in Store order. |
| `iterate(options)` | `StoreListOptions` | `StoreActorIterator` | Lazy, page-fetching iterator over the Store listing. |
| `search(options)` | `StoreSearchOptions` | `StoreSearchResult` | The Actors that match a query best, as a single page. |

`StoreListOptions`: `offset`, `limit`, `search`, `sort_by`, `category`, `username`,
`pricing_model`, `include_unrunnable_actors`, `allows_agentic_users`, `response_format`.
The API serves the Store in two ways, and the client has a method for each. `list` and `iterate`
browse the whole Store. `search` finds Actors by a text query.

`StoreListOptions`: `offset`, `limit`, `category`, `username`, `pricing_model`,
`include_unrunnable_actors`, `response_format`, `include_input_schema`.
`limit` means a single page's size for `list`, but a cap on the *total* number of
items yielded for `iterate` (see below).
items yielded for `iterate` (see below). A page has at most 1000 items, or 10 with
`include_input_schema`. The API has no option to change the order of a listing, which is the
Store order: sort the results on the client if you need a different one. `category` takes one or
more category IDs separated by commas, such as `AI_AND_ML`; an Actor must match all of them, and an
unknown category makes the API answer with a `400` error.

`StoreSearchOptions`: a required, non-empty `search`, and `limit`, `category`, `username`,
`pricing_model`, `include_unrunnable_actors`, `response_format`, `include_input_schema`. There is no
`offset`. An empty `search` fails with `ApifyClientError::InvalidArgument`, because the API answers
it with the Store listing.

The API ranks the results of a search by relevance and returns them as a single page of at most
100 Actors, so a larger `limit` is reduced to 100. It ignores `offset`, and it reports the number
of Actors it returned as `total`, not the number of Actors that match. A search therefore can't be
paged through, and `search` has no iterator. `StoreSearchResult` has `items` and `limit`, the
limit the API applied. When `items.len()` equals it, more Actors may match than were returned:
narrow the search with a more specific query or with the filters.

```rust,no_run
# use apify_client::{ApifyClient, StoreSearchOptions};
# async fn run(client: ApifyClient) -> Result<(), Box<dyn std::error::Error>> {
let result = client
.store()
.search(StoreSearchOptions {
search: "instagram posts".to_string(),
limit: Some(10),
..Default::default()
})
.await?;
for actor in result.items {
println!("{}: {:?}", actor.id, actor.title.or(actor.name));
}
# Ok(())
# }
```

`StoreActorIterator` is a type alias for `ListIterator<ActorStoreListItem>` (the shared iterator
returned by every collection's `iterate`), re-exported at the crate root alongside `ListIterator`
Expand Down Expand Up @@ -50,7 +88,7 @@ while let Some(actor) = iter.next().await? {
# }
```

`ActorStoreListItem` (from `apify_client::models`) is the element type yielded by both `list`
`ActorStoreListItem` (from `apify_client::models`) is the element type yielded by `list`, `search`
and the iterator. Its fields:

| Field | Type | Description |
Expand Down
22 changes: 14 additions & 8 deletions docs/runs.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ collections are available via `actor.runs()` and `task.runs()`.
| `charge(options)` | `RunChargeOptions` | `()` | Charges a pay-per-event run (always sends an idempotency key). |
| `wait_for_finish(wait_secs)` | `Option<i64>` | `ActorRun` | Polls until the run is terminal. `None` waits indefinitely, without a client-side timeout on the polls; `Some(n)` bounds the wait, gives each poll the `Medium` tier plus the hold it asks the API for, and may return a still-running (non-terminal) run if `n` elapses first. A timeout set with `with_timeout` replaces both. A run ID that keeps 404ing past a 3-second grace period (reset by any successful fetch) returns the `404` as an error instead of polling forever. |
| `dataset()` / `key_value_store()` / `request_queue()` / `log()` | — | resource client | Access the run's default storages and log. |
| `get_streamed_log(options)` | `StreamedLogOptions { to_log, from_start }` | `Result<Option<StreamedLog>>` (async — `.await` it) | The [redirection](#log-redirection) of the run's log; `None` if `to_log` is `LogRedirect::Disabled`, or, for `LogRedirect::Default`, if the run does not exist. A custom sink makes no request, so a missing run shows up as the error of `stop()`. |
| `get_streamed_log(options)` | `StreamedLogOptions { to_log, since }` | `Result<Option<StreamedLog>>` (async — `.await` it) | The [redirection](#log-redirection) of the run's log; `None` if `to_log` is `LogRedirect::Disabled`, or, for `LogRedirect::Default`, if the run does not exist. A custom sink makes no request, so a missing run shows up as the error of `stop()`. |

### Log redirection

Expand All @@ -42,12 +42,18 @@ stays in one piece, and each message goes to a `LogSink`:
a logging framework.
- `LogRedirect::Disabled` redirects nothing.

`from_start: false` drops the messages stamped before the call. A run that has not logged yet is
followed by reopening its empty log stream until the first bytes arrive. `ActorClient::call` does
all of this for the run it waits for; when the redirection ends early on an error, it passes a
`Log redirection stopped due to error: ..` message to the sink instead of failing the call. To
read the log as raw chunks instead, use `run.log().stream_with_options(..)`; the
[`raw_log`](../examples/raw_log.rs) example does.
`since` drops the messages stamped before it. `StreamedLog::last_redirected_at()` returns the
timestamp of the last redirected message, so a redirection that was interrupted can continue with
`since` set to that timestamp plus one millisecond. A run that has not logged yet is followed by
reopening its empty log stream until the first bytes arrive. A stream that is cut off while the
run goes on, for example after the run has logged nothing for several minutes, is reopened and
the redirection resumes after the last redirected message. The API cannot continue a stream from a
given point, so the reopen downloads the whole log again, and the lines of a message that arrive
only after the break (for example the rest of a stack trace) are not redirected.
`ActorClient::call` and `TaskClient::call` do all of this for the run they wait for. When the
redirection ends early on an error, they pass a `Log redirection stopped due to error: ..` message
to the sink instead of failing the call. To read the log as raw chunks instead, use
`run.log().stream_with_options(..)`; the [`raw_log`](../examples/raw_log.rs) example does.

```rust,no_run
use apify_client::{ApifyClient, LogRedirect, StreamedLogOptions};
Expand All @@ -57,7 +63,7 @@ let run = client.run(run_id);
let mut streamed_log = run
.get_streamed_log(StreamedLogOptions {
to_log: LogRedirect::to_sink(|message: &str| println!("run -> {message}")),
from_start: true,
since: None,
})
.await?
.ok_or("the run does not exist")?;
Expand Down
4 changes: 2 additions & 2 deletions docs/storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ let scratch = client.datasets().get_or_create(None).await?;
| `get_statistics()` | — | `Value` | Field statistics. A `404` is an error. |
| `download_items(format, options)` | `DownloadItemsFormat`, `DatasetDownloadOptions` | `Vec<u8>` | Export items as JSON/JSONL/CSV/XLSX/XML/RSS/HTML. |
| `download_items_stream(format, options)` | `DownloadItemsFormat`, `DatasetDownloadOptions` | `Result<impl Stream<Item = Result<Vec<u8>>>>` (async — `.await` it) | Like `download_items`, but streams the export instead of buffering it, for constant-memory processing of a large export. |
| `create_items_public_url(options, expires)` | `DatasetListItemsOptions`, `Option<i64>` | `String` | Shareable (HMAC-signed for private) items URL, served as `json`. `expires` is the validity of the signed URL in seconds and must be positive and at most `common::MAX_EXPIRES_IN_SECS` (4611686018427387, about 146 million years): `0`, a negative or a larger value fails with `InvalidArgument`. Leave it out for a URL that does not expire. |
| `create_items_public_url(options, expires)` | `DatasetListItemsOptions`, `Option<i64>` | `String` | Shareable (HMAC-signed for private) items URL, served as `json`. The signature grants read access to all items until it expires. The list options are plain query parameters that it does not cover, so they only set the default shape of the response: anyone holding the URL can change or remove them. `expires` is the validity of the signed URL in seconds and must be positive and at most `common::MAX_EXPIRES_IN_SECS` (4611686018427387, about 146 million years): `0`, a negative or a larger value fails with `InvalidArgument`. Leave it out for a URL that does not expire. |
| `create_items_public_url_with_format(options, expires, format)` | `DatasetListItemsOptions`, `Option<i64>`, `Option<DownloadItemsFormat>` | `String` | Like `create_items_public_url`, but lets the URL serve another export format (CSV, XLSX, ...). `None` defaults to `json`. `expires` follows the same rule as in `create_items_public_url`. |

`DatasetListItemsOptions` (all optional):
Expand Down Expand Up @@ -164,7 +164,7 @@ println!("streamed {total_bytes} bytes of JSONL");
| `delete_record(key)` | `&str` | `()` | Deletes a record. |
| `get_record_with_options(key, options)` | `&str`, `GetRecordOptions { attachment, signature }` | `Option<KeyValueStoreRecord>` | Reads a record with explicit attachment/signature options. |
| `get_record_public_url(key)` | `&str` | `String` | Shareable (HMAC-signed for private) record URL. |
| `create_keys_public_url(expires)` | `Option<i64>` | `String` | Shareable keys-list URL. `expires` is the validity of the signed URL in seconds and must be positive and at most `common::MAX_EXPIRES_IN_SECS` (4611686018427387, about 146 million years): `0`, a negative or a larger value fails with `InvalidArgument`. Leave it out for a URL that does not expire. |
| `create_keys_public_url(expires)` | `Option<i64>` | `String` | Shareable keys-list URL. The signature grants access to the list of all keys until it expires. `expires` is the validity of the signed URL in seconds and must be positive and at most `common::MAX_EXPIRES_IN_SECS` (4611686018427387, about 146 million years): `0`, a negative or a larger value fails with `InvalidArgument`. Leave it out for a URL that does not expire. |

`ListKeysOptions`: `limit`, `exclusive_start_key`, `prefix`, `collection`, `signature`. Like
`StoreListOptions.limit`, the meaning of `limit` depends on the method: for `list_keys` it is a
Expand Down
Loading
Loading