diff --git a/CHANGELOG.md b/CHANGELOG.md
index b2e0c02..997227a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,42 @@ All notable changes to the Apify Java client are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.15.0] - 2026-12-03
+
+### Added
+
+- `StoreCollectionClient.search`, with `StoreSearchOptions` and `StoreSearchResult`, for a Store search. It sends one request and completes with the Actors and the limit the API applied.
+- `StoreFilterOptions`, the filters that `StoreListOptions` and `StoreSearchOptions` share.
+- `StreamedLogOptions.since` and `StreamedLog.getLastRedirectedAt`, to redirect only the log lines from a given time and to continue a redirection later.
+- `StoreActorStats`, the statistics of a Store Actor: `totalUsers`, `totalRuns`, `totalUsers7Days`, `totalUsers30Days`, `totalUsers90Days`, `actorReviewRating`, and `actorReviewCount`.
+- `ActorStoreListItem` getters for `userFullName`, `categories`, `notice`, `isVerified`, and `badge`.
+- `KeyValueStoreClient.setRecord` overloads that take an `InputStream`. The stream is sent without being held in memory, and the upload is not retried or compressed. Like a request to an Actor's server, it needs an `HttpTransport` that can disable redirects.
+- `KeyValueStoreClient.getRecordStream` and `KeyValueStoreRecordStream`, which read a record as an `InputStream`. The request is retried like any other.
+- `InputStream` as the input of `ActorClient.start`, `ActorClient.call`, `TaskClient.start`, and `TaskClient.call`, and as the body of `ActorServerClient.request` and `requestStream`. A stream is sent once, with no retry, and needs an `HttpTransport` that can disable redirects.
+- `APIFY_AI` run origin.
+
+### Changed
+
+- Updated to Apify OpenAPI specification `v2-2026-12-02T102104Z`.
+- **Breaking:** `ActorStoreListItem.getStats()` returns `StoreActorStats` instead of `ActorStats`. The Store no longer returns `totalBuilds`, `totalMetamorphs`, and `lastRunStartedAt`.
+- **Breaking:** the `StoreListOptions` filter setters (`category`, `username`, `pricingModel`, `includeUnrunnableActors`, `responseFormat`, `includeInputSchema`) now come from `StoreFilterOptions`. Code compiled against 0.14.x must be recompiled.
+- **Breaking:** `StreamedLog` takes `since` instead of `fromStart`: `new StreamedLog(logClient, destination, since)`.
+- A `StreamedLog` reopens a log stream that is cut off while the run is still going and continues after the last redirected message.
+- `StoreListOptions.category` takes comma-separated category IDs.
+- `LogClient.stream` and `DatasetClient.streamItems` retry the request like any other, until the response headers arrive.
+- `ActorVersionCollectionClient.create` and `ActorVersionClient.update` use the long timeout tier, since a version can carry its source files.
+- Documented that creating an Actor with a name you already use fails with a `ConflictError` (`actor-name-not-unique`).
+- Documented that the build OpenAPI definition needs an API token with access to the build, unless the Actor is public or the build's owner allows anyone with the ID to read.
+- Documented that a public storage URL grants read access to the whole storage, and that its options do not limit it.
+- `ActorClient.validateInput` and `RunClient.metamorph` throw `IllegalArgumentException` for an `InputStream` input, instead of serializing it to JSON.
+
+### Removed
+
+- **Breaking:** `StoreListOptions.search`. Use `StoreCollectionClient.search`: the Store answers a search with one page of at most 100 Actors and ignores `offset`.
+- **Breaking:** `StoreListOptions.sortBy`, which the API ignores.
+- **Breaking:** `StreamedLogOptions.fromStart`. Use `StreamedLogOptions.since`: `fromStart(false)` becomes `since(Instant.now())`, and `fromStart(true)` is the default.
+- **Breaking:** `StoreListOptions.allowsAgenticUsers` and `ActorStoreListItem.getIsWhiteListedForAgenticPayments`, which the API no longer has.
+
## [0.14.1] - 2026-11-20
### Changed
diff --git a/README.md b/README.md
index 5b0f45f..b10aa2f 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ Maven (Maven Central is a default repository, so no extra configuration is neede
com.apifyapify-client
- 0.14.1
+ 0.15.0
```
@@ -35,7 +35,7 @@ repositories {
}
dependencies {
- implementation 'com.apify:apify-client:0.14.1'
+ implementation 'com.apify:apify-client:0.15.0'
}
```
@@ -308,15 +308,16 @@ both non-blocking. `HttpRequest` and `HttpResponse` below are the JDK's `java
| Method | Signature | Contract |
|---|---|---|
-| `sendAsync` | `CompletableFuture> sendAsync(HttpRequest request)` | Sends the single, fully-prepared request (auth, `User-Agent` and any other headers are already set by the client) and completes the future with the response with its body fully buffered as `byte[]`. Used for every non-streaming call. |
-| `sendStreamingAsync` | `CompletableFuture> sendStreamingAsync(HttpRequest request)` | Sends the request and completes the future with the response body as a live `InputStream` for incremental consumption, used by log streaming (`LogClient.stream(...)`) and dataset export streaming (`DatasetClient.streamItems(...)`). The *caller* (the client) is responsible for closing the returned stream; an implementation must not close it itself before completing the future. |
+| `sendAsync` | `CompletableFuture> sendAsync(HttpRequest request)` | Sends the single, fully-prepared request (auth, `User-Agent` and any other headers are already set by the client) and completes the future with the response with its body fully buffered as `byte[]`. Used for every non-streaming call that follows redirects. |
+| `sendStreamingAsync` | `CompletableFuture> sendStreamingAsync(HttpRequest request)` | Sends the request and completes the future with the response body as a live `InputStream` for incremental consumption, used by log streaming (`LogClient.stream(...)`), dataset export streaming (`DatasetClient.streamItems(...)`), and record streaming (`KeyValueStoreClient.getRecordStream(...)`). The *caller* (the client) is responsible for closing the returned stream; an implementation must not close it itself before completing the future. |
Two further methods, `sendAsync(HttpRequest, boolean followRedirects)` and
`sendStreamingAsync(HttpRequest, boolean followRedirects)`, have default implementations that send
the request through the methods above when `followRedirects` is `true` and **fail** the future with an
`UnsupportedOperationException` when it is `false`. A request to an Actor's server (see
-[Server Actors](docs/actors.md#server-actors)) is sent with `followRedirects` set to `false`, so
-that the API token never follows a redirect to another host. Override both to support it: with
+[Server Actors](docs/actors.md#server-actors)) and a request whose body is an `InputStream` are sent
+with `followRedirects` set to `false`, so that the API token never follows a redirect to another
+host and a stream is never sent twice. Override both to support it: with
`false`, return a redirect response as it is. `DefaultHttpTransport` does, also when it wraps your own
JDK `HttpClient` (it then copies the client's settings into one that does not follow redirects).
@@ -437,10 +438,10 @@ try {
The public `com.apify.client.Version` class (`import com.apify.client.Version;`) exposes two
constants:
-- `Version.CLIENT_VERSION`: the semantic version of this client (`0.14.1`).
+- `Version.CLIENT_VERSION`: the semantic version of this client (`0.15.0`).
- `Version.API_SPEC_VERSION`: the version of the [Apify OpenAPI specification](https://docs.apify.com/api/openapi.json)
(its `info.version` field) that this client's endpoints, parameters, and models were last generated
- and checked against (`v2-2026-11-18T151559Z`). It is a snapshot, not a live compatibility
+ and checked against (`v2-2026-12-02T102104Z`). It is a snapshot, not a live compatibility
guarantee: the client keeps working against newer, backward-compatible spec revisions, but a
feature added to the API after this snapshot has no corresponding method here yet.
diff --git a/docs/README.md b/docs/README.md
index 703a7fb..c92c5f2 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -48,13 +48,13 @@ option types, so import each resource you use from its own package:
| `com.apify.client.build` | `Build`, `BuildClient`, `BuildCollectionClient`, `BuildActVersion`, `ActorDefinition`, `ActorDefinitionMeta`, `ActorDefinitionStorages`, `BuildMeta`, `BuildStats`, `BuildOptions`, `BuildUsage` |
| `com.apify.client.run` | `ActorRun`, `ActorRunStats`, `ActorRunOptions`, `ActorRunMeta`, `ActorRunStandby`, `ActorRunUsage`, `RunClient`, `RunCollectionClient`, `RunListOptions`, `LastRunOptions`, `MetamorphOptions`, `RunChargeOptions`, `RunResurrectOptions`, `SetStatusMessageOptions` |
| `com.apify.client.dataset` | `Dataset`, `DatasetClient`, `DatasetCollectionClient`, `DatasetListItemsOptions`, `DatasetDownloadOptions`, `DownloadItemsFormat` |
-| `com.apify.client.keyvalue` | `KeyValueStore`, `KeyValueStoreClient`, `KeyValueStoreCollectionClient`, `KeyValueStoreRecord`, `KeyValueStoreKeysPage`, `KeyValueStoreKey`, `GetRecordOptions`, `SetRecordOptions`, `ListKeysOptions` |
+| `com.apify.client.keyvalue` | `KeyValueStore`, `KeyValueStoreClient`, `KeyValueStoreCollectionClient`, `KeyValueStoreRecord`, `KeyValueStoreRecordStream`, `KeyValueStoreKeysPage`, `KeyValueStoreKey`, `GetRecordOptions`, `SetRecordOptions`, `ListKeysOptions` |
| `com.apify.client.requestqueue` | `RequestQueue`, `RequestQueueClient`, `RequestQueueCollectionClient`, `RequestQueueRequest`, `RequestQueueHead`, `LockedRequestQueueHead`, `RequestQueueOperationInfo`, `RequestLockInfo`, `UnlockRequestsResult`, `RequestsList`, `BatchAddResult`, `BatchDeleteResult`, `DeletedRequestInfo`, `ListRequestsOptions`, `BatchAddRequestsOptions` |
| `com.apify.client.task` | `Task`, `TaskStats`, `TaskOptions`, `TaskClient`, `TaskCollectionClient`, `TaskStartOptions`, `TaskCallOptions` |
| `com.apify.client.schedule` | `Schedule`, `ScheduleNotifications`, `ScheduleClient`, `ScheduleCollectionClient` |
| `com.apify.client.webhook` | `Webhook`, `WebhookStats`, `WebhookLastDispatch`, `WebhookClient`, `WebhookCollectionClient`, `WebhookDispatchCollectionClient`, `NestedWebhookCollectionClient`, `WebhookDispatch`, `WebhookDispatchClient`, `WebhookDispatchCall`, `WebhookDispatchWebhookInfo`, `WebhookDispatchEventData` |
| `com.apify.client.user` | `User`, `UserClient`, `UserProfile`, `UserProxy`, `UserPlan`, `ProxyGroup` |
-| `com.apify.client.store` | `ActorStoreListItem`, `StoreCollectionClient`, `StoreListOptions`, `PricingInfo` |
+| `com.apify.client.store` | `ActorStoreListItem`, `StoreActorStats`, `StoreCollectionClient`, `StoreFilterOptions`, `StoreListOptions`, `StoreSearchOptions`, `StoreSearchResult`, `PricingInfo` |
| `com.apify.client.log` | `LogClient`, `LogOptions`, `StreamedLog`, `StreamedLogOptions` |
For example, the [top-level README's dataset snippet](../README.md#quick-start) needs
diff --git a/docs/actors.md b/docs/actors.md
index f98c38e..938e4e0 100644
--- a/docs/actors.md
+++ b/docs/actors.md
@@ -9,7 +9,7 @@ where `id` is an Actor ID or `username~name` (a `/` in the id is accepted and no
|---|---|
| `list(ActorListOptions)` | List the account's Actors. Completes with `PaginationList`. |
| `iterate(ActorListOptions, Long chunkSize)` | Lazy `Flow.Publisher` over all matches; the options' `limit` caps the total yielded (`null`/unset or non-positive = all), `chunkSize` sets the page size (`null` = server default). |
-| `create(Object)` | Create a new Actor from a JSON-serializable definition. Completes with `Actor`. |
+| `create(Object)` | Create a new Actor from a JSON-serializable definition. Completes with `Actor`. Fails with a `ConflictError` (409, `actor-name-not-unique`) if you already have an Actor with that name. |
`ActorListOptions` adds `my(Boolean)` (only Actors owned by the current user) and
`sortBy(String)` (e.g. `createdAt`, `stats.lastRunStartedAt`) on top of the standard offset/limit/desc.
@@ -46,7 +46,7 @@ Actor created = client.actors().create(Map.of(
| `get()` | Fetch the Actor. Completes with `Optional`. |
| `update(Object)` | Update the Actor with the given fields. Completes with `Actor`. |
| `delete()` | Delete the Actor. |
-| `start(Object input, ActorStartOptions)` | Start a run, returning immediately. Completes with `ActorRun`. The `input` is any JSON-serializable value, or a `byte[]`/`String` that is sent as it is (set the matching `ActorStartOptions.contentType(...)`), or `null`. |
+| `start(Object input, ActorStartOptions)` | Start a run, returning immediately. Completes with `ActorRun`. The `input` is any JSON-serializable value, or a `byte[]`, `String`, or `InputStream` that is sent as it is (set the matching `ActorStartOptions.contentType(...)`), or `null`. A stream is read once, so its start is sent once: it is not retried, even with `waitForResources`. |
| `call(Object input, ActorStartOptions, Long waitSecs)` | Start a run and poll until it finishes (`null` waits indefinitely); does **not** stream the run's log. Completes with `ActorRun`. |
| `call(Object input, ActorCallOptions, Long waitSecs)` | As above, additionally streaming the run's log for the duration of the wait by default. Use `ActorCallOptions.disableLogStreaming()` to opt out, or `logOptions(StreamedLogOptions)` for a custom destination. |
| `validateInput(Object input)` / `validateInput(Object input, ValidateInputOptions)` | Validate an input against the Actor's input schema. Completes with `boolean`. `ValidateInputOptions` fields (optional): `build` (`String`), `contentType` (`String`). |
@@ -131,8 +131,9 @@ Actor's `standbyUrl` and `actorStandby` fields.
`ActorServerRequestOptions` fields (all optional): `method(String)` (`GET` by default; also `HEAD`,
`POST`, `PUT`, `DELETE`, `OPTIONS`, `TRACE`, `PATCH`), `param(String, Object)`/`params(Map)` (query
parameters, converted as for API calls: `null` is left out, a boolean is sent as `1`/`0`, a
-collection comma-joined), `header(String, String)`/`headers(Map)`, `body(Object)` (a `byte[]` or
-`String` is sent as it is; anything else is serialized to JSON and sent as `application/json`
+collection comma-joined), `header(String, String)`/`headers(Map)`, `body(Object)` (a `byte[]`,
+`String`, or `InputStream` is sent as it is, and a stream is sent once, with no retry, no
+compression, and no redirect followed; anything else is serialized to JSON and sent as `application/json`
unless you set a `Content-Type` header), `parentRequestId(String)` (see
[Calling a Server Actor from a Server Actor](#calling-a-server-actor-from-a-server-actor)),
`compression(HttpCompressor)` and `timeout(Timeout)`
@@ -232,14 +233,14 @@ and deletes a single version and exposes its environment variables.
|---|---|
| `list(ListOptions)` | List the Actor's versions. Completes with `PaginationList`. The endpoint takes no query parameters; `options` (`offset`/`limit`/`desc`) is accepted only for signature consistency with every other `list(ListOptions)` and has no effect; pass `null`. |
| `iterate(ListOptions)` | Lazy `Flow.Publisher` over all versions; `limit` caps the total (`null`/unset or non-positive = all), applied client-side after the single fetch. `offset` has no effect and there is no page size to tune. |
-| `create(Object version)` | Create a version. Completes with `ActorVersion`. |
+| `create(Object version)` | Create a version. Completes with `ActorVersion`. Uses the long timeout tier, since the version can carry its source files. |
### `ActorVersionClient`: `client.actor(id).version(v)`
| Method | Description |
|---|---|
| `get()` | Fetch the version. Completes with `Optional`. |
-| `update(Object)` | Update the version. Completes with `ActorVersion`. |
+| `update(Object)` | Update the version. Completes with `ActorVersion`. Uses the long timeout tier, since the version can carry its source files. |
| `delete()` | Delete the version. |
| `envVars()` | An `ActorEnvVarCollectionClient` for the version's environment variables. |
| `envVar(String name)` | An `ActorEnvVarClient` for a single environment variable. |
diff --git a/docs/builds.md b/docs/builds.md
index 8da32df..609e219 100644
--- a/docs/builds.md
+++ b/docs/builds.md
@@ -19,7 +19,7 @@ builds) and a single build with `client.build(id)`.
| `abort()` | Abort the build. Completes with `Build`. |
| `delete()` | Delete the build. |
| `waitForFinish(Long waitSecs)` | Poll until the build finishes (`null` waits indefinitely); see [the run equivalent](runs.md#runclient) for its 404 handling. Completes with `Build`. |
-| `getOpenApiDefinition()` | The build's OpenAPI definition. Completes with `Optional`. |
+| `getOpenApiDefinition()` | The build's OpenAPI definition. Completes with `Optional`. It needs an API token with access to the build, unless the Actor is public or the build's owner has general resource access set to "Anyone with ID can read"; otherwise the API answers `401` or `403`. |
| `log()` | A `LogClient` for the build's log. |
`Build` fields: `getId()`, `getActId()`, `getUserId()`, `getStatus()`, `getStartedAt()`,
diff --git a/docs/misc.md b/docs/misc.md
index 65450de..eca32a2 100644
--- a/docs/misc.md
+++ b/docs/misc.md
@@ -2,35 +2,67 @@
## Apify Store: `client.store()`
-Browse public Actors in the Apify Store. `client.store()` returns a `StoreCollectionClient`.
+Browse and search public Actors in Apify Store. `client.store()` returns a
+`StoreCollectionClient`. The API serves the Store in two ways, and the client has a method for each:
+`list` and `iterate` browse the whole Store in Store order, and `search` returns the Actors that
+match a query best.
| Method | Description |
|---|---|
| `list(StoreListOptions)` | A page of Store Actors. Completes with `PaginationList`. |
| `iterate(StoreListOptions, Long chunkSize)` | A lazy `Flow.Publisher` over all matches, fetching pages on demand. The options' `limit` caps the total number of rows read, which are the Actors yielded unless the API drops entries after counting them (`null`/unset or non-positive = all); `chunkSize` is the per-request page size (`null` = server default). |
+| `search(StoreSearchOptions)` | The Actors that match a query best, best match first, as a single page. Completes with `StoreSearchResult`. |
`StoreListOptions` fields: `offset` (number of Actors to skip), `limit` (maximum number of Actors to
-return), `search` (full-text search query), `sortBy` (the sort field, e.g. `popularity`, `newest`),
-`category` (filter Actors by category), `username` (filter Actors by owner username), `pricingModel`
-(filter by pricing model: `FREE`, `PRICE_PER_DATASET_ITEM`, `PAY_PER_EVENT`; the deprecated rental model
-`FLAT_PRICE_PER_MONTH` is no longer listed),
-`includeUnrunnableActors` (include Actors the current user cannot run), `allowsAgenticUsers` (only
-Actors that allow agentic users), `responseFormat` (the response shape: `full` or `agent`).
+return; the API default and maximum is 1000), and the filters below. The API has no option to change
+the Store order.
+
+`StoreSearchOptions` takes the query in its constructor, which rejects a `null` or empty query,
+since the API answers an empty query with the Store listing. Its fields are `limit` (maximum number
+of Actors to return, a positive number; the API default and maximum is 100, and it reduces a larger
+value to 100, except with `includeInputSchema`: see below) and the filters below. There is no
+`offset`: the API ignores it for a search.
+
+Filters of both options types: `category` (filter by one or more category IDs such as `AI_AND_ML`,
+comma-separated and case-insensitive; an Actor must match all of them, and an unknown category fails
+with a `400` error), `username` (filter Actors by owner username), `pricingModel` (filter by pricing
+model: `FREE`, `PRICE_PER_DATASET_ITEM`, `PAY_PER_EVENT`), `includeUnrunnableActors` (by default,
+the API leaves out Actors that are not safe to run automatically, such as Actors of developers who
+have not passed identity verification; `true` includes them), `responseFormat` (the response shape:
+`full`, the default, or `agent`, a reduced field set for LLM consumers with `id`, `title`, `name`,
+`username`, `description`, `notice`, `badge`, `categories`, and minimal `stats`, so the other
+getters of `ActorStoreListItem` return `null`), `includeInputSchema` (add each Actor's compact
+`inputSchema`; the API then defaults `limit` to 10 and rejects a larger value with a `400` error).
+
+A search returns a single page of at most 100 Actors ranked by relevance. There is no next page, and
+the API does not report how many Actors match. `StoreSearchResult` therefore has only `getItems()`
+and `getLimit()`, the limit the API applied. When `getItems().size()` equals it, more Actors may
+match than were returned, so narrow the search with a more specific query or with `category`,
+`username`, or `pricingModel`. To go through the whole Store, use `list` or `iterate`.
```java
// Publishers.collect() drains the whole publisher; fine here since `limit` already caps it.
// To stop early without fetching further pages, subscribe with your own Flow.Subscriber instead
// (request(1) at a time, cancel() once you have enough); see IterateStore.java in the examples.
List items =
- Publishers.collect(client.store().iterate(new StoreListOptions().search("crawler").limit(20L), 10L))
+ Publishers.collect(client.store().iterate(new StoreListOptions().username("apify").limit(20L), 10L))
.join();
items.forEach(item -> System.out.println(item.getUsername() + "/" + item.getName()));
+
+// A search is one page of at most 100 Actors.
+StoreSearchResult found =
+ client.store().search(new StoreSearchOptions("crawler").limit(10L)).join();
+found.getItems().forEach(item -> System.out.println(item.getUsername() + "/" + item.getName()));
```
`ActorStoreListItem` fields: `getId()`, `getName()`, `getUsername()`, `getTitle()`,
-`getDescription()`, `getStats()` (`ActorStats`; see [Actors](actors.md#actorclient)),
-`getCurrentPricingInfo()` (`PricingInfo`: `getPricingModel()`), `getPictureUrl()`,
-`getUserPictureUrl()`, `getUrl()`, `getReadmeSummary()`. Any field not covered by a typed getter is
+`getUserFullName()`, `getDescription()`, `getCategories()` (`List` of category IDs),
+`getNotice()`, `getStats()` (`StoreActorStats`: `getTotalUsers()`, `getTotalRuns()`,
+`getTotalUsers7Days()`, `getTotalUsers30Days()`, `getTotalUsers90Days()`, `getActorReviewRating()`,
+`getActorReviewCount()`), `getCurrentPricingInfo()` (`PricingInfo`: `getPricingModel()`),
+`getIsVerified()` (whether the developer has a verified
+identity), `getBadge()`, `getPictureUrl()`, `getUserPictureUrl()`, `getUrl()`,
+`getReadmeSummary()`. Any field not covered by a typed getter is
still available via the inherited `getExtra()` (see
[the docs index](README.md#model-fields-and-unmodeled-data-getextra)).
@@ -94,7 +126,7 @@ Access a build's or run's log directly, or via `client.run(id).log()` / `client.
|---|---|
| `get()` / `get(LogOptions)` | The whole log as text. Completes with `Optional` when addressed by an explicit id (`client.log(id)`); on `run.log()`/`build.log()` (no log id of its own), a 404 is ambiguous and throws `NotFoundError` instead; see [Fetching single resources](../README.md#fetching-single-resources). |
| `getAsBytes()` / `getAsBytes(LogOptions)` | As `get()`, but completes with `Optional` (the raw bytes, not decoded as text). Same 404 handling as `get()`. |
-| `stream()` / `stream(LogOptions)` | A live `InputStream` over the log (for redirection). Completes with `InputStream`; throws on any error response, including a 404. |
+| `stream()` / `stream(LogOptions)` | A live `InputStream` over the log (for redirection). Completes with `InputStream`. The request is retried like any other, until the headers arrive; it throws on an error response that is not retried, or the last one once the retries run out, including a 404. |
`LogOptions` fields: `raw(Boolean)`, `download(Boolean)`.
diff --git a/docs/runs.md b/docs/runs.md
index 1be1d08..203baa0 100644
--- a/docs/runs.md
+++ b/docs/runs.md
@@ -73,8 +73,37 @@ Actor name and run id (looked up automatically). `StreamedLogOptions` customizes
- `toLog(Consumer)`: send each complete message to your own consumer instead of the
default logger.
- `prefix(String)`: override the auto-built prefix used by the default logger.
-- `fromStart(boolean)`: when `false`, skip log lines produced before redirection started
- (default `true`).
+- `since(Instant)`: redirect only the log lines logged at that time or later (default: the whole
+ log). This can be useful for long-running Actors, such as Server Actors.
+
+If the log stream is cut off while the run is still going, for example because the run has logged
+nothing for several minutes, `StreamedLog` reopens it and continues after the last redirected
+message. The API cannot continue a log stream from a given point, so the reopened stream replays
+the whole log, and the messages already redirected are skipped.
+
+`StreamedLog.getLastRedirectedAt()` returns the timestamp of the last message redirected since the
+latest `start()` (empty before the first one); read it after `stop()` or `close()`, which deliver
+the last message. To continue a redirection in another process, for example after the Actor that
+redirects the log reboots, save it and pass it to `since`. With the saved timestamp itself,
+messages logged in the same millisecond come again, and with one millisecond added, those not
+redirected yet are dropped.
+
+```java
+RunClient runClient = client.run("RUN_ID");
+StreamedLog streamedLog = runClient.getStreamedLog().join();
+try (streamedLog) {
+ streamedLog.start().join();
+ runClient.waitForFinish(120L).join();
+}
+Instant lastRedirectedAt = streamedLog.getLastRedirectedAt().orElse(Instant.EPOCH);
+
+// Later, for example in another process, continue from that message.
+StreamedLogOptions resumedOptions = new StreamedLogOptions().since(lastRedirectedAt);
+try (StreamedLog resumed = runClient.getStreamedLog(resumedOptions).join()) {
+ resumed.start().join();
+ runClient.waitForFinish(120L).join();
+}
+```
A run that has not logged anything yet (e.g. still queued for resources, see
[`waitForResources`](actors.md#actorclient)) serves its log as a stream that ends at once;
@@ -97,7 +126,7 @@ waiting, and the reader ends once the consumer returns. `start()` throws until a
RunClient runClient = client.run("RUN_ID");
List collected = new ArrayList<>();
try (StreamedLog streamedLog =
- runClient.getStreamedLog(new StreamedLogOptions().toLog(collected::add).fromStart(true)).join()) {
+ runClient.getStreamedLog(new StreamedLogOptions().toLog(collected::add)).join()) {
streamedLog.start().join();
runClient.waitForFinish(120L).join();
}
diff --git a/docs/storages.md b/docs/storages.md
index 552dbeb..5fc8e3d 100644
--- a/docs/storages.md
+++ b/docs/storages.md
@@ -52,7 +52,7 @@ any field not covered by a typed getter above is still available via the inherit
| `iterateItems(DatasetListItemsOptions)` / `iterateItems(DatasetListItemsOptions, Long chunkSize)` | A lazy `Flow.Publisher` over all items; the options' `limit` caps the dataset *rows* read (`null`/unset or non-positive = all), the optional `chunkSize` sets the per-request page size. Dataset items have no default page limit, so without `chunkSize` the whole dataset (or all `limit` rows) is loaded in one response: pass `chunkSize` to iterate a large dataset. |
| `iterateItems(DatasetListItemsOptions, Long chunkSize, Class)` | As above, decoded into `T`. Returns `Flow.Publisher`. For typed iteration in one response, pass a `null` chunk size: `iterateItems(opts, null, T.class)`. |
| `downloadItems(DownloadItemsFormat, DatasetDownloadOptions)` | Serialized bytes. `DownloadItemsFormat` is one of `JSON`, `JSONL`, `CSV`, `XLSX`, `XML`, `RSS`, `HTML`. Completes with `byte[]`. |
-| `streamItems(DownloadItemsFormat, DatasetDownloadOptions)` | As above, but resolves to a live `InputStream` over the export instead of fully buffering it, so a large export is processed in chunks. The caller closes the stream (or reads it to the end). Throws on any error response, including a 404. |
+| `streamItems(DownloadItemsFormat, DatasetDownloadOptions)` | As above, but resolves to a live `InputStream` over the export instead of fully buffering it, so a large export is processed in chunks. The caller closes the stream (or reads it to the end). The request is retried like any other, until the headers arrive; it throws on an error response that is not retried, or the last one once the retries run out, including a 404. |
| `pushItems(Object)` | Push a single item (a `Map`, a POJO, a `JsonNode` object, ...), a list/array of items, or a `String` that already is the JSON serialization of either (sent as it is). The API accepts only an object or an array of objects, so anything else (a number, a plain string, an array of strings) throws `IllegalArgumentException` before a request is sent. A push that times out is not retried, so items cannot be stored twice. Completes with no value (`CompletableFuture`). |
| `getStatistics()` | Dataset statistics. Completes with `JsonNode`; throws `NotFoundError` if the dataset is gone (no separate "statistics absent" state). |
| `createItemsPublicUrl(DatasetListItemsOptions, Long expiresInSecs)` | A public (optionally signed) items URL, served as `json`. `expiresInSecs` must be positive and at most `4611686018427387` when set. Completes with `String`. |
@@ -115,6 +115,10 @@ request is sent. The expiry counts from the moment the URL is signed, after the
optional `format` sets the serialization the URL serves items in (default `json` when
omitted/`null`).
+A public URL grants read access to the whole dataset (or, for `createKeysPublicUrl`, the full key
+list) until it expires. The signature covers only the storage ID and the expiry: the options only
+set the default shape of the response, and anyone holding the URL can change or drop them.
+
> **Public-URL limitation.** The public-URL builders
> (`createItemsPublicUrl`, and the key-value-store `getRecordPublicUrl` / `createKeysPublicUrl`)
> build the URL from the client's own resource path plus the signature. When called on a *last-run
@@ -142,6 +146,8 @@ datasets.
| `getRecord(String key)` / `getRecord(String key, GetRecordOptions)` | Fetch a record. Completes with `Optional`. |
| `setRecord(String key, byte[] value, String contentType)` | Store raw bytes. Completes with no value (`CompletableFuture`). |
| `setRecord(String key, byte[] value, String contentType, SetRecordOptions)` | Store raw bytes with write options (`SetRecordOptions`: `timeoutSecs` (`Long`) or `timeout` (`Timeout`: a tier, an exact duration or `NO_TIMEOUT`; the default is the `LONG` tier), `doNotRetryTimeouts` (`Boolean`), `contentEncoding` (`String`, see below)). Completes with no value. |
+| `getRecordStream(String key)` / `getRecordStream(String key, GetRecordOptions)` | As `getRecord`, but completes with an `Optional` whose `getValue()` is a live `InputStream`, so a large record is processed in chunks. Close the record (or read its stream to the end) when done. The request is retried like any other, until the headers arrive. Throws on an error response that is not retried, or the last one once the retries run out, except a 404, which completes with empty. A failure while reading the body is not retried. |
+| `setRecord(String key, InputStream value, String contentType)` / `setRecord(String key, InputStream value, String contentType, SetRecordOptions)` | Store the bytes read from a stream, without holding them in memory, so a large file can be uploaded. The stream is closed when the call completes. It can be read once, so the upload is sent once: it is not retried, compressed, or sent again to follow a redirect, and `doNotRetryTimeouts` has no effect. Completes with no value. |
| `setRecordJson(String key, Object value)` | Store JSON. Completes with no value. |
| `deleteRecord(String key)` | Delete a record. Completes with no value. |
| `getRecordPublicUrl(String key)` | A public (optionally signed) record URL. Completes with `String`. |
@@ -184,7 +190,20 @@ client.keyValueStore("my-store")
.join();
```
-`KeyValueStoreRecord` exposes `getKey()`, `getValue()` (raw bytes) and `getContentType()`.
+Copy a large record without reading it into memory by passing the stream of one call to the other:
+
+```java
+try (KeyValueStoreRecordStream source =
+ client.keyValueStore("my-store").getRecordStream("video.mp4").join().orElseThrow()) {
+ client.keyValueStore("other-store")
+ .setRecord("video.mp4", source.getValue(), source.getContentType())
+ .join();
+}
+```
+
+`KeyValueStoreRecord` exposes `getKey()`, `getValue()` (raw bytes), and `getContentType()`;
+`KeyValueStoreRecordStream` exposes `getKey()`, `getValue()` (the `InputStream`), `getContentType()`,
+and `close()`.
`KeyValueStoreKeysPage` exposes `getItems()` (a list of `KeyValueStoreKey` with `getKey()`/`getSize()`),
`isTruncated()`, `getExclusiveStartKey()` and `getNextExclusiveStartKey()`.
diff --git a/docs/tasks.md b/docs/tasks.md
index 1d41a7c..9b15804 100644
--- a/docs/tasks.md
+++ b/docs/tasks.md
@@ -25,7 +25,7 @@ Task task = client.tasks().create(Map.of(
|---|---|
| `get()` / `update(Object)` / `delete()` | CRUD. Complete with `Optional` / `Task` / no value. |
| `publish()` / `unpublish()` | Publish/unpublish the task on its public landing page, by setting `isPublic` through `update(Object)`. Both require write permission to both the task and its Actor; `publish()` additionally requires the task's Actor to be public and a configured `publicConfig`. `unpublish()` preserves `publicConfig` so the task can be republished without re-entering it. Complete with the updated `Task`. |
-| `start(Object input, TaskStartOptions)` | Start a task run (input overrides stored input; `null` uses it). Completes with `ActorRun`. |
+| `start(Object input, TaskStartOptions)` | Start a task run (input overrides stored input; `null` uses it). Completes with `ActorRun`. As for an Actor, the `input` can be a `byte[]`, `String`, or `InputStream` that is sent as it is; a stream is sent once, with no retry. |
| `call(Object input, TaskStartOptions, Long waitSecs)` | Start and poll until finished; does **not** stream the run's log. Completes with `ActorRun`. |
| `call(Object input, TaskCallOptions, Long waitSecs)` | As above, additionally streaming the run's log for the duration of the wait by default. Use `TaskCallOptions.disableLogStreaming()` to opt out, or `logOptions(StreamedLogOptions)` for a custom destination. |
| `getInput()` | The stored input. Completes with `JsonNode`; throws `NotFoundError` if the task is gone (no separate "input absent" state). |
diff --git a/pom.xml b/pom.xml
index baf59cd..034c22e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.apifyapify-client
- 0.14.1
+ 0.15.0jarApify Java Client
diff --git a/src/main/java/com/apify/client/ApifyClient.java b/src/main/java/com/apify/client/ApifyClient.java
index 5c4eb1c..8efba35 100644
--- a/src/main/java/com/apify/client/ApifyClient.java
+++ b/src/main/java/com/apify/client/ApifyClient.java
@@ -244,7 +244,7 @@ public WebhookDispatchClient webhookDispatch(String id) {
// ----- Misc accessors ------------------------------------------------------
- /** A client for browsing the Apify Store. */
+ /** A client for browsing Apify Store. */
public StoreCollectionClient store() {
return new StoreCollectionClient(http, baseUrl);
}
diff --git a/src/main/java/com/apify/client/Version.java b/src/main/java/com/apify/client/Version.java
index 0654df4..0d495b7 100644
--- a/src/main/java/com/apify/client/Version.java
+++ b/src/main/java/com/apify/client/Version.java
@@ -13,13 +13,13 @@ public final class Version {
* The semantic version of this client library (see SemVer).
* Changes to the public interface other than additive ones are considered breaking changes.
*/
- public static final String CLIENT_VERSION = "0.14.1";
+ public static final String CLIENT_VERSION = "0.15.0";
/**
* The version of the Apify OpenAPI specification this client was generated and verified against.
* Corresponds to the {@code info.version} field of the Apify OpenAPI document.
*/
- public static final String API_SPEC_VERSION = "v2-2026-11-18T151559Z";
+ public static final String API_SPEC_VERSION = "v2-2026-12-02T102104Z";
private Version() {}
}
diff --git a/src/main/java/com/apify/client/actor/ActorClient.java b/src/main/java/com/apify/client/actor/ActorClient.java
index 65c8572..749b04b 100644
--- a/src/main/java/com/apify/client/actor/ActorClient.java
+++ b/src/main/java/com/apify/client/actor/ActorClient.java
@@ -16,6 +16,7 @@
import com.apify.client.run.RunClient;
import com.apify.client.run.RunCollectionClient;
import com.apify.client.webhook.NestedWebhookCollectionClient;
+import java.io.InputStream;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -73,8 +74,13 @@ public CompletableFuture delete() {
/**
* Starts the Actor and completes with the created run as soon as it exists (no waiting). {@code
- * input} is any JSON-serializable value, a {@code byte[]} or {@link String} that is sent as it is
- * (set the content type with the options' {@code contentType}), or {@code null} for no input.
+ * input} is any JSON-serializable value, a {@code byte[]}, {@link String}, or {@link InputStream}
+ * that is sent as it is (set the content type with the options' {@code contentType}), or {@code
+ * null} for no input.
+ *
+ *
An {@code InputStream} is read as it is sent, closed when the call completes, and never held
+ * in memory. It can be read once, so the start is sent once: a failed request is not retried, and
+ * a rejection for lack of resources is thrown even if {@code waitForResources} is set.
*/
public CompletableFuture start(Object input, ActorStartOptions options) {
return RunStartSupport.start(
diff --git a/src/main/java/com/apify/client/actor/ActorCollectionClient.java b/src/main/java/com/apify/client/actor/ActorCollectionClient.java
index 75dc2ce..6dc815b 100644
--- a/src/main/java/com/apify/client/actor/ActorCollectionClient.java
+++ b/src/main/java/com/apify/client/actor/ActorCollectionClient.java
@@ -18,7 +18,11 @@ public ActorCollectionClient(HttpClientCore http, String baseUrl) {
ActorListOptions::new);
}
- /** Creates a new Actor. {@code actor} is any JSON-serializable Actor definition. */
+ /**
+ * Creates a new Actor. {@code actor} is any JSON-serializable Actor definition. Fails with a
+ * {@link com.apify.client.http.ConflictError} (409, {@code actor-name-not-unique}) if you already
+ * have an Actor with the same name.
+ */
public CompletableFuture create(Object actor) {
return ctx.createResource(new QueryParams(), actor, Actor.class, Timeout.MEDIUM);
}
diff --git a/src/main/java/com/apify/client/actor/ActorServerClient.java b/src/main/java/com/apify/client/actor/ActorServerClient.java
index bbf9590..8fe2899 100644
--- a/src/main/java/com/apify/client/actor/ActorServerClient.java
+++ b/src/main/java/com/apify/client/actor/ActorServerClient.java
@@ -11,6 +11,7 @@
import com.apify.client.internal.QueryParams;
import com.apify.client.internal.RequestPolicy;
import com.apify.client.internal.ResourceContext;
+import java.io.InputStream;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
@@ -209,19 +210,31 @@ public CompletableFuture> getOpenApiSpec(Timeout timeout) {
*/
public CompletableFuture request(String path, ActorServerRequestOptions options) {
ActorServerRequestOptions opts = options != null ? options : new ActorServerRequestOptions();
- byte[] body = Json.toRequestBody(opts.bodyValue());
+ RequestPolicy policy = RequestPolicy.server(opts.compressionValue());
+ InputStream stream = opts.bodyValue() instanceof InputStream in ? in : null;
+ byte[] body = stream == null ? Json.toRequestBody(opts.bodyValue()) : null;
return getUrl()
.thenCompose(
serverUrl ->
- http.call(
- opts.methodValue(),
- requestUrl(serverUrl, path, opts),
- body,
- contentTypeOf(opts),
- opts.headersValue(),
- opts.timeoutValue(),
- false,
- RequestPolicy.server(opts.compressionValue())));
+ stream != null
+ ? http.callWithStream(
+ opts.methodValue(),
+ requestUrl(serverUrl, path, opts),
+ stream,
+ contentTypeOf(opts),
+ opts.headersValue(),
+ opts.timeoutValue(),
+ policy)
+ : http.call(
+ opts.methodValue(),
+ requestUrl(serverUrl, path, opts),
+ body,
+ contentTypeOf(opts),
+ opts.headersValue(),
+ opts.timeoutValue(),
+ false,
+ policy))
+ .whenComplete((response, error) -> closeUnused(stream));
}
/** A {@code GET} request to {@code path} on the Actor's server; see {@link #request}. */
@@ -246,24 +259,47 @@ public CompletableFuture request() {
public CompletableFuture requestStream(
String path, ActorServerRequestOptions options) {
ActorServerRequestOptions opts = options != null ? options : new ActorServerRequestOptions();
- byte[] body = Json.toRequestBody(opts.bodyValue());
+ RequestPolicy policy = RequestPolicy.server(opts.compressionValue());
+ InputStream stream = opts.bodyValue() instanceof InputStream in ? in : null;
+ byte[] body = stream == null ? Json.toRequestBody(opts.bodyValue()) : null;
return getUrl()
.thenCompose(
serverUrl ->
- http.streamRequest(
- opts.methodValue(),
- requestUrl(serverUrl, path, opts),
- body,
- contentTypeOf(opts),
- opts.headersValue(),
- opts.timeoutValue(),
- RequestPolicy.server(opts.compressionValue())))
+ stream != null
+ ? http.streamRequest(
+ opts.methodValue(),
+ requestUrl(serverUrl, path, opts),
+ stream,
+ contentTypeOf(opts),
+ opts.headersValue(),
+ opts.timeoutValue(),
+ policy)
+ : http.streamRequest(
+ opts.methodValue(),
+ requestUrl(serverUrl, path, opts),
+ body,
+ contentTypeOf(opts),
+ opts.headersValue(),
+ opts.timeoutValue(),
+ policy))
+ .whenComplete((response, error) -> closeUnused(stream))
.thenApply(
response ->
new ActorServerStreamResponse(
response.statusCode(), response.headers(), response.body()));
}
+ /**
+ * Closes a stream body when the URL lookup fails, before the request is made, for example because
+ * the Actor is not a Server Actor. Once the request is made, {@code HttpClientCore} closes the
+ * stream when the call completes.
+ */
+ private static void closeUnused(InputStream stream) {
+ if (stream != null) {
+ HttpClientCore.closeQuietly(stream);
+ }
+ }
+
/** Fetches the Actor and checks that it is a Server Actor. */
private CompletableFuture fetchServerActor(Timeout timeout) {
return ctx.getResourceRequired("", new QueryParams(), Actor.class, timeout)
@@ -394,7 +430,11 @@ private static String contentTypeOf(ActorServerRequestOptions options) {
return set;
}
Object body = options.bodyValue();
- boolean sentAsIs = body == null || body instanceof byte[] || body instanceof String;
+ boolean sentAsIs =
+ body == null
+ || body instanceof byte[]
+ || body instanceof String
+ || body instanceof InputStream;
return sentAsIs ? null : ResourceContext.CONTENT_TYPE_JSON;
}
}
diff --git a/src/main/java/com/apify/client/actor/ActorServerRequestOptions.java b/src/main/java/com/apify/client/actor/ActorServerRequestOptions.java
index 410a8af..d96cdcc 100644
--- a/src/main/java/com/apify/client/actor/ActorServerRequestOptions.java
+++ b/src/main/java/com/apify/client/actor/ActorServerRequestOptions.java
@@ -3,6 +3,7 @@
import com.apify.client.http.HttpCompressor;
import com.apify.client.http.Timeout;
import com.apify.client.internal.QueryParams;
+import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -85,10 +86,14 @@ public ActorServerRequestOptions headers(Map headers) {
}
/**
- * The request body: a {@code byte[]} or a {@link String} is sent as it is (set its {@code
- * Content-Type} with {@link #header}), and anything else, a {@link Map}, a list or a POJO, is
- * serialized to JSON and sent as {@code application/json} unless a {@code Content-Type} header is
- * set.
+ * The request body: a {@code byte[]}, a {@link String}, or an {@link InputStream} is sent as it
+ * is (set its {@code Content-Type} with {@link #header}), and anything else, a {@link Map}, a
+ * list, or a POJO, is serialized to JSON and sent as {@code application/json} unless a {@code
+ * Content-Type} header is set.
+ *
+ *
An {@code InputStream} is read as it is sent and closed when the call completes, so it is
+ * never held in memory. It can be read once, so the request is sent once, with no retry (not even
+ * for a 429 or 503 response), no compression, and no redirect followed.
*/
public ActorServerRequestOptions body(Object body) {
this.body = body;
diff --git a/src/main/java/com/apify/client/actor/ActorStartOptions.java b/src/main/java/com/apify/client/actor/ActorStartOptions.java
index 888fb81..28b4388 100644
--- a/src/main/java/com/apify/client/actor/ActorStartOptions.java
+++ b/src/main/java/com/apify/client/actor/ActorStartOptions.java
@@ -101,7 +101,8 @@ public ActorStartOptions webhooks(List