apify

package module
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

README

Apify API client for Go

Official, but experimental — AI-generated and AI-maintained. This is an official Apify client, but it is experimental: it is generated and maintained by AI. Review the code before relying on it in production and report issues on the repository.

An idiomatic Go client for the Apify API.

It provides a resource-oriented interface that mirrors the official JavaScript and Rust clients: start from an ApifyClient, then drill down into resources (Actors, runs, datasets, key-value stores, request queues, tasks, schedules, webhooks, the store, users and logs).

Features

  • Resource-oriented API surface consistent with the reference clients.
  • Transparent authentication, User-Agent header, retries with exponential backoff, and per-request timeouts applied to every call.
  • Replaceable HTTP transport (the HTTPBackend interface) with a default implementation.
  • Convenience helpers: start-and-wait, build/run polling, lazy store and request-queue iterators, dataset export, signed public URLs, request-queue locking, and more.
  • Forward-compatible models that keep unknown API fields in an Extra map.
  • A single third-party dependency (github.com/andybalholm/brotli, used for Brotli request-body compression); everything else is the Go standard library.

Installation

go get github.com/apify/apify-client-go

Requires Go 1.23 or newer.

Quick start

package main

import (
	"context"
	"fmt"
	"log"
	"os"

	apify "github.com/apify/apify-client-go"
)

func main() {
	client := apify.NewClient(apify.WithToken(os.Getenv("APIFY_TOKEN")))
	ctx := context.Background()

	// Start an Actor and wait for it to finish.
	waitSecs := int64(120)
	run, err := client.Actor("apify/hello-world").Call(ctx, nil, apify.ActorStartOptions{}, &waitSecs)
	if err != nil {
		log.Fatal(err)
	}

	// Read items from the run's default dataset.
	page, err := client.Dataset(run.DefaultDatasetID).ListItems(ctx, apify.DatasetListItemsOptions{})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("Got %d items\n", page.Total)
}

Get your API token from the Apify Console under Settings → Integrations (the Personal API tokens section). The client never reads it from the environment itself: pass the token via apify.WithToken explicitly (the examples above read APIFY_TOKEN from the environment only as a convenience in main).

Configuration

