Skip to content
Open
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
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,31 @@ 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-11-27

### Added

- `StoreActorStats`, the statistics of a Store Actor: `totalUsers`, `totalRuns`, `totalUsers7Days`, `totalUsers30Days`, `totalUsers90Days`, `actorReviewRating`, and `actorReviewCount`.
- `ActorStoreListItem` getters for `userFullName`, `categories`, `notice`, `isWhiteListedForAgenticPayments`, `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

- **Breaking:** `ActorStoreListItem.getStats()` returns `StoreActorStats` instead of `ActorStats`. The Store no longer returns `totalBuilds`, `totalMetamorphs`, and `lastRunStartedAt`.
- **Breaking:** `StoreCollectionClient.iterate` sends one request when `search` is set, since the Store returns a single page of at most 100 Actors for a search and ignores `offset`. `chunkSize` and `offset` have no effect for a search.
- `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`).
- `ActorClient.validateInput` and `RunClient.metamorph` throw `IllegalArgumentException` for an `InputStream` input, instead of serializing it to JSON.

### Deprecated

- `StoreListOptions.sortBy`: the API ignores it.

## [0.14.1] - 2026-11-20

### Changed
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Maven (Maven Central is a default repository, so no extra configuration is neede
<dependency>
<groupId>com.apify</groupId>
<artifactId>apify-client</artifactId>
<version>0.14.1</version>
<version>0.15.0</version>
</dependency>
```

Expand All @@ -35,7 +35,7 @@ repositories {
}

dependencies {
implementation 'com.apify:apify-client:0.14.1'
implementation 'com.apify:apify-client:0.15.0'
}
```

Expand Down Expand Up @@ -308,15 +308,16 @@ both non-blocking. `HttpRequest` and `HttpResponse<T>` below are the JDK's `java

| Method | Signature | Contract |
|---|---|---|
| `sendAsync` | `CompletableFuture<HttpResponse<byte[]>> 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<HttpResponse<InputStream>> 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<HttpResponse<byte[]>> 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<HttpResponse<InputStream>> 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).

Expand Down Expand Up @@ -437,7 +438,7 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`, `StoreListOptions`, `PricingInfo` |
| `com.apify.client.log` | `LogClient`, `LogOptions`, `StreamedLog`, `StreamedLogOptions` |

For example, the [top-level README's dataset snippet](../README.md#quick-start) needs
Expand Down
13 changes: 7 additions & 6 deletions docs/actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Actor>`. |
| `iterate(ActorListOptions, Long chunkSize)` | Lazy `Flow.Publisher<Actor>` 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.
Expand Down Expand Up @@ -46,7 +46,7 @@ Actor created = client.actors().create(Map.of(
| `get()` | Fetch the Actor. Completes with `Optional<Actor>`. |
| `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`). |
Expand Down Expand Up @@ -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)`
Expand Down Expand Up @@ -232,14 +233,14 @@ and deletes a single version and exposes its environment variables.
|---|---|
| `list(ListOptions)` | List the Actor's versions. Completes with `PaginationList<ActorVersion>`. 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<ActorVersion>` 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<ActorVersion>`. |
| `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. |
Expand Down
36 changes: 26 additions & 10 deletions docs/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,46 @@ Browse public Actors in the Apify Store. `client.store()` returns a `StoreCollec
| Method | Description |
|---|---|
| `list(StoreListOptions)` | A page of Store Actors. Completes with `PaginationList<ActorStoreListItem>`. |
| `iterate(StoreListOptions, Long chunkSize)` | A lazy `Flow.Publisher<ActorStoreListItem>` 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). |
| `iterate(StoreListOptions, Long chunkSize)` | A lazy `Flow.Publisher<ActorStoreListItem>` 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). With `search` there is a single page instead: see below. |

`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),
return; the API default and maximum is 1000, or 100 with `search`), `search` (search query),
`sortBy` (deprecated: the API ignores it, and orders the results by relevance with `search` and by
Store position otherwise, so sort them on the client), `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`; 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`).

A `search` returns the Actors ranked by relevance as a single page of at most 100: the API ignores
`offset` and has no second page. `iterate` therefore sends one request for a search, when you call
`iterate` rather than on first demand, with the options' `limit` as its size. `chunkSize` and
`offset` have no effect. Narrow a search with `category`, `username`, or `pricingModel`.

```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<ActorStoreListItem> 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.
List<ActorStoreListItem> found =
Publishers.collect(client.store().iterate(new StoreListOptions().search("crawler"), null)).join();
```

`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<String>` of category IDs),
`getNotice()`, `getStats()` (`StoreActorStats`: `getTotalUsers()`, `getTotalRuns()`,
`getTotalUsers7Days()`, `getTotalUsers30Days()`, `getTotalUsers90Days()`, `getActorReviewRating()`,
`getActorReviewCount()`), `getCurrentPricingInfo()` (`PricingInfo`: `getPricingModel()`),
`getIsWhiteListedForAgenticPayments()`, `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)).

Expand Down Expand Up @@ -94,7 +110,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<String>` 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<byte[]>` (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)`.

Expand Down
Loading
Loading