Actor runs

Charge events in Actor run

Changed on

Charge for events in the run of your pay-per-event Actor. The event you are charging for must be one of the configured events in your Actor. If the Actor is not set up as pay per event, or if the event is not configured, the endpoint will return an error. The endpoint must be called from the Actor run itself, with the same API token that the run was started with.

post/v2/actor-runs/{runId}/charge

Request

  • Base URL
    https://api.apify.com
  • Auth
    • HTTP bearer
    • or API key in query parameter token

Path parameters

runIdstring required
Example:3KH8gEpp4d8uQSe8T

Actor run ID.

Headers

idempotency-keystring required

Always pass a unique idempotency key (any unique string) for each charge to avoid double charging in case of retries or network errors. The key expires 3 minutes after the charge, so a later request with the same key creates a new charge.

Request body

eventNamestring required
countinteger required
requestIdstring

ID of the Server Actor request being charged, from the X-Actor-Request-ID header of the incoming request. Required for multi-tenant Server Actor runs, where it identifies the request the charge belongs to.

Example request

{
  "eventName": "ANALYZE_PAGE",
  "count": 1,
  "requestId": "7Hs2kQw9LxP4mN1vB"
}

Response

The charge was successful. Note that you still have to make sure in your Actor that the total charge for the run respects the maximum value set by the user, as the API does not check this. Above the limit, the charges reported as successful in API will not be added to your payouts, but you will still bear the associated costs. Use the Apify charge manager or SDK to avoid having to deal with this manually.

object required

Changes

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the new optional request property