These operations run an Apify Playwright actor and return results synchronously. Choose the operation based on the kind of output you need: the Key-value store output, dataset items, or only the run metadata. All three require an Apify token in the token parameter and a body payload that specifies which actor and what input to run.
How the domain is organized
The API centers on three related concepts: an Actor (the Playwright scraper you run), a Run (an execution of that actor), and the outputs that a run produces (Key-value store records and/or dataset items). The three operations map directly to these concerns:
runs-sync-apify-playwright-scraperstarts a run and returns the run record (metadata about the initiated run). The run record is what clients use to reference the execution (run id, status, timestamps, etc.).run-sync-apify-playwright-scraperstarts a run, waits until it completes, and returns the actor's Key-value store OUTPUT in the response body.run-sync-get-dataset-items-apify-playwright-scraperstarts a run, waits until it completes, and returns the run's dataset items in the response body.
Treat the run record as the canonical identifier for follow-up work. If you need to fetch logs, status, or outputs later (or from other endpoints not exposed here), the run record contains the run id and resource links you will need.
Entry points — which operation to call first
Decide by the output you must deliver to the user:
-
If the user asked for the dataset items produced by the run, call
run-sync-get-dataset-items-apify-playwright-scraperwithtokenand the appropriatebodydescribing the actor and input. The responsebodycontains the dataset items (inspect it to see its shape). -
If the user asked for the Key-value store output (for example, a single JSON or HTML blob the actor writes under a known key), call
run-sync-apify-playwright-scraper. The responsebodycontains the Key-value OUTPUT returned by the actor. -
If the user only needs the run id, status, or metadata (for example, to display run details or to use another system to poll outputs), call
runs-sync-apify-playwright-scraper. The response followsRunsResponseSchemaand includes identifiers and status fields.
Always inspect the body type for required fields before calling. The body payload typically contains the actor identifier and the input to send to the actor; required field names vary, so verify what the body expects for this integration.
Common user requests and how to accomplish them
- "Run this Playwright scraper with X input and return the scraped items to me"
- Use
run-sync-get-dataset-items-apify-playwright-scraper. Provide yourtokenand abodythat names the actor and supplies the input object. When the call returns, checkstatusand then readbodyfor the items.
- "Run the actor and give me the OUTPUT file it writes"
- Use
run-sync-apify-playwright-scraper. Supplytokenandbody. The call waits for the actor to finish and returns the Key-value OUTPUT inbody.
- "Start the actor but I only need the run id and status"
- Use
runs-sync-apify-playwright-scraper. It returns the run record immediately after starting and contains the run id and status fields for later reference.
- "Run the actor, but I expect a long execution or a very large dataset"
- Start with
runs-sync-apify-playwright-scraperif you want a quick confirmation and a run id. If you must receive the data synchronously, use the dataset or Key-value sync endpoints knowing they wait for completion; if the run is very long or produces large payloads, prefer retrieving outputs asynchronously (via run id) using dataset/Key-value retrieval endpoints available elsewhere in the platform.
Response patterns to rely on
-
Every response includes a
statusfield and abodyfield. Usestatusto determine whether the run succeeded, failed, or was cancelled, then inspectbodyfor the returned payload or error details. -
The
runs-sync-apify-playwright-scraperresponse followsRunsResponseSchema; expect run identifiers, timestamps, and status values there. The other two synchronous run endpoints returnbodythat contains the actor's outputs (Key-value or dataset items). The exact shape ofbodydepends on the actor and thebodypayload you sent—inspect the returnedbodyrather than assuming a shape. -
If you need a run id for downstream actions, look for it in the
runs-syncresponse or inside thebodyof the sync run responses; run ids are included in the run metadata returned when available.
Gotchas and practical tips
-
Supply the Apify token in the
tokenparameter, not inside thebody. A missing or insufficiently privileged token will produce authorization errors. -
The three operations are synchronous wrappers: they wait for the actor run to complete before returning. For long-running actors or very large outputs, synchronous calls may be slow or hit platform timeouts—when in doubt, use the run-metadata operation (
runs-sync-apify-playwright-scraper) to get a run id and then fetch outputs asynchronously via the platform's dataset or Key-value APIs. -
bodyschemas vary. Always inspect the requestbodytype to find the required actor identifier and input fields (actor reference, input object, optional execution options like build or memory). Do not assume field names. -
Responses may include partial or platform-formatted error messages inside
bodywhen a run fails. A non-successstatusindicates failure; inspectbodyfor log snippets or error details. -
Dataset items can be large or numerous. If you receive an unexpectedly large
body, consider switching to an asynchronous retrieval strategy (use the run id and a dataset-fetching endpoint elsewhere on the platform) rather than requesting the entire dataset synchronously. -
Access and permissions matter: the token must have rights to start the actor and read its outputs. If outputs are stored under an account or dataset the token cannot access, the call will fail even if the run itself starts.
Quick pre-call checklist
Before calling any of the sync run operations, confirm:
- The correct operation for the required output (
run-sync-get-dataset-itemsfor dataset items,run-sync-apify-playwright-scraperfor Key-value OUTPUT,runs-sync-apify-playwright-scraperfor run metadata). - A valid Apify
tokenwith the necessary permissions. - The
bodypayload matches the expected schema: it names the actor and provides the actorinputand any optional execution parameters you need. - You understand whether you require synchronous delivery (wait-for-completion) or prefer to use the run id for asynchronous retrieval later.
Following these patterns will let you reliably start Playwright scraper runs and obtain the outputs users commonly request: dataset rows, Key-value store objects, or run metadata for tracking.