NewClient takes functional options. Pass WithToken for authentication, plus any other options for full control. WithToken is optional: omit it to create an unauthenticated client, which can still call the few endpoints that require no token (for example, resolving a public Actor's default build with client.Actor("apify/hello-world").DefaultBuild(ctx, nil) — see examples/public_build_no_token). Most endpoints — anything account-scoped or that reads or writes your resources — require a token.

package main

import (
	"time"

	apify "github.com/apify/apify-client-go"
)

func main() {
	client := apify.NewClient(
		apify.WithToken("my-api-token"),
		apify.WithBaseURL("https://api.apify.com"),       // /v2 is appended automatically
		apify.WithPublicBaseURL("https://api.apify.com"), // base for signed, shareable URLs
		apify.WithMaxRetries(8),                          // default 8
		apify.WithMinDelayBetweenRetries(500*time.Millisecond),
		apify.WithTimeout(360*time.Second), // default 6 minutes
		apify.WithUserAgentSuffix("MyTool/1.0"),
		apify.WithHTTPBackend(apify.NewDefaultHTTPBackend()),
	)
	_ = client
}
Option Default Description
WithToken API token, sent as a Bearer token. Optional; omit for an unauthenticated client limited to endpoints that need no token.
WithBaseURL https://api.apify.com API base URL; /v2 is appended automatically.
WithPublicBaseURL API base URL Base URL used for building public, shareable URLs.
WithMaxRetries 8 Maximum retries for failed requests.
WithMinDelayBetweenRetries 500ms Minimum delay between retries (doubled each retry).
WithTimeout 360s Overall per-request timeout.
WithUserAgentSuffix Suffix appended to the User-Agent header.
WithHTTPBackend DefaultHTTPBackend Replaceable HTTP transport.

The User-Agent header reports an isAtHome flag indicating whether the client runs on the Apify platform. It is driven solely by the APIFY_IS_AT_HOME environment variable (the same variable the JavaScript reference client reads); if it is set to a non-empty value, the flag is true, otherwise false.

Resource clients

Accessor Returns Purpose
client.Actors() / client.Actor(id) *ActorCollectionClient / *ActorClient List/create Actors; manage a single Actor and its runs, builds, versions, webhooks.
client.Builds() / client.Build(id) *BuildCollectionClient / *BuildClient List builds; inspect, abort, wait for, and read a build's log/OpenAPI.
client.Runs() / client.Run(id) *RunCollectionClient / *RunClient List runs; manage a run, its default storages, and its log.
client.Datasets() / client.Dataset(id) *DatasetCollectionClient / *DatasetClient List/get-or-create datasets; read/write/export items.
client.KeyValueStores() / client.KeyValueStore(id) *KeyValueStoreCollectionClient / *KeyValueStoreClient List/get-or-create stores; read/write records and keys.
client.RequestQueues() / client.RequestQueue(id) *RequestQueueCollectionClient / *RequestQueueClient List/get-or-create queues; add/list/lock requests.
client.Tasks() / client.Task(id) *TaskCollectionClient / *TaskClient List/create tasks; manage a task, its input and runs.
client.Schedules() / client.Schedule(id) *ScheduleCollectionClient / *ScheduleClient List/create schedules; manage a single schedule.
client.Webhooks() / client.Webhook(id) *WebhookCollectionClient / *WebhookClient List/create webhooks; manage and test a single webhook.
client.WebhookDispatches() / client.WebhookDispatch(id) *WebhookDispatchCollectionClient / *WebhookDispatchClient List/inspect webhook dispatches.
client.Store() *StoreCollectionClient Browse and iterate the Apify Store.
client.Me() / client.User(id) *UserClient Account details, usage and limits (account scope for Me()).
client.Log(buildOrRunID) *LogClient Read or stream a build/run log.

Error handling

API errors are returned as *APIError. Recover it from any returned error with apify.AsAPIError(err) (*APIError, bool) — the boolean is false when the error is not an API error (e.g. a network or context error). get/delete on a missing resource is not an error: the methods report absence via a boolean (ok) instead.

*APIError exposes:

Field Type Meaning
StatusCode int HTTP status code of the error response.
Type string Machine-readable error type returned by the API (e.g. "record-not-found").
Message string Human-readable error description returned by the API.
Attempt int 1-based number of the API call attempt that produced this error.
HTTPMethod string HTTP method of the failing call (e.g. "GET", "POST").
Path string Request path of the endpoint (URL excluding origin).
user, ok, err := client.Me().Get(ctx)
if err != nil {
	if apiErr, isAPI := apify.AsAPIError(err); isAPI {
		fmt.Printf("API error %d (%s): %s\n", apiErr.StatusCode, apiErr.Type, apiErr.Message)
	}
	log.Fatal(err)
}
if !ok {
	log.Fatal("user not found")
}

Custom HTTP transport

The transport is replaceable. Implement HTTPBackend (a single Do method) to integrate a custom client, proxy, or test double, and pass it with WithHTTPBackend:

package main

import (
	"net/http"

	apify "github.com/apify/apify-client-go"
)

// myBackend is a custom HTTPBackend wrapping a standard *http.Client.
type myBackend struct{ inner *http.Client }

func (b *myBackend) Do(req *http.Request) (*http.Response, error) {
	return b.inner.Do(req)
}

func main() {
	client := apify.NewClient(
		apify.WithToken("my-api-token"),
		apify.WithHTTPBackend(&myBackend{inner: http.DefaultClient}),
	)
	_ = client
}

Versioning

  • apify.ClientVersion — the semantic version of this library.
  • apify.APISpecVersion — the Apify OpenAPI spec version this client was built against (v2-2026-07-13T092445Z).
Releasing

Go modules are distributed by pushing a semver git tag — there is no separate package registry to upload to. The Publish Go client workflow is the release mechanism: a maintainer triggers it manually (workflow_dispatch), it runs the same quality gate as CI, then creates and pushes the v<ClientVersion> tag, opens a GitHub release, and asks the Go module proxy to index the new version so it appears on pkg.go.dev. The tag is derived from ClientVersion in version.go, so bump that constant before releasing. The workflow uses only the built-in GITHUB_TOKEN; no extra credentials are required.

There is no "Trusted Publisher" step: that mechanism applies to registries that authenticate uploads (e.g. PyPI, npm, crates.io). Go has no central registry and no upload step — a module is published purely by pushing a git tag that the public module proxy reads — so there is no token or trusted-publisher relationship to configure. The workflow therefore relies only on the repository's built-in GITHUB_TOKEN to push the tag and open the release.

Examples

Runnable examples live in examples/ and are exercised in CI. Most need a token; run them like:

APIFY_TOKEN=<your-token> go run ./examples/run_store_actor

public_build_no_token needs no token — run it with go run ./examples/public_build_no_token.

Example Description
get_account Fetch and print the current account details.
storages Create, write to, and read from a dataset, key-value store, and request queue.
run_store_actor Run a Store Actor, wait for it, and read its default dataset.
run_and_last_run_storages Start a run, wait for it to finish, then fetch the Actor's last run and its storages.
iterate_store Lazily iterate Actors in the Apify Store.
log_redirection Start an Actor and stream its log in real time.
create_build_run_actor Create an Actor, build it, run it, and print the run log.
public_build_no_token Fetch a public Actor's default build with an unauthenticated client (no token).

Documentation

Per-resource guides are in docs/: actors, builds, runs, tasks, storages, schedules, webhooks, misc (store, users, logs).

Scope

The client implements only documented API endpoints. Matching the JavaScript reference (and the Rust sibling) for cross-client consistency, the following documented endpoints are intentionally not implemented:

  • Synchronous run endpoints (run-sync, run-sync-get-dataset-items).
  • The keyed-POST record aliases.
  • Cryptographic tools: POST /v2/tools/encode-and-sign and POST /v2/tools/decode-and-verify. These are server-side conveniences for the same HMAC signing this client already performs locally in signature.go; the reference clients do not expose them, so the Go client omits them too for parity. (Should a future requirement need them, they can be added alongside signature.go.)
  • /v2/browser-info. Not exposed by the reference clients; omitted for parity.

This is a deliberate, parity-driven decision, not an accidental gap. See the CHANGELOG for the same note.

License

Licensed under the Apache License, Version 2.0. See LICENSE.

Documentation

Overview

Package apify is the official, idiomatic Go client for the Apify API (https://docs.apify.com/api/v2).

See the top-level README for the AI-generated/AI-maintained disclaimer.

It provides a resource-oriented interface that mirrors the official JavaScript and Rust clients: start from an ApifyClient, then drill down into resources (Actors, runs, datasets, key-value stores, request queues, tasks, schedules, webhooks, the store, users and logs).

Quick start

client := apify.NewClient(apify.WithToken("my-api-token"))

// Start an Actor and wait for it to finish.
run, err := client.Actor("apify/hello-world").Call(ctx, nil, apify.ActorStartOptions{}, nil)
if err != nil {
	log.Fatal(err)
}

// Read items from the run's default dataset.
page, err := client.Dataset(run.DefaultDatasetID).ListItems(ctx, apify.DatasetListItemsOptions{})

Architecture

  • Public interface: ApifyClient and the resource clients it returns.
  • Replaceable transport: the HTTPBackend interface, with a default DefaultHTTPBackend. Swap it via WithHTTPBackend.
  • Cross-cutting behaviour (auth, User-Agent, retries with exponential backoff, timeouts) lives in the internal HTTP client and is applied to every request.

Index

Constants

View Source
const (
	// RequestFilterLocked filters the listing to currently locked requests.
	RequestFilterLocked = "locked"
	// RequestFilterPending filters the listing to pending (not-yet-handled) requests.
	RequestFilterPending = "pending"
)

Allowed values for entries in ListRequestsOptions.Filter, as constrained by the API.

View Source
const APISpecVersion = "v2-2026-08-05T133145Z"

APISpecVersion is the version of the Apify OpenAPI specification that this client was generated and verified against.

It corresponds to the `info.version` field of the Apify OpenAPI document.

View Source
const ClientVersion = "0.8.0"

ClientVersion is the semantic version of this client library.

It follows Semantic Versioning (https://semver.org/). Changes to the public interface (other than additive ones) are considered breaking changes.

Variables

This section is empty.

Functions

func BuildUserAgent

func BuildUserAgent(suffix string, isAtHomeFn func() bool) string

BuildUserAgent builds the User-Agent header value mandated by the client requirements: `ApifyClient/{version} ({os}; {language version}); isAtHome/{isAtHome}`.

isAtHome is driven solely by the platform's APIFY_IS_AT_HOME environment variable (matching the requirements and the reference JS client, which reads it via @apify/consts) and is rendered lowercase (true/false). The {os} token uses osToken so it matches the platform names the reference clients emit.

func Ptr

func Ptr[T any](v T) *T

Ptr returns a pointer to v. It is a convenience for setting the optional, pointer-typed fields on the option structs (e.g. Limit, Desc, My) without needing a named local variable:

client.Actors().List(ctx, apify.ActorListOptions{My: apify.Ptr(true), Limit: apify.Ptr(int64(10))})

Types

type APIError

type APIError struct {
	// StatusCode is the HTTP status code of the error response.
	StatusCode int
	// Type is the machine-readable error type returned by the API (e.g. "record-not-found").
	Type string
	// Message is the human-readable description of the error returned by the API.
	Message string
	// Attempt is the number of the API call attempt that produced this error (1-based).
	Attempt int
	// HTTPMethod is the HTTP method of the API call (e.g. "GET", "POST").
	HTTPMethod string
	// Path is the full path of the API endpoint (URL excluding origin).
	Path string
	// Data holds additional structured data provided by the API about the error, if any.
	Data map[string]any
}

APIError is returned for HTTP requests that reach the Apify API but receive a non-success status code.

It mirrors the `ApifyApiError` of the reference JavaScript client and exposes the parsed error Type, the human-readable Message, the HTTP StatusCode, the number of the final Attempt, and the request HTTPMethod/Path.

func AsAPIError

func AsAPIError(err error) (*APIError, bool)

AsAPIError returns the underlying *APIError if err is (or wraps) one, and true; otherwise it returns nil and false. It is a convenience wrapper around errors.As.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface.

type Actor

type Actor struct {
	// ID is the unique Actor ID.
	ID string `json:"id"`
	// UserID is the ID of the user who owns the Actor.
	UserID string `json:"userId"`
	// Name is the technical name of the Actor (used in API paths).
	Name string `json:"name"`
	// Username is the username of the Actor's owner.
	Username string `json:"username"`
	// Title is the human-readable title shown in the UI.
	Title string `json:"title"`
	// Description describes what the Actor does.
	Description string `json:"description"`
	// IsPublic reports whether the Actor is publicly available in Apify Store.
	IsPublic bool `json:"isPublic"`
	// CreatedAt is when the Actor was created.
	CreatedAt *time.Time `json:"createdAt"`
	// ModifiedAt is when the Actor was last modified.
	ModifiedAt *time.Time `json:"modifiedAt"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Actor is an Actor on the Apify platform.

func (*Actor) UnmarshalJSON

func (a *Actor) UnmarshalJSON(data []byte) error

type ActorBuildOptions

type ActorBuildOptions struct {
	// BetaPackages, if true, uses beta versions of Apify packages.
	BetaPackages *bool
	// Tag is the tag to apply to the build (e.g. "latest").
	Tag *string
	// UseCache, if set, controls whether to use the Docker build cache (default true).
	UseCache *bool
	// WaitForFinish is the maximum seconds to wait server-side for the build (max 60).
	WaitForFinish *int64
}

ActorBuildOptions configures ActorClient.Build.

type ActorClient

type ActorClient struct {
	// contains filtered or unexported fields
}

ActorClient is a client for a specific Actor.

It provides CRUD methods plus convenience helpers to start/call the Actor, build it, and access its runs, builds, versions and webhooks.

func (*ActorClient) Build

func (c *ActorClient) Build(ctx context.Context, versionNumber string, options ActorBuildOptions) (Build, error)

Build builds the given version of the Actor and returns the created build.

func (*ActorClient) Builds

func (c *ActorClient) Builds() *BuildCollectionClient

Builds returns a client for this Actor's build collection.

func (*ActorClient) Call

func (c *ActorClient) Call(ctx context.Context, input any, options ActorStartOptions, waitSecs *int64) (ActorRun, error)

Call starts the Actor and waits (client-side polling) for it to finish.

waitSecs bounds the wait; nil waits indefinitely. It returns the finished run (or the still-running run if the wait budget was exhausted).

func (*ActorClient) DefaultBuild

func (c *ActorClient) DefaultBuild(ctx context.Context, waitForFinish *int64) (*BuildClient, error)

DefaultBuild resolves the Actor's default build and returns a client for it.

waitForFinish optionally bounds how long (in seconds) the API waits for the build to finish before responding, matching the reference client's defaultBuild(options).

func (*ActorClient) Delete

func (c *ActorClient) Delete(ctx context.Context) error

Delete deletes the Actor.

func (*ActorClient) Get

func (c *ActorClient) Get(ctx context.Context) (Actor, bool, error)

Get fetches the Actor object. The bool reports whether the Actor exists.

func (*ActorClient) ID

func (c *ActorClient) ID() string

ID returns the Actor's ID (or username~name) as provided.

func (*ActorClient) LastRun

func (c *ActorClient) LastRun(status string) *RunClient

LastRun returns a client for the last run of this Actor, optionally filtered by status (e.g. "SUCCEEDED"). Pass an empty status for no filter.

To also filter by run origin, use LastRunWithOptions.

func (*ActorClient) LastRunWithOptions

func (c *ActorClient) LastRunWithOptions(options LastRunOptions) *RunClient

LastRunWithOptions returns a client for the last run of this Actor, optionally filtered by status and/or origin. See LastRunOptions. Mirrors the reference client's lastRun({ status, origin }).

func (*ActorClient) Runs

func (c *ActorClient) Runs() *RunCollectionClient

Runs returns a client for this Actor's run collection.

func (*ActorClient) Start

func (c *ActorClient) Start(ctx context.Context, input any, options ActorStartOptions) (ActorRun, error)

Start starts the Actor and returns immediately with the created run.

input is any JSON-serializable value (or nil for no input).

func (*ActorClient) Update

func (c *ActorClient) Update(ctx context.Context, newFields any) (Actor, error)

Update updates the Actor with the given fields and returns the updated object.

func (*ActorClient) ValidateInput

func (c *ActorClient) ValidateInput(ctx context.Context, input any) (json.RawMessage, error)

ValidateInput validates the given input against the Actor's input schema.

It omits the build parameter, so the API validates against the input schema of the build tagged "latest". To validate against a specific build, use ActorClient.ValidateInputForBuild.

On success it returns the raw JSON validation result from the API (a JSON object reporting whether the input is valid and, if not, the schema violations).

func (*ActorClient) ValidateInputForBuild

func (c *ActorClient) ValidateInputForBuild(ctx context.Context, input any, build string) (json.RawMessage, error)

ValidateInputForBuild validates the given input against the input schema of a specific Actor build, identified by its tag or number (e.g. "latest", "0.1.2"). An empty build omits the parameter, so the API validates against the build tagged "latest" (per the OpenAPI specification), equivalent to ActorClient.ValidateInput.

On success it returns the raw JSON validation result from the API (a JSON object reporting whether the input is valid and, if not, the schema violations).

func (*ActorClient) Version

func (c *ActorClient) Version(versionNumber string) *ActorVersionClient

Version returns a client for a specific version of this Actor.

func (*ActorClient) Versions

Versions returns a client for this Actor's version collection.

func (*ActorClient) Webhooks

func (c *ActorClient) Webhooks() *WebhookCollectionClient

Webhooks returns a client for this Actor's webhook collection.

type ActorCollectionClient

type ActorCollectionClient struct {
	// contains filtered or unexported fields
}

ActorCollectionClient is a client for the Actor collection (GET/POST /v2/actors).

func (*ActorCollectionClient) Create

func (c *ActorCollectionClient) Create(ctx context.Context, actor any) (Actor, error)

Create creates a new Actor. actor is any JSON-serializable Actor definition.

func (*ActorCollectionClient) Iterate added in v0.7.0

func (c *ActorCollectionClient) Iterate(options ActorListOptions, chunkSize *int64) *ListIterator[Actor]

Iterate returns a lazy iterator over the Actors matching the options, fetching pages on demand. The options' Limit caps the total number of Actors yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*ActorCollectionClient) List

List lists the account's Actors.

type ActorEnvVar

type ActorEnvVar struct {
	// Name is the environment variable name.
	Name string `json:"name"`
	// Value is the environment variable value.
	Value string `json:"value,omitempty"`
	// IsSecret reports whether the value is stored as a secret.
	IsSecret *bool `json:"isSecret,omitempty"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

ActorEnvVar is an environment variable attached to an Actor version.

func (*ActorEnvVar) UnmarshalJSON

func (e *ActorEnvVar) UnmarshalJSON(data []byte) error

type ActorEnvVarClient

type ActorEnvVarClient struct {
	// contains filtered or unexported fields
}

ActorEnvVarClient is a client for a single environment variable (GET/PUT/DELETE /v2/actors/{actorId}/versions/{versionNumber}/env-vars/{name}).

func (*ActorEnvVarClient) Delete

func (c *ActorEnvVarClient) Delete(ctx context.Context) error

Delete deletes the environment variable.

func (*ActorEnvVarClient) Get

Get fetches the environment variable. The bool reports whether it exists.

func (*ActorEnvVarClient) Update

func (c *ActorEnvVarClient) Update(ctx context.Context, envVar ActorEnvVar) (ActorEnvVar, error)

Update updates the environment variable and returns the updated object.

type ActorEnvVarCollectionClient

type ActorEnvVarCollectionClient struct {
	// contains filtered or unexported fields
}

ActorEnvVarCollectionClient is a client for an Actor version's environment variable collection (GET/POST /v2/actors/{actorId}/versions/{versionNumber}/env-vars).

func (*ActorEnvVarCollectionClient) Create

Create creates a new environment variable.

func (*ActorEnvVarCollectionClient) Iterate added in v0.7.0

Iterate returns a lazy iterator over the version's environment variables. Mirrors the reference client's iterable list(). The env-vars endpoint is not offset-paginated (it returns the full set in a single page), so there is no Limit/chunkSize control and the closure ignores the offset/limit arguments; the iterator drains that one page.

func (*ActorEnvVarCollectionClient) List

List lists the version's environment variables.

type ActorListOptions

type ActorListOptions struct {
	// Offset is the number of Actors to skip.
	Offset *int64
	// Limit is the maximum number of Actors to return.
	Limit *int64
	// Desc, if true, returns Actors newest-first.
	Desc *bool
	// My, if true, returns only Actors owned by the current user.
	My *bool
	// SortBy sets the sort field (e.g. "createdAt", "stats.lastRunStartedAt").
	SortBy *string
}

ActorListOptions configures ActorCollectionClient.List.

type ActorRun

type ActorRun struct {
	// ID is the unique run ID.
	ID string `json:"id"`
	// ActID is the ID of the Actor that produced this run.
	ActID string `json:"actId"`
	// ActorTaskID is the ID of the task that started this run, if any.
	ActorTaskID string `json:"actorTaskId"`
	// UserID is the ID of the user who owns the run.
	UserID string `json:"userId"`
	// Status is the current run status. One of the eight ActorJobStatus values: READY, RUNNING,
	// SUCCEEDED, FAILED, TIMING-OUT, TIMED-OUT, ABORTING, ABORTED.
	Status string `json:"status"`
	// StatusMessage is an optional human-readable status message.
	StatusMessage string `json:"statusMessage"`
	// StartedAt is when the run started.
	StartedAt *time.Time `json:"startedAt"`
	// FinishedAt is when the run finished (absent while still running).
	FinishedAt *time.Time `json:"finishedAt"`
	// BuildID is the ID of the build used for the run.
	BuildID string `json:"buildId"`
	// DefaultDatasetID is the ID of the run's default dataset.
	DefaultDatasetID string `json:"defaultDatasetId"`
	// DefaultKeyValueStoreID is the ID of the run's default key-value store.
	DefaultKeyValueStoreID string `json:"defaultKeyValueStoreId"`
	// DefaultRequestQueueID is the ID of the run's default request queue.
	DefaultRequestQueueID string `json:"defaultRequestQueueId"`
	// ContainerURL is the URL of the run's container (for live access).
	ContainerURL string `json:"containerUrl"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

ActorRun is a single execution of an Actor.

func (*ActorRun) IsTerminal

func (r *ActorRun) IsTerminal() bool

IsTerminal reports whether the run has reached a terminal (finished) status.

func (*ActorRun) UnmarshalJSON

func (r *ActorRun) UnmarshalJSON(data []byte) error

type ActorStartOptions

type ActorStartOptions struct {
	// Build is the tag or number of the build to run (e.g. "latest", "0.1.2").
	Build *string
	// MemoryMbytes is the memory in megabytes allocated for the run.
	MemoryMbytes *int64
	// TimeoutSecs is the timeout for the run in seconds (0 means no timeout).
	TimeoutSecs *int64
	// WaitForFinish is the maximum seconds to wait server-side for the run to finish (max 60).
	WaitForFinish *int64
	// MaxItems is the maximum number of dataset items to charge (pay-per-result Actors).
	MaxItems *int64
	// MaxTotalChargeUsd is the maximum total charge in USD (pay-per-event Actors).
	MaxTotalChargeUsd *float64
	// ContentType is the content type of the input body. Defaults to application/json.
	ContentType *string
	// RestartOnError, if true, restarts the run if it fails.
	RestartOnError *bool
	// ForcePermissionLevel overrides the Actor's permission level for this run.
	ForcePermissionLevel *string
	// Webhooks are ad-hoc webhooks to attach to this run. They are serialized to
	// base64-encoded JSON as the `webhooks` query parameter, matching the reference clients.
	Webhooks []any
}

ActorStartOptions configures starting an Actor or task run (ActorClient.Start/ActorClient.Call and the task equivalents).

type ActorStoreListItem

type ActorStoreListItem struct {
	// ID is the unique Actor ID.
	ID string `json:"id"`
	// Name is the technical name of the Actor.
	Name string `json:"name"`
	// Username is the username of the Actor's owner.
	Username string `json:"username"`
	// Title is the human-readable title.
	Title string `json:"title"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

ActorStoreListItem is an Actor as listed in the Apify Store.

func (*ActorStoreListItem) UnmarshalJSON

func (a *ActorStoreListItem) UnmarshalJSON(data []byte) error

type ActorVersion

type ActorVersion struct {
	// VersionNumber is the version identifier (e.g. "0.1").
	VersionNumber string `json:"versionNumber"`
	// SourceType is how the version's source is provided (e.g. "SOURCE_FILES").
	SourceType string `json:"sourceType"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

ActorVersion is a single version of an Actor.

func (*ActorVersion) UnmarshalJSON

func (v *ActorVersion) UnmarshalJSON(data []byte) error

type ActorVersionClient

type ActorVersionClient struct {
	// contains filtered or unexported fields
}

ActorVersionClient is a client for a specific Actor version (GET/PUT/DELETE /v2/actors/{actorId}/versions/{versionNumber}).

func (*ActorVersionClient) Delete

func (c *ActorVersionClient) Delete(ctx context.Context) error

Delete deletes the version.

func (*ActorVersionClient) EnvVar

func (c *ActorVersionClient) EnvVar(name string) *ActorEnvVarClient

EnvVar returns a client for a specific environment variable of this version.

func (*ActorVersionClient) EnvVars

EnvVars returns a client for this version's environment variable collection.

func (*ActorVersionClient) Get

Get fetches the version. The bool reports whether it exists.

func (*ActorVersionClient) Update

func (c *ActorVersionClient) Update(ctx context.Context, newFields any) (ActorVersion, error)

Update updates the version with the given fields and returns the updated object.

type ActorVersionCollectionClient

type ActorVersionCollectionClient struct {
	// contains filtered or unexported fields
}

ActorVersionCollectionClient is a client for an Actor's version collection (GET/POST /v2/actors/{actorId}/versions).

func (*ActorVersionCollectionClient) Create

Create creates a new Actor version. version is any JSON-serializable version definition.

func (*ActorVersionCollectionClient) Iterate added in v0.7.0

func (c *ActorVersionCollectionClient) Iterate(options ListOptions, chunkSize *int64) *ListIterator[ActorVersion]

Iterate returns a lazy iterator over the Actor's versions matching the options, fetching pages on demand. The options' Limit caps the total number of versions yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*ActorVersionCollectionClient) List

List lists the Actor's versions.

type ApifyClient

type ApifyClient struct {
	// contains filtered or unexported fields
}

ApifyClient is the entry point for interacting with the Apify API.

Construct it with NewClient, passing functional options such as WithToken, then obtain resource clients via the accessor methods, e.g. ApifyClient.Actor, ApifyClient.Dataset, ApifyClient.Run. It is safe for concurrent use.

func NewClient

func NewClient(opts ...Option) *ApifyClient

NewClient creates a client configured by the given functional options.

Authentication is supplied via WithToken; without it the client can still call endpoints that do not require authentication. Other options (WithBaseURL, WithMaxRetries, WithTimeout, WithHTTPBackend, ...) tune the transport and behaviour.

client := apify.NewClient(apify.WithToken("my-api-token"))

func (*ApifyClient) APIBaseURL

func (c *ApifyClient) APIBaseURL() string

APIBaseURL returns the fully-qualified API base URL this client targets (including the /v2 suffix), e.g. https://api.apify.com/v2. Reflects any base-URL override.

func (*ApifyClient) Actor

func (c *ApifyClient) Actor(id string) *ActorClient

Actor returns a client for a specific Actor, addressed by ID or username~name.

func (*ApifyClient) Actors

func (c *ApifyClient) Actors() *ActorCollectionClient

Actors returns a client for the Actor collection (list & create Actors).

func (*ApifyClient) Build

func (c *ApifyClient) Build(id string) *BuildClient

Build returns a client for a specific Actor build.

func (*ApifyClient) Builds

func (c *ApifyClient) Builds() *BuildCollectionClient

Builds returns a client for the Actor build collection (list builds).

func (*ApifyClient) Dataset

func (c *ApifyClient) Dataset(id string) *DatasetClient

Dataset returns a client for a specific dataset, addressed by ID or name.

func (*ApifyClient) Datasets

func (c *ApifyClient) Datasets() *DatasetCollectionClient

Datasets returns a client for the dataset collection (list & get-or-create datasets).

func (*ApifyClient) KeyValueStore

func (c *ApifyClient) KeyValueStore(id string) *KeyValueStoreClient

KeyValueStore returns a client for a specific key-value store, addressed by ID or name.

func (*ApifyClient) KeyValueStores

func (c *ApifyClient) KeyValueStores() *KeyValueStoreCollectionClient

KeyValueStores returns a client for the key-value store collection.

func (*ApifyClient) Log

func (c *ApifyClient) Log(buildOrRunID string) *LogClient

Log returns a client for accessing a build's or run's log.

func (*ApifyClient) Me

func (c *ApifyClient) Me() *UserClient

Me returns a client for the current user (/users/me).

func (*ApifyClient) RequestQueue

func (c *ApifyClient) RequestQueue(id string) *RequestQueueClient

RequestQueue returns a client for a specific request queue, addressed by ID or name.

func (*ApifyClient) RequestQueues

func (c *ApifyClient) RequestQueues() *RequestQueueCollectionClient

RequestQueues returns a client for the request queue collection.

func (*ApifyClient) Run

func (c *ApifyClient) Run(id string) *RunClient

Run returns a client for a specific Actor run.

func (*ApifyClient) Runs

func (c *ApifyClient) Runs() *RunCollectionClient

Runs returns a client for the Actor run collection (list runs).

func (*ApifyClient) Schedule

func (c *ApifyClient) Schedule(id string) *ScheduleClient

Schedule returns a client for a specific schedule.

func (*ApifyClient) Schedules

func (c *ApifyClient) Schedules() *ScheduleCollectionClient

Schedules returns a client for the schedule collection (list & create schedules).

func (*ApifyClient) SetStatusMessage

func (c *ApifyClient) SetStatusMessage(ctx context.Context, message string, isTerminal bool) (ActorRun, error)

SetStatusMessage sets the status message of the current Actor run.

This convenience method updates the run identified by the ACTOR_RUN_ID environment variable, so it only works when called from inside an Actor run. If isTerminal is true, the message becomes final and won't be overwritten. It returns an error if ACTOR_RUN_ID is not set.

func (*ApifyClient) Store

func (c *ApifyClient) Store() *StoreCollectionClient

Store returns a client for browsing the Apify Store.

func (*ApifyClient) Task

func (c *ApifyClient) Task(id string) *TaskClient

Task returns a client for a specific Actor task.

func (*ApifyClient) Tasks

func (c *ApifyClient) Tasks() *TaskCollectionClient

Tasks returns a client for the Actor task collection (list & create tasks).

func (*ApifyClient) User

func (c *ApifyClient) User(id string) *UserClient

User returns a client for a specific user by ID or username.

func (*ApifyClient) UserAgent

func (c *ApifyClient) UserAgent() string

UserAgent returns the User-Agent header value this client sends.

func (*ApifyClient) Webhook

func (c *ApifyClient) Webhook(id string) *WebhookClient

Webhook returns a client for a specific webhook.

func (*ApifyClient) WebhookDispatch

func (c *ApifyClient) WebhookDispatch(id string) *WebhookDispatchClient

WebhookDispatch returns a client for a specific webhook dispatch.

func (*ApifyClient) WebhookDispatches

func (c *ApifyClient) WebhookDispatches() *WebhookDispatchCollectionClient

WebhookDispatches returns a client for the webhook dispatch collection.

func (*ApifyClient) Webhooks

func (c *ApifyClient) Webhooks() *WebhookCollectionClient

Webhooks returns a client for the webhook collection (list & create webhooks).

type BatchAddResult

type BatchAddResult struct {
	// ProcessedRequests are the requests the API successfully added.
	ProcessedRequests []RequestQueueOperationInfo `json:"processedRequests"`
	// UnprocessedRequests are the requests the API did not process.
	UnprocessedRequests []RequestQueueRequest `json:"unprocessedRequests"`
}

BatchAddResult is the typed result of RequestQueueClient.BatchAddRequests: the requests the API accepted and the ones it could not process.

type Build

type Build struct {
	// ID is the unique build ID.
	ID string `json:"id"`
	// ActID is the ID of the Actor this build belongs to.
	ActID string `json:"actId"`
	// Status is the current build status.
	Status string `json:"status"`
	// StartedAt is when the build started.
	StartedAt *time.Time `json:"startedAt"`
	// FinishedAt is when the build finished (absent while still building).
	FinishedAt *time.Time `json:"finishedAt"`
	// BuildNumber is the human-readable build number (e.g. "0.1.2").
	BuildNumber string `json:"buildNumber"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Build is a single build of an Actor.

func (*Build) IsTerminal

func (b *Build) IsTerminal() bool

IsTerminal reports whether the build has reached a terminal (finished) status.

func (*Build) UnmarshalJSON

func (b *Build) UnmarshalJSON(data []byte) error

type BuildClient

type BuildClient struct {
	// contains filtered or unexported fields
}

BuildClient is a client for a specific Actor build (/v2/actor-builds/{buildId}).

func (*BuildClient) Abort

func (c *BuildClient) Abort(ctx context.Context) (Build, error)

Abort aborts the build and returns its updated state.

func (*BuildClient) Delete

func (c *BuildClient) Delete(ctx context.Context) error

Delete deletes the build.

func (*BuildClient) Get

func (c *BuildClient) Get(ctx context.Context) (Build, bool, error)

Get fetches the build object. The bool reports whether it exists.

func (*BuildClient) GetOpenAPIDefinition

func (c *BuildClient) GetOpenAPIDefinition(ctx context.Context) (json.RawMessage, bool, error)

GetOpenAPIDefinition returns the OpenAPI definition generated for the build, or (nil, false, nil) if it is not available. The result is the raw OpenAPI document.

func (*BuildClient) GetWithWait

func (c *BuildClient) GetWithWait(ctx context.Context, waitForFinishSecs *int64) (Build, bool, error)

GetWithWait fetches the build, optionally asking the API to wait up to waitForFinishSecs seconds (max 60) for the build to finish before responding. Pass nil for an immediate fetch. Mirrors the reference client's get({ waitForFinish }).

func (*BuildClient) Log

func (c *BuildClient) Log() *LogClient

Log returns a client for accessing this build's log.

func (*BuildClient) WaitForFinish

func (c *BuildClient) WaitForFinish(ctx context.Context, waitSecs *int64) (Build, error)

WaitForFinish polls until the build reaches a terminal state or waitSecs elapses (nil waits indefinitely). It returns the latest build.

type BuildCollectionClient

type BuildCollectionClient struct {
	// contains filtered or unexported fields
}

BuildCollectionClient is a client for a build collection: either the account-wide collection (GET /v2/actor-builds) or an Actor's builds (GET /v2/actors/{id}/builds).

func (*BuildCollectionClient) Iterate added in v0.7.0

func (c *BuildCollectionClient) Iterate(options ListOptions, chunkSize *int64) *ListIterator[Build]

Iterate returns a lazy iterator over the builds matching the options, fetching pages on demand. The options' Limit caps the total number of builds yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*BuildCollectionClient) List

List lists builds.

type Dataset

type Dataset struct {
	// ID is the unique dataset ID.
	ID string `json:"id"`
	// Name is the dataset name (empty for unnamed datasets).
	Name string `json:"name"`
	// UserID is the ID of the user who owns the dataset.
	UserID string `json:"userId"`
	// CreatedAt is when the dataset was created.
	CreatedAt *time.Time `json:"createdAt"`
	// ModifiedAt is when the dataset was last modified.
	ModifiedAt *time.Time `json:"modifiedAt"`
	// ItemCount is the number of items currently stored.
	ItemCount int64 `json:"itemCount"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Dataset stores structured results from Actor runs.

func (*Dataset) UnmarshalJSON

func (d *Dataset) UnmarshalJSON(data []byte) error

type DatasetClient

type DatasetClient struct {
	// contains filtered or unexported fields
}

DatasetClient is a client for a specific dataset (and run-nested variants).

func (*DatasetClient) CreateItemsPublicURL

func (c *DatasetClient) CreateItemsPublicURL(ctx context.Context, options DatasetListItemsOptions, expiresInSecs *int64) (string, error)

CreateItemsPublicURL builds a public URL for downloading this dataset's items.

It mirrors the reference client's createItemsPublicUrl: it fetches the dataset, and if the dataset exposes a URL-signing secret key (i.e. it is private), appends an HMAC-SHA256 signature so the URL grants access without an API token. expiresInSecs optionally bounds the validity of a signed URL (nil for non-expiring). The URL is built from the configured public base URL.

func (*DatasetClient) Delete

func (c *DatasetClient) Delete(ctx context.Context) error

Delete deletes the dataset.

func (*DatasetClient) DownloadItems

func (c *DatasetClient) DownloadItems(ctx context.Context, format DownloadItemsFormat, options DatasetDownloadOptions) ([]byte, error)

DownloadItems downloads dataset items serialized in the given format, returning the raw bytes. Unlike ListItems (parsed items), this returns the items already serialized to JSON, CSV, XLSX, XML, RSS or HTML — useful for exporting.

func (*DatasetClient) Get

func (c *DatasetClient) Get(ctx context.Context) (Dataset, bool, error)

Get fetches the dataset metadata. The bool reports whether it exists.

func (*DatasetClient) GetStatistics

func (c *DatasetClient) GetStatistics(ctx context.Context) (json.RawMessage, bool, error)

GetStatistics returns statistical information about the dataset, or (nil, false, nil) if unavailable.

func (*DatasetClient) IterateItems added in v0.7.0

func (c *DatasetClient) IterateItems(options DatasetListItemsOptions, chunkSize *int64) *ListIterator[json.RawMessage]

IterateItems returns a lazy iterator over the dataset's items, decoding each into a generic json.RawMessage. For typed decoding use IterateDatasetItems. See IterateDatasetItems for how the options' Limit (total cap) and chunkSize (page size) are interpreted, including the pagination-total lag caveat.

func (*DatasetClient) ListItems

ListItems lists items from the dataset, decoding each into a generic json.RawMessage. For typed decoding use ListDatasetItems.

func (*DatasetClient) PushItems

func (c *DatasetClient) PushItems(ctx context.Context, items any) error

PushItems pushes one or more items to the dataset. items must serialize to a JSON object or an array of objects.

func (*DatasetClient) Update

func (c *DatasetClient) Update(ctx context.Context, newFields any) (Dataset, error)

Update updates the dataset metadata (e.g. name, title) and returns the updated object.

type DatasetCollectionClient

type DatasetCollectionClient struct {
	// contains filtered or unexported fields
}

DatasetCollectionClient is a client for the dataset collection (GET/POST /v2/datasets).

func (*DatasetCollectionClient) GetOrCreate

func (c *DatasetCollectionClient) GetOrCreate(ctx context.Context, name string) (Dataset, error)

GetOrCreate gets the dataset with the given name, creating it if it does not exist. An empty name creates a new unnamed dataset.

func (*DatasetCollectionClient) Iterate added in v0.7.0

func (c *DatasetCollectionClient) Iterate(options StorageListOptions, chunkSize *int64) *ListIterator[Dataset]

Iterate returns a lazy iterator over the datasets matching the options, fetching pages on demand. The options' Limit caps the total number of datasets yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*DatasetCollectionClient) List

List lists datasets.

type DatasetDownloadOptions

type DatasetDownloadOptions struct {
	// Items holds the shared filtering/projection options.
	Items DatasetListItemsOptions
	// Attachment sets Content-Disposition: attachment on the response.
	Attachment *bool
	// Bom prepends a UTF-8 BOM (useful for Excel-compatible CSV).
	Bom *bool
	// Delimiter is the CSV field delimiter (default ",").
	Delimiter *string
	// SkipHeaderRow omits the CSV header row.
	SkipHeaderRow *bool
	// XMLRoot is the name of the root XML element (default "items").
	XMLRoot *string
	// XMLRow is the name of the per-item XML element (default "item").
	XMLRow *string
	// FeedTitle is the title used for RSS/Atom feed exports.
	FeedTitle *string
	// FeedDescription is the description used for RSS/Atom feed exports.
	FeedDescription *string
}

DatasetDownloadOptions adds format-specific options for DatasetClient.DownloadItems on top of the shared item filtering/projection options.

type DatasetListItemsOptions

type DatasetListItemsOptions struct {
	// Offset is the number of items to skip.
	Offset *int64
	// Limit is the maximum number of items to return.
	Limit *int64
	// Desc returns items newest-first.
	Desc *bool
	// Fields restricts the output to these fields.
	Fields []string
	// OutputFields positionally renames the fields selected by Fields in the output
	// (requires Fields). The i-th name becomes the output name of the i-th Fields entry.
	OutputFields []string
	// Omit excludes these fields from the output.
	Omit []string
	// SkipEmpty skips empty items.
	SkipEmpty *bool
	// SkipHidden skips hidden fields (those starting with "#").
	SkipHidden *bool
	// Clean returns only clean (non-empty, non-hidden) items.
	Clean *bool
	// Unwind expands these fields (each array element becomes a separate item).
	Unwind []string
	// Flatten flattens these nested fields into dot-notation keys.
	Flatten []string
	// View selects a predefined dataset view for field selection.
	View *string
	// Simplified returns simplified (flattened, cleaned) items.
	Simplified *bool
	// SkipFailedPages skips items that come from failed pages.
	SkipFailedPages *bool
	// Signature is a pre-shared URL signature granting access without an API token.
	Signature *string
}

DatasetListItemsOptions configures listing or downloading dataset items (GET /v2/datasets/{datasetId}/items).

type DefaultHTTPBackend

type DefaultHTTPBackend struct {
	// contains filtered or unexported fields
}

DefaultHTTPBackend is the default HTTPBackend implementation, backed by an *http.Client. The per-attempt timeout is applied via the request context by the orchestrating client, so this backend uses no client-level timeout of its own.

func NewDefaultHTTPBackend

func NewDefaultHTTPBackend() *DefaultHTTPBackend

NewDefaultHTTPBackend creates a backend with a sensible default *http.Client that keeps connections alive for connection-pool reuse.

func NewHTTPBackendWithClient

func NewHTTPBackendWithClient(client *http.Client) *DefaultHTTPBackend

NewHTTPBackendWithClient wraps a caller-provided *http.Client, useful for sharing a connection pool or customizing proxy/TLS settings.

func (*DefaultHTTPBackend) Do

Do implements HTTPBackend.

type DownloadItemsFormat

type DownloadItemsFormat string

DownloadItemsFormat is an output format for DatasetClient.DownloadItems.

const (
	// FormatJSON serializes items as a JSON array.
	FormatJSON DownloadItemsFormat = "json"
	// FormatJSONL serializes items as newline-delimited JSON.
	FormatJSONL DownloadItemsFormat = "jsonl"
	// FormatCSV serializes items as comma-separated values.
	FormatCSV DownloadItemsFormat = "csv"
	// FormatXLSX serializes items as a Microsoft Excel (XLSX) workbook.
	FormatXLSX DownloadItemsFormat = "xlsx"
	// FormatXML serializes items as XML.
	FormatXML DownloadItemsFormat = "xml"
	// FormatRSS serializes items as an RSS feed.
	FormatRSS DownloadItemsFormat = "rss"
	// FormatHTML serializes items as an HTML table.
	FormatHTML DownloadItemsFormat = "html"
)

type Extra

type Extra = map[string]json.RawMessage

Extra is the catch-all map of unmodelled JSON fields. Most resource models carry one so that unknown fields are preserved rather than dropped. Forward compatibility with additive API fields holds for every model regardless: the client never sets DisallowUnknownFields, so encoding/json silently ignores fields a model does not declare.

type GetRecordOptions

type GetRecordOptions struct {
	// Attachment, if set, controls the Content-Disposition: attachment behaviour.
	Attachment *bool
	// Signature is a pre-shared URL signature granting access without an API token.
	Signature *string
}

GetRecordOptions configures KeyValueStoreClient.GetRecordWithOptions.

type HTTPBackend

type HTTPBackend interface {
	// Do sends a single HTTP request and returns the response.
	Do(req *http.Request) (*http.Response, error)
}

HTTPBackend is the replaceable transport contract of the client.

Implementations are responsible only for sending a single request and returning the raw response. Authentication, the User-Agent header, retries and (de)serialization are handled by httpClient, so a backend only needs to perform one network round-trip.

A non-2xx HTTP status is NOT an error at this layer — return it as a normal *http.Response. Only transport-level failures (connection refused, DNS, timeout) should be returned as an error.

type KeyValueStore

type KeyValueStore struct {
	// ID is the unique store ID.
	ID string `json:"id"`
	// Name is the store name (empty for unnamed stores).
	Name string `json:"name"`
	// UserID is the ID of the user who owns the store.
	UserID string `json:"userId"`
	// CreatedAt is when the store was created.
	CreatedAt *time.Time `json:"createdAt"`
	// ModifiedAt is when the store was last modified.
	ModifiedAt *time.Time `json:"modifiedAt"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

KeyValueStore stores arbitrary data records.

func (*KeyValueStore) UnmarshalJSON

func (k *KeyValueStore) UnmarshalJSON(data []byte) error

type KeyValueStoreClient

type KeyValueStoreClient struct {
	// contains filtered or unexported fields
}

KeyValueStoreClient is a client for a specific key-value store (and run-nested variants).

func (*KeyValueStoreClient) CreateKeysPublicURL

func (c *KeyValueStoreClient) CreateKeysPublicURL(ctx context.Context, expiresInSecs *int64) (string, error)

CreateKeysPublicURL builds a public URL for listing this store's keys.

As with GetRecordPublicURL, a signature is appended for private stores. expiresInSecs optionally bounds the validity of a signed URL (nil for non-expiring).

func (*KeyValueStoreClient) Delete

func (c *KeyValueStoreClient) Delete(ctx context.Context) error

Delete deletes the store.

func (*KeyValueStoreClient) DeleteRecord

func (c *KeyValueStoreClient) DeleteRecord(ctx context.Context, key string) error

DeleteRecord deletes a record by key.

func (*KeyValueStoreClient) Get

Get fetches the store metadata. The bool reports whether it exists.

func (*KeyValueStoreClient) GetRecord

GetRecord fetches a record by key, or (nil, false, nil) if it does not exist. The value holds the raw bytes; the content type is reported in the record.

Like the reference client, it requests the record as an attachment (sent on the wire as attachment=1, the truthy form this client's bool serializer uses) so the API returns the record's raw bytes directly rather than redirecting. Use [GetRecordWithOptions] to override.

func (*KeyValueStoreClient) GetRecordPublicURL

func (c *KeyValueStoreClient) GetRecordPublicURL(ctx context.Context, key string) (string, error)

GetRecordPublicURL builds a public URL for fetching the given record.

It mirrors the reference client: it fetches the store, and if the store exposes a URL-signing secret key (i.e. it is private), appends an HMAC-SHA256 signature so the URL grants access without an API token. The URL is built from the configured public base URL.

func (*KeyValueStoreClient) GetRecordWithOptions

func (c *KeyValueStoreClient) GetRecordWithOptions(ctx context.Context, key string, options GetRecordOptions) (*KeyValueStoreRecord, bool, error)

GetRecordWithOptions fetches a record with explicit options (attachment, signature).

func (*KeyValueStoreClient) IterateKeys added in v0.7.0

func (c *KeyValueStoreClient) IterateKeys(options ListKeysOptions, chunkSize *int64) *KeyValueStoreKeysIterator

IterateKeys returns a lazy iterator over the store's keys, fetching one page at a time on demand via the cursor-based keys endpoint (exclusiveStartKey / nextExclusiveStartKey). It mirrors the reference client's async-iterable listKeys() and follows this client's iteration convention (like the collection Iterate helpers): the options' Limit caps the total number of keys yielded across all pages (unset means all keys), the per-page size is the separate chunkSize argument (nil for the server default), Prefix/Collection/Signature filter every page, and ExclusiveStartKey sets the key to start listing after. Limit uses the "0 == unset" convention: a nil Limit, or Limit set to ptr(0), yields all keys rather than zero keys.

Because keys are cursor-paginated (not offset/limit paginated) it uses its own KeyValueStoreKeysIterator rather than the generic ListIterator, sharing the cursor mechanics of RequestQueueClient.PaginateRequests.

func (*KeyValueStoreClient) ListKeys

ListKeys lists the keys stored in this key-value store.

func (*KeyValueStoreClient) RecordExists

func (c *KeyValueStoreClient) RecordExists(ctx context.Context, key string) (bool, error)

RecordExists reports whether a record with the given key exists.

func (*KeyValueStoreClient) SetRecordJSON

func (c *KeyValueStoreClient) SetRecordJSON(ctx context.Context, key string, value any) error

SetRecordJSON stores a record holding the JSON serialization of value.

func (*KeyValueStoreClient) SetRecordRaw

func (c *KeyValueStoreClient) SetRecordRaw(ctx context.Context, key string, value []byte, contentType string) error

SetRecordRaw stores a record with raw bytes and the given content type.

func (*KeyValueStoreClient) Update

func (c *KeyValueStoreClient) Update(ctx context.Context, newFields any) (KeyValueStore, error)

Update updates the store metadata (e.g. name) and returns the updated object.

type KeyValueStoreCollectionClient

type KeyValueStoreCollectionClient struct {
	// contains filtered or unexported fields
}

KeyValueStoreCollectionClient is a client for the key-value store collection (GET/POST /v2/key-value-stores).

func (*KeyValueStoreCollectionClient) GetOrCreate

GetOrCreate gets the store with the given name, creating it if it does not exist. An empty name creates a new unnamed store.

func (*KeyValueStoreCollectionClient) Iterate added in v0.7.0

Iterate returns a lazy iterator over the key-value stores matching the options, fetching pages on demand. The options' Limit caps the total number of stores yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*KeyValueStoreCollectionClient) List

List lists key-value stores.

type KeyValueStoreKey

type KeyValueStoreKey struct {
	// Key is the record key.
	Key string `json:"key"`
	// Size is the record size in bytes.
	Size int64 `json:"size"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

KeyValueStoreKey is a single key listed from a key-value store.

func (*KeyValueStoreKey) UnmarshalJSON

func (k *KeyValueStoreKey) UnmarshalJSON(data []byte) error

type KeyValueStoreKeysIterator added in v0.7.0

type KeyValueStoreKeysIterator struct {
	// contains filtered or unexported fields
}

KeyValueStoreKeysIterator lazily iterates over a key-value store's keys, fetching one page at a time via the cursor-based listing endpoint. Obtain one from KeyValueStoreClient.IterateKeys and drain it by calling Next until it returns (nil, nil).

func (*KeyValueStoreKeysIterator) Next added in v0.7.0

Next returns the next key, or (nil, nil) when the iterator is exhausted (no more keys or the total-item cap is reached). It calls the API for another page only when the current in-memory page is used up.

type KeyValueStoreKeysPage

type KeyValueStoreKeysPage struct {
	// Limit is the maximum number of keys requested.
	Limit int64 `json:"limit"`
	// IsTruncated reports whether more keys are available.
	IsTruncated bool `json:"isTruncated"`
	// ExclusiveStartKey is the key the listing started after.
	ExclusiveStartKey string `json:"exclusiveStartKey"`
	// NextExclusiveStartKey is the key to pass to fetch the next page.
	NextExclusiveStartKey string `json:"nextExclusiveStartKey"`
	// Items are the listed keys.
	Items []KeyValueStoreKey `json:"items"`
}

KeyValueStoreKeysPage is a page of keys from a key-value store.

type KeyValueStoreRecord

type KeyValueStoreRecord struct {
	// Key is the record key.
	Key string
	// Value is the raw record bytes.
	Value []byte
	// ContentType is the record's MIME type, as reported by the API.
	ContentType string
}

KeyValueStoreRecord is a single record retrieved from a key-value store. Its Value holds the raw bytes; callers can decode it according to ContentType.

type LastRunOptions

type LastRunOptions struct {
	// Status filters by run status (e.g. "SUCCEEDED", "FAILED", "RUNNING").
	Status string
	// Origin filters by how the run was started (e.g. "DEVELOPMENT", "WEB", "API", "SCHEDULER").
	Origin string
}

LastRunOptions filters which "last" run the ActorClient.LastRunWithOptions / TaskClient.LastRunWithOptions accessors resolve to. An empty field leaves that filter unset.

Origin is threaded to the runs/last endpoint as a documented query parameter of that endpoint in the OpenAPI spec, mirroring the reference client (lastRun({ origin })).

type ListIterator added in v0.7.0

type ListIterator[T any] struct {
	// contains filtered or unexported fields
}

ListIterator lazily iterates over an offset/limit-paginated collection, fetching one page at a time on demand. Obtain one from a collection client's Iterate method and drain it by calling Next until it returns (nil, nil).

Its end-user semantics match the reference JS client's iterable list(): the list options' Limit is a cap on the total number of items yielded across all pages (unset means "all matching items"), the page size is the separate chunkSize argument passed to Iterate (unset means the server default), and a caller-set Offset on the options is honored as the starting point (iteration begins there and yields at most Limit items from that offset onward). This keeps the two clients consistent for callers reasoning about offset/limit/chunk behaviour.

The Limit uses the "0 == unset" convention: a nil Limit, or Limit set to ptr(0), yields the whole collection (no cap), rather than zero items.

func IterateDatasetItems added in v0.7.0

func IterateDatasetItems[T any](c *DatasetClient, options DatasetListItemsOptions, chunkSize *int64) *ListIterator[T]

IterateDatasetItems returns a lazy iterator over the dataset's items, decoding each into T and fetching pages on demand. The options' Limit caps the total number of items yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable listItems().

Caveat: offset-based iteration paginates using the item total reported in the X-Apify-Pagination-Total header, and that header can lag right after items are pushed (the count is updated asynchronously). Iterating immediately after a push may therefore stop early (after one page) until the total settles. This matches the reference client's behaviour; wait for the total to converge before iterating a just-written dataset if completeness matters.

func (*ListIterator[T]) Next added in v0.7.0

func (it *ListIterator[T]) Next(ctx context.Context) (*T, error)

Next returns the next item, or (nil, nil) once the collection (or the total-item cap) is exhausted. It calls the API for another page only when the current in-memory page is used up.

type ListKeysOptions

type ListKeysOptions struct {
	// Limit is the maximum number of keys to return.
	Limit *int64
	// ExclusiveStartKey lists keys after this one (for pagination).
	ExclusiveStartKey *string
	// Prefix restricts the listing to keys with this prefix.
	Prefix *string
	// Collection restricts the listing to a named collection of keys.
	Collection *string
	// Signature is a pre-shared URL signature granting access without an API token.
	Signature *string
}

ListKeysOptions configures KeyValueStoreClient.ListKeys.

type ListOptions

type ListOptions struct {
	// Offset is the number of items to skip from the beginning of the list.
	Offset *int64
	// Limit is the maximum number of items to return.
	Limit *int64
	// Desc, if true, returns items newest-first.
	Desc *bool
}

ListOptions holds the standard offset/limit pagination shared by most list endpoints.

type ListRequestsOptions

type ListRequestsOptions struct {
	// Limit is the maximum number of requests to return.
	Limit *int64
	// ExclusiveStartID lists requests after this ID.
	ExclusiveStartID *string
	// Cursor is an opaque pagination cursor (alternative to ExclusiveStartID).
	Cursor *string
	// Filter restricts the listing to requests in the given states. Each value must be
	// "locked" or "pending" (see RequestFilterLocked / RequestFilterPending). Multiple
	// values are sent as a comma-separated list and mean the union of those states
	// (requests matching any of them are returned), matching the API.
	Filter []string
}

ListRequestsOptions configures RequestQueueClient.ListRequests.

type LogClient

type LogClient struct {
	// contains filtered or unexported fields
}

LogClient is a client for accessing the log of an Actor build or run (/v2/logs/{buildOrRunId}, or the run/build-nested .../log).

func (*LogClient) Get

func (c *LogClient) Get(ctx context.Context) (string, bool, error)

Get fetches the entire log as text, or ("", false, nil) if the log does not exist.

func (*LogClient) GetWithOptions

func (c *LogClient) GetWithOptions(ctx context.Context, options LogOptions) (string, bool, error)

GetWithOptions fetches the log with explicit options (raw, download).

func (*LogClient) Stream

func (c *LogClient) Stream(ctx context.Context) (io.ReadCloser, error)

Stream opens a live, streaming connection to the log and returns a reader over the log bytes. The caller is responsible for closing the returned io.ReadCloser.

Unlike LogClient.Get, this bypasses the buffered/retrying transport so the log can be followed in real time as the run produces it (the `stream=1` query parameter). Because the response is consumed incrementally, it is not retried; transient failures surface to the caller. This mirrors the reference clients' streamed-log behaviour used for log redirection.

func (*LogClient) StreamWithOptions

func (c *LogClient) StreamWithOptions(ctx context.Context, options LogOptions) (io.ReadCloser, error)

StreamWithOptions opens a live log stream with explicit options (raw, download). See LogClient.Stream for the streaming semantics.

type LogOptions

type LogOptions struct {
	// Raw, if true, returns the unprocessed log content (no platform post-processing).
	Raw *bool
	// Download, if true, sets Content-Disposition so the log is served as a download.
	Download *bool
}

LogOptions configures log retrieval/streaming.

type MetamorphOptions

type MetamorphOptions struct {
	// Build optionally pins the target Actor's build (empty for default).
	Build string
	// ContentType is the content type of the input body. Defaults to application/json.
	ContentType string
}

MetamorphOptions configures RunClient.Metamorph.

type Option

type Option func(*clientConfig)

Option configures an ApifyClient. Pass options to NewClient.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the base URL of the API. The /v2 suffix is appended automatically. Defaults to https://api.apify.com.

func WithHTTPBackend

func WithHTTPBackend(backend HTTPBackend) Option

WithHTTPBackend replaces the default HTTP backend with a custom implementation. This is the seam that makes the transport a replaceable component.

func WithMaxRetries

func WithMaxRetries(maxRetries int) Option

WithMaxRetries sets the maximum number of retries for failed requests (default 8).

func WithMinDelayBetweenRetries

func WithMinDelayBetweenRetries(d time.Duration) Option

WithMinDelayBetweenRetries sets the minimum delay between retries (default 500ms).

func WithPublicBaseURL

func WithPublicBaseURL(publicBaseURL string) Option

WithPublicBaseURL overrides the base URL used when building public, shareable resource URLs (e.g. a signed dataset-items URL). Defaults to the API base URL. The /v2 suffix is appended automatically.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the overall per-request timeout (default 360s).

func WithToken

func WithToken(token string) Option

WithToken sets the API token used for authentication (sent as a Bearer token).

func WithUserAgentSuffix

func WithUserAgentSuffix(suffix string) Option

WithUserAgentSuffix appends a custom suffix to the User-Agent header.

type PaginationList

type PaginationList[T any] struct {
	// Total is the total number of items available across all pages.
	Total int64 `json:"total"`
	// Offset is the number of items skipped at the start.
	Offset int64 `json:"offset"`
	// Limit is the maximum number of items the API would return for this request.
	Limit int64 `json:"limit"`
	// Count is the number of items actually returned in this page.
	Count int64 `json:"count"`
	// Desc reports whether the items are in descending order.
	Desc bool `json:"desc"`
	// Items are the items of this page.
	Items []T `json:"items"`
}

PaginationList is a single page of an offset/limit-paginated list.

The pagination metadata (Total, Offset, Limit, Count, Desc) accompanies the Items slice. Note: Total reflects the API's reported total, which can briefly lag immediately after a write (e.g. right after PushItems) because the count is computed asynchronously — re-read after a short delay if you need an exact post-write total.

func ListDatasetItems

func ListDatasetItems[T any](ctx context.Context, c *DatasetClient, options DatasetListItemsOptions) (PaginationList[T], error)

ListDatasetItems lists a single page of items from the dataset, decoding each into T (e.g. json.RawMessage or a struct).

The dataset items endpoint returns a bare JSON array (not a data envelope) and reports pagination via X-Apify-Pagination-* headers, which are surfaced in the returned PaginationList.

type QueryParams

type QueryParams struct {
	// contains filtered or unexported fields
}

QueryParams is an ordered collection of query parameters that omits absent values and encodes booleans as 1/0, matching the Apify API conventions.

func NewQueryParams

func NewQueryParams() *QueryParams

NewQueryParams returns an empty QueryParams.

func (*QueryParams) AddBool

func (q *QueryParams) AddBool(key string, value *bool) *QueryParams

AddBool adds a boolean parameter, encoded as 1/0, if value is non-nil.

func (*QueryParams) AddCSV

func (q *QueryParams) AddCSV(key string, value []string) *QueryParams

AddCSV adds a comma-joined list parameter if value is non-empty.

func (*QueryParams) AddFloat

func (q *QueryParams) AddFloat(key string, value *float64) *QueryParams

AddFloat adds a floating-point parameter if value is non-nil.

func (*QueryParams) AddInt

func (q *QueryParams) AddInt(key string, value *int64) *QueryParams

AddInt adds an integer parameter if value is non-nil.

func (*QueryParams) AddString

func (q *QueryParams) AddString(key string, value *string) *QueryParams

AddString adds a string parameter if value is non-nil.

func (*QueryParams) IsEmpty

func (q *QueryParams) IsEmpty() bool

IsEmpty reports whether no parameters were added.

type RequestQueue

type RequestQueue struct {
	// ID is the unique queue ID.
	ID string `json:"id"`
	// Name is the queue name (empty for unnamed queues).
	Name string `json:"name"`
	// UserID is the ID of the user who owns the queue.
	UserID string `json:"userId"`
	// CreatedAt is when the queue was created.
	CreatedAt *time.Time `json:"createdAt"`
	// ModifiedAt is when the queue was last modified.
	ModifiedAt *time.Time `json:"modifiedAt"`
	// TotalRequestCount is the total number of requests ever added.
	TotalRequestCount int64 `json:"totalRequestCount"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

RequestQueue stores URLs to be crawled.

func (*RequestQueue) UnmarshalJSON

func (q *RequestQueue) UnmarshalJSON(data []byte) error

type RequestQueueClient

type RequestQueueClient struct {
	// contains filtered or unexported fields
}

RequestQueueClient is a client for a specific request queue (and run-nested variants).

func (*RequestQueueClient) AddRequest

func (c *RequestQueueClient) AddRequest(ctx context.Context, request RequestQueueRequest, forefront bool) (RequestQueueOperationInfo, error)

AddRequest adds a request to the queue. If forefront is true, the request is added to the front of the queue.

func (*RequestQueueClient) BatchAddRequests

func (c *RequestQueueClient) BatchAddRequests(ctx context.Context, requests []RequestQueueRequest, forefront bool) (BatchAddResult, error)

BatchAddRequests adds multiple requests to the queue. If forefront is true, they are added to the front of the queue.

The input is automatically split into chunks of at most 25 requests (the API limit), and the per-chunk results are merged into a single BatchAddResult. Each chunk is still subject to the client's standard retry policy.

func (*RequestQueueClient) BatchDeleteRequests

func (c *RequestQueueClient) BatchDeleteRequests(ctx context.Context, requests any) (json.RawMessage, error)

BatchDeleteRequests deletes multiple requests in a single call. Each entry identifies a request (e.g. by id or uniqueKey). Returns the raw batch result.

func (*RequestQueueClient) Delete

func (c *RequestQueueClient) Delete(ctx context.Context) error

Delete deletes the queue.

func (*RequestQueueClient) DeleteRequest

func (c *RequestQueueClient) DeleteRequest(ctx context.Context, id string) error

DeleteRequest deletes a request by ID.

func (*RequestQueueClient) DeleteRequestLock

func (c *RequestQueueClient) DeleteRequestLock(ctx context.Context, id string, forefront bool) error

DeleteRequestLock releases the lock on a request. If forefront is true, the request is moved to the front of the queue.

func (*RequestQueueClient) Get

Get fetches the queue metadata. The bool reports whether it exists.

func (*RequestQueueClient) GetRequest

GetRequest fetches a request by ID, or (nil, false, nil) if it does not exist.

func (*RequestQueueClient) ListAndLockHead

func (c *RequestQueueClient) ListAndLockHead(ctx context.Context, lockSecs int64, limit *int64) (json.RawMessage, error)

ListAndLockHead atomically returns and locks up to limit requests from the head of the queue for lockSecs seconds. Returns the raw API response (a locked-head object).

func (*RequestQueueClient) ListHead

func (c *RequestQueueClient) ListHead(ctx context.Context, limit *int64) (RequestQueueHead, error)

ListHead returns the requests at the head (front) of the queue, up to limit (nil for the server default).

func (*RequestQueueClient) ListRequests

func (c *RequestQueueClient) ListRequests(ctx context.Context, options ListRequestsOptions) (json.RawMessage, error)

ListRequests lists the queue's requests with pagination.

func (*RequestQueueClient) PaginateRequests

func (c *RequestQueueClient) PaginateRequests(pageLimit *int64) *RequestQueueRequestsIterator

PaginateRequests returns a lazy iterator over all requests in the queue, fetching pages of up to pageLimit requests at a time (nil for the server default).

func (*RequestQueueClient) ProlongRequestLock

func (c *RequestQueueClient) ProlongRequestLock(ctx context.Context, id string, lockSecs int64, forefront bool) (json.RawMessage, error)

ProlongRequestLock extends the lock on a request by lockSecs seconds. If forefront is true, the request is moved to the front when its lock expires. Returns the raw response.

func (*RequestQueueClient) UnlockRequests

func (c *RequestQueueClient) UnlockRequests(ctx context.Context) (json.RawMessage, error)

UnlockRequests releases all locks the client holds on this queue's requests. Returns the raw response.

func (*RequestQueueClient) Update

func (c *RequestQueueClient) Update(ctx context.Context, newFields any) (RequestQueue, error)

Update updates the queue metadata (e.g. name) and returns the updated object.

func (*RequestQueueClient) UpdateRequest

func (c *RequestQueueClient) UpdateRequest(ctx context.Context, request RequestQueueRequest, forefront bool) (RequestQueueOperationInfo, error)

UpdateRequest updates an existing request (identified by its ID field) and returns the operation info. If forefront is true, the request is moved to the front of the queue.

func (*RequestQueueClient) WithClientKey

func (c *RequestQueueClient) WithClientKey(clientKey string) *RequestQueueClient

WithClientKey returns a copy of the client that identifies its requests with clientKey.

A stable client key is required to operate on locks the client itself created (e.g. to unlock its own requests), and lets the API detect whether multiple clients access a queue.

type RequestQueueCollectionClient

type RequestQueueCollectionClient struct {
	// contains filtered or unexported fields
}

RequestQueueCollectionClient is a client for the request queue collection (GET/POST /v2/request-queues).

func (*RequestQueueCollectionClient) GetOrCreate

GetOrCreate gets the queue with the given name, creating it if it does not exist. An empty name creates a new unnamed queue.

func (*RequestQueueCollectionClient) Iterate added in v0.7.0

Iterate returns a lazy iterator over the request queues matching the options, fetching pages on demand. The options' Limit caps the total number of queues yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*RequestQueueCollectionClient) List

List lists request queues.

type RequestQueueHead

type RequestQueueHead struct {
	// Limit is the maximum number of requests requested.
	Limit int64 `json:"limit"`
	// HadMultipleClients reports whether multiple clients have accessed the queue.
	HadMultipleClients bool `json:"hadMultipleClients"`
	// Items are the requests at the head of the queue.
	Items []RequestQueueRequest `json:"items"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

RequestQueueHead is the head (front) of a request queue.

func (*RequestQueueHead) UnmarshalJSON

func (h *RequestQueueHead) UnmarshalJSON(data []byte) error

type RequestQueueOperationInfo

type RequestQueueOperationInfo struct {
	// RequestID is the ID of the affected request.
	RequestID string `json:"requestId"`
	// WasAlreadyPresent reports whether the request was already in the queue.
	WasAlreadyPresent bool `json:"wasAlreadyPresent"`
	// WasAlreadyHandled reports whether the request had already been handled.
	WasAlreadyHandled bool `json:"wasAlreadyHandled"`
}

RequestQueueOperationInfo is returned when adding or updating a request.

type RequestQueueRequest

type RequestQueueRequest struct {
	// ID is the unique request ID (assigned by the API; omitted on create).
	ID string `json:"id,omitempty"`
	// URL is the request URL.
	URL string `json:"url"`
	// UniqueKey is the deduplication key for the request.
	UniqueKey string `json:"uniqueKey,omitempty"`
	// Method is the HTTP method (e.g. "GET", "POST").
	Method string `json:"method,omitempty"`
	// UserData is arbitrary user-attached metadata.
	UserData json.RawMessage `json:"userData,omitempty"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

RequestQueueRequest is a single request stored in a request queue.

func (*RequestQueueRequest) UnmarshalJSON

func (r *RequestQueueRequest) UnmarshalJSON(data []byte) error

type RequestQueueRequestsIterator

type RequestQueueRequestsIterator struct {
	// contains filtered or unexported fields
}

RequestQueueRequestsIterator lazily iterates over a request queue's requests, fetching one page at a time via the cursor-based listing endpoint.

func (*RequestQueueRequestsIterator) Next

Next returns the next request, or (nil, nil) when the iterator is exhausted.

type RunChargeOptions

type RunChargeOptions struct {
	// EventName is the name of the event to charge for. Required.
	EventName string
	// Count is the number of times to charge the event (defaults to 1).
	Count *int64
	// IdempotencyKey deduplicates the charge across retries. If empty, one is auto-generated
	// as "{runId}-{eventName}-{timestampMillis}-{random}", matching the reference client.
	IdempotencyKey string
}

RunChargeOptions configures RunClient.Charge.

type RunClient

type RunClient struct {
	// contains filtered or unexported fields
}

RunClient is a client for a specific Actor run.

It provides CRUD methods plus convenience helpers (abort, metamorph, reboot, resurrect, charge, wait-for-finish) and accessors for the run's default storages and log.

func (*RunClient) Abort

func (c *RunClient) Abort(ctx context.Context, gracefully *bool) (ActorRun, error)

Abort aborts the run. If gracefully points to true, the run is sent a signal so it can finish the current request before terminating; if false it is aborted immediately. Pass nil to omit the parameter entirely and let the server apply its default (immediate abort), matching the reference client's optional `gracefully` option.

func (*RunClient) Charge

func (c *RunClient) Charge(ctx context.Context, options RunChargeOptions) error

Charge charges for a pay-per-event Actor run: it records occurrences of a named event. Only meaningful for runs of pay-per-event Actors.

An idempotency key is always sent (auto-generated if not provided), so a charge that is retried by the transport is applied at most once, matching the reference client.

func (*RunClient) Dataset

func (c *RunClient) Dataset() *DatasetClient

Dataset returns a client for this run's default dataset.

func (*RunClient) Delete

func (c *RunClient) Delete(ctx context.Context) error

Delete deletes the run.

func (*RunClient) Get

func (c *RunClient) Get(ctx context.Context) (ActorRun, bool, error)

Get fetches the run object. The bool reports whether it exists.

func (*RunClient) GetStreamedLog

func (c *RunClient) GetStreamedLog(ctx context.Context) (io.ReadCloser, error)

GetStreamedLog opens a live stream of this run's raw log, for convenient log redirection.

It is a convenience wrapper over Log().StreamWithOptions with raw=true (matching the reference client's getStreamedLog, which streams raw log content). The caller must close the returned reader.

func (*RunClient) GetWithWait

func (c *RunClient) GetWithWait(ctx context.Context, waitForFinishSecs *int64) (ActorRun, bool, error)

GetWithWait fetches the run, optionally asking the API to wait up to waitForFinishSecs seconds (max 60) for the run to reach a terminal state before responding. Pass nil for an immediate fetch. Mirrors the reference client's get({ waitForFinish }).

func (*RunClient) KeyValueStore

func (c *RunClient) KeyValueStore() *KeyValueStoreClient

KeyValueStore returns a client for this run's default key-value store.

func (*RunClient) Log

func (c *RunClient) Log() *LogClient

Log returns a client for accessing this run's log.

func (*RunClient) Metamorph

func (c *RunClient) Metamorph(ctx context.Context, targetActorID string, input any, options MetamorphOptions) (ActorRun, error)

Metamorph transforms the run into a run of another Actor with a new input.

targetActorID is the Actor to metamorph into. input is the new input (nil for none).

func (*RunClient) Reboot

func (c *RunClient) Reboot(ctx context.Context) (ActorRun, error)

Reboot reboots the run (restarts its container while keeping the same run).

func (*RunClient) RequestQueue

func (c *RunClient) RequestQueue() *RequestQueueClient

RequestQueue returns a client for this run's default request queue.

func (*RunClient) Resurrect

func (c *RunClient) Resurrect(ctx context.Context, options RunResurrectOptions) (ActorRun, error)

Resurrect resurrects a finished run, starting it again from the beginning.

func (*RunClient) Update

func (c *RunClient) Update(ctx context.Context, newFields any) (ActorRun, error)

Update updates the run with the given fields and returns the updated object.

func (*RunClient) WaitForFinish

func (c *RunClient) WaitForFinish(ctx context.Context, waitSecs *int64) (ActorRun, error)

WaitForFinish polls until the run reaches a terminal state or waitSecs elapses (nil waits indefinitely). It returns the latest run.

type RunCollectionClient

type RunCollectionClient struct {
	// contains filtered or unexported fields
}

RunCollectionClient is a client for a run collection: the account-wide collection (GET /v2/actor-runs), an Actor's runs (GET /v2/actors/{id}/runs), or a task's runs (GET /v2/actor-tasks/{id}/runs).

func (*RunCollectionClient) Iterate added in v0.7.0

func (c *RunCollectionClient) Iterate(options ListOptions, filter RunListOptions, chunkSize *int64) *ListIterator[ActorRun]

Iterate returns a lazy iterator over the runs matching the options and filter, fetching pages on demand. The options' Limit caps the total number of runs yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*RunCollectionClient) List

List lists runs, applying the standard pagination and the run-specific filters.

type RunListOptions

type RunListOptions struct {
	// Status filters by one or more run statuses (e.g. "SUCCEEDED", "RUNNING"). Sent as a
	// comma-separated list, as the API accepts.
	Status []string
	// StartedAfter filters to runs started after this ISO-8601 timestamp.
	StartedAfter *string
	// StartedBefore filters to runs started before this ISO-8601 timestamp.
	StartedBefore *string
}

RunListOptions adds run-specific filters on top of ListOptions for RunCollectionClient.List. The startedAfter/startedBefore filters are only honoured by the Actor-scoped and task-scoped run collections.

type RunResurrectOptions

type RunResurrectOptions struct {
	// Build is the tag or number of the build to resurrect with.
	Build *string
	// MemoryMbytes is the memory in megabytes to allocate.
	MemoryMbytes *int64
	// TimeoutSecs is the run timeout in seconds.
	TimeoutSecs *int64
	// MaxItems is the maximum number of dataset items to charge (pay-per-result Actors).
	MaxItems *int64
	// MaxTotalChargeUsd is the maximum total charge in USD (pay-per-event Actors).
	MaxTotalChargeUsd *float64
	// RestartOnError, if true, restarts the run if it fails.
	RestartOnError *bool
}

RunResurrectOptions configures RunClient.Resurrect.

type Schedule

type Schedule struct {
	// ID is the unique schedule ID.
	ID string `json:"id"`
	// UserID is the ID of the user who owns the schedule.
	UserID string `json:"userId"`
	// Name is the schedule name.
	Name string `json:"name"`
	// CronExpression is the cron expression governing when the schedule fires.
	CronExpression string `json:"cronExpression"`
	// IsEnabled reports whether the schedule is currently active.
	IsEnabled bool `json:"isEnabled"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Schedule automatically starts Actor or task runs at specified times.

func (*Schedule) UnmarshalJSON

func (s *Schedule) UnmarshalJSON(data []byte) error

type ScheduleClient

type ScheduleClient struct {
	// contains filtered or unexported fields
}

ScheduleClient is a client for a specific schedule (/v2/schedules/{scheduleId}).

func (*ScheduleClient) Delete

func (c *ScheduleClient) Delete(ctx context.Context) error

Delete deletes the schedule.

func (*ScheduleClient) Get

func (c *ScheduleClient) Get(ctx context.Context) (Schedule, bool, error)

Get fetches the schedule. The bool reports whether it exists.

func (*ScheduleClient) GetLog

func (c *ScheduleClient) GetLog(ctx context.Context) (string, bool, error)

GetLog fetches the schedule's invocation log as text, or (\"\", false, nil) if absent.

func (*ScheduleClient) Update

func (c *ScheduleClient) Update(ctx context.Context, newFields any) (Schedule, error)

Update updates the schedule with the given fields and returns the updated object.

type ScheduleCollectionClient

type ScheduleCollectionClient struct {
	// contains filtered or unexported fields
}

ScheduleCollectionClient is a client for the schedule collection (GET/POST /v2/schedules).

func (*ScheduleCollectionClient) Create

func (c *ScheduleCollectionClient) Create(ctx context.Context, schedule any) (Schedule, error)

Create creates a new schedule. schedule is any JSON-serializable schedule definition.

func (*ScheduleCollectionClient) Iterate added in v0.7.0

func (c *ScheduleCollectionClient) Iterate(options ListOptions, chunkSize *int64) *ListIterator[Schedule]

Iterate returns a lazy iterator over the schedules matching the options, fetching pages on demand. The options' Limit caps the total number of schedules yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*ScheduleCollectionClient) List

List lists the account's schedules.

type StorageListOptions

type StorageListOptions struct {
	// Offset is the number of items to skip from the beginning of the list.
	Offset *int64
	// Limit is the maximum number of items to return.
	Limit *int64
	// Desc, if true, returns items newest-first.
	Desc *bool
	// Unnamed, if true, includes unnamed storages in the result.
	Unnamed *bool
	// Ownership filters by ownership (e.g. "OWNED" / "ACCESSIBLE").
	Ownership *string
}

StorageListOptions holds the options shared by the storage collection list endpoints (GET /v2/datasets, /v2/key-value-stores, /v2/request-queues), which add `unnamed` and `ownership` filters on top of the standard pagination.

type StoreActorIterator

type StoreActorIterator = ListIterator[ActorStoreListItem]

StoreActorIterator lazily iterates over Apify Store Actors, fetching one page at a time. It is the generic ListIterator specialized to Store Actors; drain it with Next.

type StoreCollectionClient

type StoreCollectionClient struct {
	// contains filtered or unexported fields
}

StoreCollectionClient is a client for browsing the Apify Store (GET /v2/store).

func (*StoreCollectionClient) Iterate

func (c *StoreCollectionClient) Iterate(options StoreListOptions, chunkSize *int64) *StoreActorIterator

Iterate returns a lazy iterator over the Store Actors matching the options, fetching pages on demand. The options' Limit caps the total number of Actors yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*StoreCollectionClient) List

List returns a single page of Store Actors matching the options.

type StoreListOptions

type StoreListOptions struct {
	// Offset is the number of Actors to skip.
	Offset *int64
	// Limit is the maximum number of Actors to return.
	Limit *int64
	// Search filters Actors by a full-text search query.
	Search *string
	// SortBy sets the sort field (e.g. "popularity", "newest").
	SortBy *string
	// Category filters Actors by category.
	Category *string
	// Username filters Actors by owner username.
	Username *string
	// PricingModel filters Actors by pricing model (e.g. "FREE", "FLAT_PRICE_PER_MONTH").
	PricingModel *string
	// IncludeUnrunnableActors includes Actors the current user cannot run.
	IncludeUnrunnableActors *bool
	// AllowsAgenticUsers filters to Actors that allow agentic users.
	AllowsAgenticUsers *bool
	// ResponseFormat selects the response format.
	ResponseFormat *string
}

StoreListOptions configures listing/iterating the Apify Store.

type Task

type Task struct {
	// ID is the unique task ID.
	ID string `json:"id"`
	// ActID is the ID of the Actor this task runs.
	ActID string `json:"actId"`
	// UserID is the ID of the user who owns the task.
	UserID string `json:"userId"`
	// Name is the technical name of the task.
	Name string `json:"name"`
	// Title is the human-readable title shown in the UI.
	Title string `json:"title"`
	// CreatedAt is when the task was created.
	CreatedAt *time.Time `json:"createdAt"`
	// ModifiedAt is when the task was last modified.
	ModifiedAt *time.Time `json:"modifiedAt"`
	// IsPublic reports whether the task is published on its public landing page. It is not part
	// of the documented Task schema in the OpenAPI spec, but the API returns it in practice
	// (mirroring the reference JS client); use TaskClient.Publish/Unpublish to change it.
	IsPublic *bool `json:"isPublic,omitempty"`
	// PublicConfig is the public-facing display configuration of the task's landing page, set
	// when the task has been configured for publishing (nil otherwise).
	PublicConfig *TaskPublicConfig `json:"publicConfig,omitempty"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Task is a pre-configured Actor run (an Actor task).

func (*Task) UnmarshalJSON

func (t *Task) UnmarshalJSON(data []byte) error

type TaskClient

type TaskClient struct {
	// contains filtered or unexported fields
}

TaskClient is a client for a specific Actor task.

Tasks are pre-configured Actor runs with stored input. The client provides CRUD methods plus convenience helpers to start/call the task and access its input, runs and webhooks.

func (*TaskClient) Call

func (c *TaskClient) Call(ctx context.Context, input any, options TaskStartOptions, waitSecs *int64) (ActorRun, error)

Call starts the task and waits (client-side polling) for it to finish. waitSecs bounds the wait; nil waits indefinitely.

func (*TaskClient) Delete

func (c *TaskClient) Delete(ctx context.Context) error

Delete deletes the task.

func (*TaskClient) Get

func (c *TaskClient) Get(ctx context.Context) (Task, bool, error)

Get fetches the task object. The bool reports whether it exists.

func (*TaskClient) GetInput

func (c *TaskClient) GetInput(ctx context.Context) (json.RawMessage, bool, error)

GetInput fetches the task's stored input, or (nil, false, nil) if none is set.

func (*TaskClient) LastRun

func (c *TaskClient) LastRun(status string) *RunClient

LastRun returns a client for the last run of this task, optionally filtered by status (e.g. "SUCCEEDED"). Pass an empty status for no filter.

To also filter by run origin, use LastRunWithOptions.

func (*TaskClient) LastRunWithOptions

func (c *TaskClient) LastRunWithOptions(options LastRunOptions) *RunClient

LastRunWithOptions returns a client for the last run of this task, optionally filtered by status and/or origin. See LastRunOptions. Mirrors the reference client's lastRun({ status, origin }).

func (*TaskClient) Publish added in v0.8.0

func (c *TaskClient) Publish(ctx context.Context) (Task, error)

Publish publishes the task on its public landing page by setting IsPublic through Update.

The task's Actor must be public and the task must already have its public display configuration (PublicConfig) set up. Requires write permission to both the task and its Actor. Publishing an already published task does nothing.

func (*TaskClient) Runs

func (c *TaskClient) Runs() *RunCollectionClient

Runs returns a client for this task's run collection.

func (*TaskClient) Start

func (c *TaskClient) Start(ctx context.Context, input any, options TaskStartOptions) (ActorRun, error)

Start starts the task and returns immediately with the created run. input optionally overrides the task's stored input (nil to use the stored input).

func (*TaskClient) Unpublish added in v0.8.0

func (c *TaskClient) Unpublish(ctx context.Context) (Task, error)

Unpublish unpublishes the task from its public landing page by setting IsPublic through Update.

The public display configuration (PublicConfig) is preserved, so the task can be published again without re-entering it. Requires write permission to both the task and its Actor. Unpublishing a task that is not published does nothing.

func (*TaskClient) Update

func (c *TaskClient) Update(ctx context.Context, newFields any) (Task, error)

Update updates the task with the given fields and returns the updated object.

func (*TaskClient) UpdateInput

func (c *TaskClient) UpdateInput(ctx context.Context, input any) (json.RawMessage, error)

UpdateInput replaces the task's stored input and returns the updated input.

func (*TaskClient) Webhooks

func (c *TaskClient) Webhooks() *WebhookCollectionClient

Webhooks returns a client for this task's webhook collection.

type TaskCollectionClient

type TaskCollectionClient struct {
	// contains filtered or unexported fields
}

TaskCollectionClient is a client for the Actor task collection (GET/POST /v2/actor-tasks).

func (*TaskCollectionClient) Create

func (c *TaskCollectionClient) Create(ctx context.Context, task any) (Task, error)

Create creates a new task. task is any JSON-serializable task definition.

func (*TaskCollectionClient) Iterate added in v0.7.0

func (c *TaskCollectionClient) Iterate(options ListOptions, chunkSize *int64) *ListIterator[Task]

Iterate returns a lazy iterator over the tasks matching the options, fetching pages on demand. The options' Limit caps the total number of tasks yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*TaskCollectionClient) List

List lists the account's tasks.

type TaskPublicConfig added in v0.8.0

type TaskPublicConfig struct {
	// PublishedAt is when the task was published, or nil if it is not published.
	PublishedAt *time.Time `json:"publishedAt"`
	// SEOTitle is the title shown in search-engine results for the landing page.
	SEOTitle *string `json:"seoTitle,omitempty"`
	// SEODescription is the description shown in search-engine results for the landing page.
	SEODescription *string `json:"seoDescription,omitempty"`
	// Categorization is a free-form category label for the landing page.
	Categorization *string `json:"categorization,omitempty"`
	// InputSchemaFields lists the input schema field names highlighted on the landing page.
	InputSchemaFields []string `json:"inputSchemaFields,omitempty"`
	// DatasetName is the display name used for the task's default dataset on the landing page.
	DatasetName *string `json:"datasetName,omitempty"`
	// DatasetView is the name of the dataset view shown on the landing page.
	DatasetView *string `json:"datasetView,omitempty"`
}

TaskPublicConfig is the public-facing display configuration of a task's public landing page.

The task is published when PublishedAt is set and unpublished when it is nil. PublishedAt is read-only from the client's perspective; use TaskClient.Publish/Unpublish to change the publication state.

type TaskStartOptions

type TaskStartOptions struct {
	// Build is the tag or number of the build to run (e.g. "latest", "0.1.2").
	Build *string
	// MemoryMbytes is the memory in megabytes allocated for the run.
	MemoryMbytes *int64
	// TimeoutSecs is the timeout for the run in seconds (0 means no timeout).
	TimeoutSecs *int64
	// WaitForFinish is the maximum seconds to wait server-side for the run to finish (max 60).
	WaitForFinish *int64
	// MaxItems is the maximum number of dataset items to charge (pay-per-result Actors).
	MaxItems *int64
	// MaxTotalChargeUsd is the maximum total charge in USD (pay-per-event Actors).
	MaxTotalChargeUsd *float64
	// RestartOnError, if true, restarts the run if it fails.
	RestartOnError *bool
	// Webhooks are ad-hoc webhooks to attach to this run (base64-encoded JSON).
	Webhooks []any
}

TaskStartOptions configures starting a task run (TaskClient.Start/TaskClient.Call).

It mirrors ActorStartOptions but omits the fields the task run endpoint does not accept (the Actor-only `contentType` and `forcePermissionLevel`), matching the reference client.

type User

type User struct {
	// ID is the unique user ID.
	ID string `json:"id"`
	// Username is the user's username.
	Username string `json:"username"`
	// Extra holds any other fields returned by the API (private details for "me").
	Extra Extra `json:"-"`
}

User is an Apify user account.

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(data []byte) error

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for accessing user data (/v2/users/{userId} or /v2/users/me).

For the current user ("me"), it also exposes account usage and limits. Those endpoints only exist for "me" and return an error if called on another user's client.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context) (User, bool, error)

Get fetches the user. For "me" it returns private account details; for other users it returns the public profile. The bool reports whether the user exists.

func (*UserClient) Limits

func (c *UserClient) Limits(ctx context.Context) (json.RawMessage, error)

Limits fetches the current account's resource limits. Only available for "me".

func (*UserClient) MonthlyUsage

func (c *UserClient) MonthlyUsage(ctx context.Context) (json.RawMessage, error)

MonthlyUsage fetches the current account's monthly usage for the current month. Only available for "me".

It returns the raw JSON usage report from the API (a JSON object with the account's usage breakdown and totals for the period).

func (*UserClient) UpdateLimits

func (c *UserClient) UpdateLimits(ctx context.Context, newLimits any) error

UpdateLimits updates the current account's resource limits. Only available for "me".

type Webhook

type Webhook struct {
	// ID is the unique webhook ID.
	ID string `json:"id"`
	// UserID is the ID of the user who owns the webhook.
	UserID string `json:"userId"`
	// RequestURL is the URL the webhook posts to.
	RequestURL string `json:"requestUrl"`
	// EventTypes are the events that trigger the webhook.
	EventTypes []string `json:"eventTypes"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

Webhook notifies an external service when specific events occur.

func (*Webhook) UnmarshalJSON

func (w *Webhook) UnmarshalJSON(data []byte) error

type WebhookClient

type WebhookClient struct {
	// contains filtered or unexported fields
}

WebhookClient is a client for a specific webhook (/v2/webhooks/{webhookId}).

func (*WebhookClient) Delete

func (c *WebhookClient) Delete(ctx context.Context) error

Delete deletes the webhook.

func (*WebhookClient) Dispatches

Dispatches returns a client for this webhook's dispatch collection.

func (*WebhookClient) Get

func (c *WebhookClient) Get(ctx context.Context) (Webhook, bool, error)

Get fetches the webhook. The bool reports whether it exists.

func (*WebhookClient) Test

Test dispatches the webhook immediately and returns the resulting dispatch.

func (*WebhookClient) Update

func (c *WebhookClient) Update(ctx context.Context, newFields any) (Webhook, error)

Update updates the webhook with the given fields and returns the updated object.

type WebhookCollectionClient

type WebhookCollectionClient struct {
	// contains filtered or unexported fields
}

WebhookCollectionClient is a client for a webhook collection: the account-wide collection (GET/POST /v2/webhooks) or webhooks nested under an Actor or task (read-only there).

func (*WebhookCollectionClient) Create

func (c *WebhookCollectionClient) Create(ctx context.Context, webhook any) (Webhook, error)

Create creates a new webhook. webhook is any JSON-serializable webhook definition.

func (*WebhookCollectionClient) Iterate added in v0.7.0

func (c *WebhookCollectionClient) Iterate(options ListOptions, chunkSize *int64) *ListIterator[Webhook]

Iterate returns a lazy iterator over the webhooks matching the options, fetching pages on demand. The options' Limit caps the total number of webhooks yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*WebhookCollectionClient) List

List lists webhooks.

type WebhookDispatch

type WebhookDispatch struct {
	// ID is the unique dispatch ID.
	ID string `json:"id"`
	// WebhookID is the ID of the webhook that produced this dispatch.
	WebhookID string `json:"webhookId"`
	// Extra holds any other fields returned by the API.
	Extra Extra `json:"-"`
}

WebhookDispatch is a single invocation of a webhook.

func (*WebhookDispatch) UnmarshalJSON

func (d *WebhookDispatch) UnmarshalJSON(data []byte) error

type WebhookDispatchClient

type WebhookDispatchClient struct {
	// contains filtered or unexported fields
}

WebhookDispatchClient is a client for a specific webhook dispatch (/v2/webhook-dispatches/{dispatchId}).

func (*WebhookDispatchClient) Get

Get fetches the dispatch. The bool reports whether it exists.

type WebhookDispatchCollectionClient

type WebhookDispatchCollectionClient struct {
	// contains filtered or unexported fields
}

WebhookDispatchCollectionClient is a client for a webhook dispatch collection: the account-wide collection (GET /v2/webhook-dispatches) or dispatches nested under a webhook.

func (*WebhookDispatchCollectionClient) Iterate added in v0.7.0

Iterate returns a lazy iterator over the webhook dispatches matching the options, fetching pages on demand. The options' Limit caps the total number of dispatches yielded (unset means all); the per-page size is chunkSize (nil for the server default). Mirrors the reference client's iterable list().

func (*WebhookDispatchCollectionClient) List

List lists webhook dispatches.

Directories

Path Synopsis
examples
create_build_run_actor command
Command create_build_run_actor demonstrates the full Actor lifecycle: create a new Actor from source files, build it, run it, wait for it to finish, then fetch and print the run log.
Command create_build_run_actor demonstrates the full Actor lifecycle: create a new Actor from source files, build it, run it, wait for it to finish, then fetch and print the run log.
get_account command
Command get_account fetches and prints the current user's account details.
Command get_account fetches and prints the current user's account details.
internal/exampleclient
Package exampleclient builds the Apify client used by the runnable examples.
Package exampleclient builds the Apify client used by the runnable examples.
iterate_store command
Command iterate_store lazily iterates over Actors in the Apify Store using the convenience iterator, printing the first few.
Command iterate_store lazily iterates over Actors in the Apify Store using the convenience iterator, printing the first few.
log_redirection command
Command log_redirection starts an Actor without waiting, then streams its log output to stdout in real time (log redirection).
Command log_redirection starts an Actor without waiting, then streams its log output to stdout in real time (log redirection).
public_build_no_token command
Command public_build_no_token demonstrates the unauthenticated client.
Command public_build_no_token demonstrates the unauthenticated client.
run_and_last_run_storages command
Command run_and_last_run_storages starts a Store Actor run, waits for it, then fetches the Actor's last run and accesses all three of its default storages.
Command run_and_last_run_storages starts a Store Actor run, waits for it, then fetches the Actor's last run and accesses all three of its default storages.
run_store_actor command
Command run_store_actor runs an existing Apify Store Actor, waits for it to finish, and reads items from its default dataset.
Command run_store_actor runs an existing Apify Store Actor, waits for it to finish, and reads items from its default dataset.
storages command
Command storages demonstrates creating, writing to, and reading from all three Apify storage types: datasets, key-value stores, and request queues.
Command storages demonstrates creating, writing to, and reading from all three Apify storage types: datasets, key-value stores, and request queues.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL