Search results are returned one page at a time. You can move through them in either of two ways — use whichever your code already does:
  • By number — add page=2, page=3… to the same request, as with most photo APIs.
  • With a cursor — pass back the next_cursor token the previous page gave you.
Both return the same photos in the same order. Each page counts as one request against your quota, whichever way you ask for it.

The pagination object

Every list response includes a pagination object next to your data:
{
  "success": true,
  "data": [ /* photos for this page */ ],
  "pagination": {
    "per_page": 20,
    "has_more": true,
    "next_cursor": "eyJycyI6Ij... (opaque token)",
    "total_results": null
  }
}
FieldMeaning
per_pageHow many photos are on each page. You choose this with per_page (1–100, default 20).
has_moretrue if there is at least one more page after this one.
next_cursorThe token to pass as cursor to get the next page. It is null when has_more is false.
total_resultsHow many results can be paged through. Filled in when you page with page; null otherwise.
When the request carries page, two more fields come back:
FieldMeaning
pageThe page you received (1 is the first).
next_pageThe number to send as page for the next page, or null on the last one.

Paging by number

Send the same request with page=1, page=2, … and stop when next_page is null (or has_more is false). page starts at 1.
curl "https://api.pexafy.com/api/v1/search/photos?q=a+child+discovering+snow+for+the+first+time&per_page=20&page=1" \
  -H "x-api-key: YOUR_API_KEY"
curl "https://api.pexafy.com/api/v1/search/photos?q=a+child+discovering+snow+for+the+first+time&per_page=20&page=2" \
  -H "x-api-key: YOUR_API_KEY"
import requests

BASE = "https://api.pexafy.com/api/v1/search/photos"
headers = {"x-api-key": "YOUR_API_KEY"}
params = {"q": "a child discovering snow for the first time", "per_page": 20, "page": 1}

photos = []
while params["page"]:
    r = requests.get(BASE, headers=headers, params=params).json()
    photos.extend(r["data"])
    params["page"] = r["pagination"]["next_page"]   # None after the last page

print(f"Collected {len(photos)} photos")

Paging with a cursor

  1. Make your search as usual.
  2. Read pagination.next_cursor from the response.
  3. Repeat the same request, adding cursor=<next_cursor>.
  4. Stop when has_more is false (at that point next_cursor is null).
curl "https://api.pexafy.com/api/v1/search/photos?q=a+child+discovering+snow+for+the+first+time&per_page=20" \
  -H "x-api-key: YOUR_API_KEY"
curl "https://api.pexafy.com/api/v1/search/photos?q=a+child+discovering+snow+for+the+first+time&per_page=20&cursor=PASTE_next_cursor_HERE" \
  -H "x-api-key: YOUR_API_KEY"
Here is the same loop in Python:
import requests

BASE = "https://api.pexafy.com/api/v1/search/photos"
headers = {"x-api-key": "YOUR_API_KEY"}
params = {"q": "a child discovering snow for the first time", "per_page": 20}

photos = []
while True:
    r = requests.get(BASE, headers=headers, params=params).json()
    photos.extend(r["data"])
    page = r["pagination"]
    if not page["has_more"]:
        break
    params["cursor"] = page["next_cursor"]   # follow the cursor

print(f"Collected {len(photos)} photos")
Keep your query the same between pages. The cursor already remembers your search text and filters, so you only need to add cursor. Set per_page on the first request; following pages keep that same page size. If you send both cursor and page, the cursor wins.
Cursors are short-lived — they stay valid for about 5 minutes. If a cursor expires (or you change the query), simply start again from the first page without a cursor. Page numbers do not expire.

How deep you can go

A text search can be paged through up to its 100 best results — five pages of 20, or one page of 100. A search with filters only (no q) goes deeper. Past the last result, data is an empty list and has_more is false. For more photos on a subject, vary the wording of q rather than going further down the same list: the best matches are at the top.
limit is not the page size: it caps the total number of results across all pages. Use per_page for the number of photos per page. An unknown parameter is ignored and named in meta.warnings — see Errors & rate limits.

Which endpoints paginate?

Three search endpoints support pagination:
  • Search photos by text — GET /api/v1/search/photos (page or cursor)
  • Search photos by picture — POST /api/v1/search/photos (an upload, or a photo_id; cursor)
  • Find similar photos — GET /api/v1/photos/{photo_id}/similar (cursor)
They all work the same way with a cursor: read pagination.next_cursor and pass it back as cursor to get the next page, stopping when has_more is false. (On some plans the number of similar photos is capped to a single page — in that case has_more is false from the start.)
For image search, you only upload the image on the first request. To get the next page, send the request again with just cursor=<next_cursor> — no need to re-upload the image. The cursor already remembers your image and filters.Searching with photo_id instead of an upload pages the same way. The per-plan cap on similar photos applies to it too, so on a capped plan you get one page and has_more is false.
The other endpoints return a single response and do not take a cursor: facets, collections and usage return their full list directly.