Skip to main content
Some endpoints return a long list in pages. To get the next page, send the cursor from the last response.

Endpoints with pages

Maps also return a cursor. See Create map.

Rules for all cursors

  • Send the cursor back exactly as you got it. Batch and crawl cursors are numbers. File and monitor event cursors are strings.
  • 0 is a valid cursor. Do not stop the loop on it.
  • For batch items and crawl pages, stop when cursor is absent or null. For files and monitor events, stop when has_more is false. If more results remain without a next cursor, report an error.
  • If a request fails, or a cursor repeats, stop the loop with an error. Do not skip to the next page.
  • To get all the results of a batch or a crawl, wait until its status is completed. While the job is still running, a response can contain a cursor for results that are not ready yet.
Use Python 3.9 or later, or Node.js 18 or later. For Python, install Requests with python -m pip install requests. Set the OLOSTEP_API_KEY environment variable before you run the samples. Each sample stops with an error after 1,000 pages without a last page. This is a limit in the sample, not in the API. For a very large list, increase max_pages in Python or maxPages in Node.js.

Batch items

The batch items endpoint returns the results in items. Set status to completed or failed to filter them. Without status, the endpoint does not filter by status. These samples select completed. On the first request, leave out cursor.
To get the items that failed, call the function with the status failed.

Crawl pages

The crawl pages endpoint returns the pages in pages. The first request sends cursor=0.

Files and monitor events

Files and monitor events use has_more and next_cursor. Send next_cursor as the cursor of the next request. Set limit from 1 to 100. Without limit, GET /v1/files returns all completed files for your team. This sample lists your team’s completed files, 100 at a time. For the events of a monitor, use GET /v1/monitors/{monitor_id}/events and read the events from data in the same way.

Endpoints without pages

GET /v1/schedules and GET /v1/monitors return the full list in one response.

Next steps

Batches

Scrape a list of URLs in one job.

Retrieve content

Get the content of a result with its retrieve_id.