Skip to main content
Version: Next

ApifyRequestConfig

A request as the resource clients hand it to HttpClient.call.

Index

Properties

optionalauthorizationHeader

authorizationHeader?: Authorization | X-Apify-Authorization = Authorization | X-Apify-Authorization

Header that carries the client's API token for this request. The Apify API reads Authorization. Actor servers also accept X-Apify-Authorization, which the platform removes before the request reaches the Actor, so the Authorization header stays free for the Actor's own authentication. A per-request header of either name still wins.

optionalcompression

compression?: false | HttpCompressor

How to compress the request body: an HttpCompressor for this request only, or false to send the body uncompressed. Defaults to the client's HttpClient.httpCompressor.

optionaldata

data?: unknown

Request body. A plain object or array is serialized to JSON and sent as application/json, or form-encoded when a Content-Type: application/x-www-form-urlencoded header asks for it. A string, binary value (Buffer, ArrayBuffer, typed array) or Readable is sent as it is, and URLSearchParams is sent form-encoded. A Blob or File, such as one from fs.openAsBlob(), is streamed without being held in memory, under its own type when no Content-Type header is set. A FormData or web ReadableStream is rejected with a TypeError, since serializing one would send an empty body.

optionaldoNotRetryTimeouts

doNotRetryTimeouts?: boolean

Give up on the first transport timeout instead of retrying it.

optionalfollowRedirects

followRedirects?: boolean = true

Whether the transport follows redirects. With false, a redirect response is handled like an error status, so headers that carry the token never go to a host the server picked.

optionalheaders

headers?: Record<string, string>

Per-request headers. They win over the client's default headers, header names compared case-insensitively.

method

method: GET | HEAD | POST | PUT | DELETE | CONNECT | OPTIONS | TRACE | PATCH

HTTP method.

optionalparams

params?: Record<string, unknown>

Query parameters. undefined values are dropped, booleans are sent as 1 and 0, Date values as ISO 8601 strings and arrays comma-separated.

optionalresponseType

optionalretryStatusCodes

retryStatusCodes?: readonly number[]

Status codes to retry. Defaults to rate limits (429) and server errors (5xx).

optionalretryTransportErrors

retryTransportErrors?: boolean = true

Whether transport errors, timeouts included, are retried. With false, the first one fails the call, since the request may have reached the server before it failed.

optionalsignal

signal?: AbortSignal

Aborts the call. Once the signal aborts, the attempt in flight is ended, no retry follows, and the call rejects with the signal's reason.

optionalstringifyFunctions

stringifyFunctions?: boolean

Serialize function-valued fields of a JSON body to their source instead of dropping them, which is how Actor input carrying page functions reaches the API.

optionalthrowOnErrorStatus

throwOnErrorStatus?: boolean = true

Whether an error status throws ApifyApiError. With false, the call resolves to the error response once no retry follows, and a rate limit (429) doesn't count toward the client's statistics, which track the API's rate limits.

optionaltimeoutSecs

timeoutSecs?: Timeout = Timeout

Timeout of the request: a tier name, a number of seconds, or 'noTimeout'. The client resolves it to the timeout of each attempt in milliseconds, doubling it with every retry up to timeoutMaxSecs.

url

url: string

Full URL of the endpoint, without the query string.