Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/public-api/apify-client.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3527,6 +3527,7 @@ export interface RunAbortOptions extends TimeoutOptions {

// @public
export interface RunChargeOptions extends TimeoutOptions {
apifyRequestId?: string;
count?: number;
eventName: string;
idempotencyKey?: string;
Expand Down
8 changes: 8 additions & 0 deletions src/resource_clients/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const chargeOptionsSchema = z.strictObject({
eventName: z.string(),
count: z.number().default(1),
idempotencyKey: z.string().optional(),
apifyRequestId: z.string().optional(),
...timeoutOptionsShape,
});
const waitForFinishOptionsSchema = z.strictObject({ waitSecs: z.number().optional(), ...timeoutOptionsShape });
Expand Down Expand Up @@ -353,6 +354,7 @@ export class RunClient extends ResourceClient {
count,
idempotencyKey: providedIdempotencyKey,
timeoutSecs = 'short',
apifyRequestId: requestId,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would requestId by itself be clear enough? @patrikbraborec @tobice

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, without context, I would be little bit confused. But what are the alternatives?

apifyServerRequestId?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. requestId — exactly what we pass in the JSON request body of the charge endpoint
  2. apifyRequestId — current state of the PR
  3. apifyServerRequestId — what you just suggested

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote for consistency. The charge endpoint accepts a requestId, so let's have it in the client API as well.

If it's confusing, it's too late to change that on the API anyway 😄

signal,
} = parseArgument(options, chargeOptionsSchema, 'RunChargeOptions');

Expand All @@ -366,6 +368,7 @@ export class RunClient extends ResourceClient {
data: {
eventName,
count,
requestId,
},
headers: {
[RUN_CHARGE_IDEMPOTENCY_HEADER]: idempotencyKey,
Expand Down Expand Up @@ -724,6 +727,11 @@ export interface RunChargeOptions extends TimeoutOptions {
count?: number;
/** Defaults to runId-eventName-timestamp */
idempotencyKey?: string;
Comment thread
janbuchar marked this conversation as resolved.
Resolved
/**
* ID of the request being served by a multi-tenant Standby run, taken from the `X-Apify-Request-ID` header of the incoming request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the header name is X-Actor-Request-ID (Actor, not Apify) - see source here

@janbuchar janbuchar Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems trustworthy, thanks

* Maps the charge to the account of the caller who made that request instead of the account that started the run.
*/
apifyRequestId?: string;
}

/**
Expand Down
Loading