# How to paginate results (https://developer.godaddy.com/en/docs/api-users/pagination)

---
title: How to paginate results
description: >-
  Page through list results on GoDaddy APIs using markers, next links, returned
  cursors, and GraphQL connections.
keywords: >-
  paginate results, pagination, next page, pageToken, marker, cursor, nextToken,
  pageInfo, endCursor, list all results
agentNotes:
  permissions:
    - Any account
  scopes:
    - >-
      Any scope that allows list operations, for example domains.domain:read for
      GET /v3/domains/domain-names
  rateLimit: >-
    Rate-limited per credential per window. Page sequentially rather than in
    parallel to stay within limits. Go to /docs/api-users/rate-limits for
    current values.
  idempotent: true
  destructive: false
  failureRecovery: >-
    Pagination calls are read-only, so retrying a failed page request with the
    same parameters is safe. If a saved marker, token, or cursor is rejected,
    restart from the first page.
related:
  apis:
    - title: 'Domains v3: List domain names'
      href: /docs/references/rest/domains/v3/list-domains
    - title: 'Domains v1: List domains'
      href: /docs/references/rest/domains/v1/list
    - title: 'Shopping: Search catalog'
      href: /docs/references/rest/shopping/search-catalog
  guides:
    - title: List registered domains
      href: /docs/api-users/domains/manage/list
    - title: List orders
      href: /docs/api-users/commerce/manage-orders-and-customers
  concepts:
    - title: Handle rate limits
      href: /docs/api-users/rate-limits
    - title: Error handling
      href: /docs/api-users/errors
pageId: 32d5d7c2-ceef-44f7-a2bc-8c7d26432515
---

## Overview

GoDaddy APIs don't share one pagination scheme. Each list endpoint uses one of four patterns, and a few endpoints, like the Domains v2 lists, return everything in one response. This page shows how to page through results for each pattern. Go to the API reference for an endpoint's exact parameter names, defaults, and maximums.

Page sequentially. Parallel page-walks burn through your [rate limit](https://developer.godaddy.com/docs/api-users/rate-limits) without finishing sooner.

## Choose a pagination pattern

Find your endpoint's pattern in the following table, then go to that section. If your endpoint isn't listed, check its reference page for `marker`, `pageToken`, `page`, `cursor`, or `after` parameters:

| Pattern                                           | How you can tell                                                            | Used by                                                                                                                     |
| ------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| [Marker](#paginate-with-a-marker)                 | The response is a bare array, and you pass the last item back as `marker`.  | Domains v1 `GET /v1/domains`                                                                                                |
| [Next links](#follow-next-links)                  | The response has `items` and `links`. A `rel=next` link means more results. | Domains v3 domain names and DNS records, Hosting apps and deployments, Email, Customers, Commerce channels and transactions |
| [Returned cursor](#send-the-returned-cursor-back) | The response carries a cursor or token that you send on the next request.   | Shopping catalog search                                                                                                     |
| [GraphQL connections](#paginate-graphql-queries)  | The query returns `edges` and `pageInfo`.                                   | Commerce Catalog, Orders, and Taxes                                                                                         |

## Paginate with a marker

`GET /v1/domains` returns a bare array. Pass `limit` for the page size and `marker` for the last domain you received. The last page is the first response with fewer items than `limit`.

The following procedure retrieves every domain on the account.

* Request pages until a response is shorter than `limit`:

```bash tab="curl"
# First page
curl -s "https://api.godaddy.com/v1/domains?limit=100" \
  -H "Authorization: Bearer $GODADDY_PAT"

# Next page: marker is the last domain from the previous page
curl -s "https://api.godaddy.com/v1/domains?limit=100&marker=$LAST_DOMAIN" \
  -H "Authorization: Bearer $GODADDY_PAT"
```

```js tab="Node"
const PAGE_SIZE = 100;
let marker = "";
const all = [];

while (true) {
  const url = new URL("https://api.godaddy.com/v1/domains");
  url.searchParams.set("limit", PAGE_SIZE);
  if (marker) url.searchParams.set("marker", marker);

  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.GODADDY_PAT}` },
  });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const page = await res.json();
  all.push(...page);

  if (page.length < PAGE_SIZE) break; // last page
  marker = page[page.length - 1].domain;
}
```

```python tab="Python"
import os
import requests

PAGE_SIZE = 100
headers = {"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"}
marker = None
domains = []

while True:
    params = {"limit": PAGE_SIZE}
    if marker:
        params["marker"] = marker

    res = requests.get("https://api.godaddy.com/v1/domains", params=params, headers=headers)
    res.raise_for_status()
    page = res.json()
    domains.extend(page)

    if len(page) < PAGE_SIZE:
        break  # last page
    marker = page[-1]["domain"]
```

```go tab="Go"
package main

import (
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "net/url"
    "os"
    "strconv"
)

const pageSize = 100

func main() {
    marker := ""
    total := 0

    for {
        q := url.Values{"limit": {strconv.Itoa(pageSize)}}
        if marker != "" {
            q.Set("marker", marker)
        }

        req, _ := http.NewRequest("GET", "https://api.godaddy.com/v1/domains?"+q.Encode(), nil)
        req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
        res, err := http.DefaultClient.Do(req)
        if err != nil { log.Fatal(err) }

        var page []struct {
            Domain string `json:"domain"`
        }
        err = json.NewDecoder(res.Body).Decode(&page)
        res.Body.Close()
        if res.StatusCode != http.StatusOK { log.Fatalf("request returned %s", res.Status) }
        if err != nil { log.Fatal(err) }
        total += len(page)

        if len(page) < pageSize { break } // last page
        marker = page[len(page)-1].Domain
    }
    fmt.Println("domains:", total)
}
```

Go to [List domains](https://developer.godaddy.com/docs/references/rest/domains/v1/list) for the `limit` maximum and the full parameter list.

## Follow next links

These endpoints return `items` plus a `links` array. Each link has a `rel` and an `href`. Request the first page, then follow `rel=next` until it's absent. The link carries the page token or page number for you, so you never build one yourself.

The following procedure retrieves every page of a list that returns `links`.

* Request pages until the response has no `rel=next` link:

```bash tab="curl"
# First page
curl -s "https://api.godaddy.com/v3/domains/domain-names?pageSize=100" \
  -H "Authorization: Bearer $GODADDY_PAT"

# Next page: reuse the query string from the rel=next link
curl -s "https://api.godaddy.com/v3/domains/domain-names?$NEXT_QUERY" \
  -H "Authorization: Bearer $GODADDY_PAT"
```

```js tab="Node"
const base = "https://api.godaddy.com";
const path = "/v3/domains/domain-names";
const headers = { Authorization: `Bearer ${process.env.GODADDY_PAT}` };
let query = "?pageSize=100";
const all = [];

while (query !== null) {
  const res = await fetch(base + path + query, { headers });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const page = await res.json();
  all.push(...page.items);

  // The next link's query string carries the page token or page number
  const next = page.links?.find((link) => link.rel === "next");
  query = next ? new URL(next.href, base).search : null;
}
```

```python tab="Python"
import os
from urllib.parse import urlparse
import requests

base = "https://api.godaddy.com/v3/domains/domain-names"
headers = {"Authorization": f"Bearer {os.environ['GODADDY_PAT']}"}
query = "pageSize=100"
domains = []

while query:
    res = requests.get(f"{base}?{query}", headers=headers)
    res.raise_for_status()
    page = res.json()
    domains.extend(page["items"])

    # The next link's query string carries the page token or page number
    next_link = next((l for l in page.get("links", []) if l["rel"] == "next"), None)
    query = urlparse(next_link["href"]).query if next_link else None
```

```go tab="Go"
package main

import (
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "net/url"
    "os"
)

type page struct {
    Items []json.RawMessage `json:"items"`
    Links []struct {
        Rel  string `json:"rel"`
        Href string `json:"href"`
    } `json:"links"`
}

func main() {
    base := "https://api.godaddy.com/v3/domains/domain-names"
    query := "pageSize=100"
    total := 0

    for query != "" {
        req, _ := http.NewRequest("GET", base+"?"+query, nil)
        req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
        res, err := http.DefaultClient.Do(req)
        if err != nil { log.Fatal(err) }

        var p page
        err = json.NewDecoder(res.Body).Decode(&p)
        res.Body.Close()
        if res.StatusCode != http.StatusOK { log.Fatalf("request returned %s", res.Status) }
        if err != nil { log.Fatal(err) }
        total += len(p.Items)

        // The next link's query string carries the page token or page number
        query = ""
        for _, link := range p.Links {
            if link.Rel == "next" {
                u, err := url.Parse(link.Href)
                if err != nil { log.Fatal(err) }
                query = u.RawQuery
            }
        }
    }
    fmt.Println("domains:", total)
}
```

The loop reuses only the query string from the link. Some APIs return the `href` as a full URL and others return a path without the API prefix, so rebuilding the request from your own base URL works for both. Replace `base` and the first-page query to page through a different endpoint.

Which parameter sits in the link depends on the endpoint. Some endpoints use `pageToken` and others use `page`. A few accept both, and an endpoint might reject a request that sends both. Go to the reference page for your endpoint for the details:

* Go to [List domain names](https://developer.godaddy.com/docs/references/rest/domains/v3/list-domains) for the `pageToken` parameters.
* Go to [List DNS records](https://developer.godaddy.com/docs/references/rest/domains/v3/list-dns-records) for the `page` and `totalRequired` parameters.
* Go to [List apps](https://developer.godaddy.com/docs/references/rest/hosting/list-apps) and [List deployments](https://developer.godaddy.com/docs/references/rest/hosting/list-deployments) for Hosting. Other Hosting lists, like subscriptions and domains, return a single page.
* Go to [List mailboxes](https://developer.godaddy.com/docs/references/rest/email/list-mailboxes) for Email.
* Go to [List customers](https://developer.godaddy.com/docs/references/rest/customers/customers-list) for Customers.
* Go to [Get channels](https://developer.godaddy.com/docs/references/rest/channels/get-channels) and [Get transactions](https://developer.godaddy.com/docs/references/rest/transactions/get-transactions) for Commerce.

The Hosting logs endpoint also accepts `pageSize`, but it sets how many log lines come back, not a page size. Don't loop on it.

## Send the returned cursor back

Some endpoints return a cursor in the response body. You send it on the next request, and the response flags the end of the results.

`POST /v1/shopping/catalog/search` takes `pagination.limit` and `pagination.cursor` in the request body. The response returns `pagination.has_next_page` and a `pagination.cursor` for the next page.

The following procedure retrieves every page of catalog search results.

* Request pages until `has_next_page` is false:

```bash tab="curl"
# First page
curl -s -X POST "https://api.godaddy.com/v1/shopping/catalog/search" \
  -H "Authorization: Bearer $GODADDY_PAT" \
  -H "Request-Id: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "context": { "address_country": "US", "currency": "USD", "language": "en" },
    "pagination": { "limit": 20 }
  }'

# Next page: pass pagination.cursor from the previous response
curl -s -X POST "https://api.godaddy.com/v1/shopping/catalog/search" \
  -H "Authorization: Bearer $GODADDY_PAT" \
  -H "Request-Id: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "context": { "address_country": "US", "currency": "USD", "language": "en" },
    "pagination": { "limit": 20, "cursor": "'"$NEXT_CURSOR"'" }
  }'
```

```js tab="Node"
const products = [];
let cursor;

while (true) {
  const res = await fetch("https://api.godaddy.com/v1/shopping/catalog/search", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GODADDY_PAT}`,
      "Request-Id": crypto.randomUUID(),
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      context: { address_country: "US", currency: "USD", language: "en" },
      pagination: { limit: 20, ...(cursor && { cursor }) },
    }),
  });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const data = await res.json();
  products.push(...(data.products ?? []));

  if (!data.pagination?.has_next_page) break; // last page
  cursor = data.pagination.cursor;
}
```

```python tab="Python"
import os
import uuid
import requests

headers = {
    "Authorization": f"Bearer {os.environ['GODADDY_PAT']}",
    "Content-Type": "application/json",
}
cursor = None
products = []

while True:
    pagination = {"limit": 20}
    if cursor:
        pagination["cursor"] = cursor

    res = requests.post(
        "https://api.godaddy.com/v1/shopping/catalog/search",
        headers={**headers, "Request-Id": str(uuid.uuid4())},
        json={
            "context": {"address_country": "US", "currency": "USD", "language": "en"},
            "pagination": pagination,
        },
    )
    res.raise_for_status()
    data = res.json()
    products.extend(data.get("products", []))

    if not data.get("pagination", {}).get("has_next_page"):
        break  # last page
    cursor = data["pagination"]["cursor"]
```

```go tab="Go"
package main

import (
    "bytes"
    "crypto/rand"
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "os"
)

func requestID() string {
    value := make([]byte, 16)
    if _, err := rand.Read(value); err != nil { log.Fatal(err) }
    value[6], value[8] = (value[6]&0x0f)|0x40, (value[8]&0x3f)|0x80
    return fmt.Sprintf("%x-%x-%x-%x-%x", value[:4], value[4:6], value[6:8], value[8:10], value[10:])
}

func main() {
    cursor := ""
    total := 0

    for {
        pagination := map[string]any{"limit": 20}
        if cursor != "" {
            pagination["cursor"] = cursor
        }
        body, _ := json.Marshal(map[string]any{
            "context":    map[string]string{"address_country": "US", "currency": "USD", "language": "en"},
            "pagination": pagination,
        })

        req, _ := http.NewRequest("POST", "https://api.godaddy.com/v1/shopping/catalog/search", bytes.NewReader(body))
        req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
        req.Header.Set("Request-Id", requestID())
        req.Header.Set("Content-Type", "application/json")
        res, err := http.DefaultClient.Do(req)
        if err != nil { log.Fatal(err) }

        var data struct {
            Products   []json.RawMessage `json:"products"`
            Pagination struct {
                Cursor      string `json:"cursor"`
                HasNextPage bool   `json:"has_next_page"`
            } `json:"pagination"`
        }
        err = json.NewDecoder(res.Body).Decode(&data)
        res.Body.Close()
        if res.StatusCode != http.StatusOK { log.Fatalf("request returned %s", res.Status) }
        if err != nil { log.Fatal(err) }
        total += len(data.Products)

        if !data.Pagination.HasNextPage { break } // last page
        cursor = data.Pagination.Cursor
    }
    fmt.Println("products:", total)
}
```

Go to [Search catalog](https://developer.godaddy.com/docs/references/rest/shopping/search-catalog) for the Shopping parameters.

## Paginate GraphQL queries

The Commerce Catalog, Orders, and Taxes GraphQL APIs return connections. A paginated query takes `first` and `after`, or `last` and `before`, and returns `edges` plus a `pageInfo` object. Pass `pageInfo.endCursor` as `after` to move forward. Stop when `pageInfo.hasNextPage` is false.

The following procedure retrieves every page of orders.

* Request pages until `hasNextPage` is false:

```bash tab="curl"
# First page
curl -s -X POST "https://api.godaddy.com/v1/commerce/order-subgraph" \
  -H "Authorization: Bearer $GODADDY_PAT" \
  -H "Content-Type: application/json" \
  -H "x-store-id: $STORE_ID" \
  -d '{"query": "query($after: ID) { orders(first: 10, after: $after) { edges { node { id number } } pageInfo { hasNextPage endCursor } } }"}'

# Next page: pass pageInfo.endCursor as the after variable
curl -s -X POST "https://api.godaddy.com/v1/commerce/order-subgraph" \
  -H "Authorization: Bearer $GODADDY_PAT" \
  -H "Content-Type: application/json" \
  -H "x-store-id: $STORE_ID" \
  -d '{"query": "query($after: ID) { orders(first: 10, after: $after) { edges { node { id number } } pageInfo { hasNextPage endCursor } } }", "variables": {"after": "'"$END_CURSOR"'"}}'
```

```js tab="Node"
const query = `query ($after: ID) {
  orders(first: 10, after: $after) {
    edges { node { id number } }
    pageInfo { hasNextPage endCursor }
  }
}`;
const orders = [];
let after = null;

while (true) {
  const res = await fetch("https://api.godaddy.com/v1/commerce/order-subgraph", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GODADDY_PAT}`,
      "Content-Type": "application/json",
      "x-store-id": process.env.STORE_ID,
    },
    body: JSON.stringify({ query, variables: { after } }),
  });
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const { data, errors } = await res.json();
  if (errors) throw new Error(errors[0].message);

  orders.push(...data.orders.edges.map((edge) => edge.node));
  if (!data.orders.pageInfo.hasNextPage) break; // last page
  after = data.orders.pageInfo.endCursor;
}
```

```python tab="Python"
import os
import requests

query = """query ($after: ID) {
  orders(first: 10, after: $after) {
    edges { node { id number } }
    pageInfo { hasNextPage endCursor }
  }
}"""
headers = {
    "Authorization": f"Bearer {os.environ['GODADDY_PAT']}",
    "Content-Type": "application/json",
    "x-store-id": os.environ["STORE_ID"],
}
orders = []
after = None

while True:
    res = requests.post(
        "https://api.godaddy.com/v1/commerce/order-subgraph",
        headers=headers,
        json={"query": query, "variables": {"after": after}},
    )
    res.raise_for_status()
    body = res.json()
    if body.get("errors"):
        raise RuntimeError(body["errors"][0]["message"])

    connection = body["data"]["orders"]
    orders.extend(edge["node"] for edge in connection["edges"])
    if not connection["pageInfo"]["hasNextPage"]:
        break  # last page
    after = connection["pageInfo"]["endCursor"]
```

```go tab="Go"
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "log"
    "net/http"
    "os"
)

const query = `query ($after: ID) {
  orders(first: 10, after: $after) {
    edges { node { id number } }
    pageInfo { hasNextPage endCursor }
  }
}`

func main() {
    var after *string
    total := 0

    for {
        body, _ := json.Marshal(map[string]any{
            "query":     query,
            "variables": map[string]any{"after": after},
        })
        req, _ := http.NewRequest("POST", "https://api.godaddy.com/v1/commerce/order-subgraph", bytes.NewReader(body))
        req.Header.Set("Authorization", "Bearer "+os.Getenv("GODADDY_PAT"))
        req.Header.Set("Content-Type", "application/json")
        req.Header.Set("x-store-id", os.Getenv("STORE_ID"))
        res, err := http.DefaultClient.Do(req)
        if err != nil { log.Fatal(err) }

        var result struct {
            Data struct {
                Orders struct {
                    Edges    []json.RawMessage `json:"edges"`
                    PageInfo struct {
                        HasNextPage bool   `json:"hasNextPage"`
                        EndCursor   string `json:"endCursor"`
                    } `json:"pageInfo"`
                } `json:"orders"`
            } `json:"data"`
            Errors []struct {
                Message string `json:"message"`
            } `json:"errors"`
        }
        err = json.NewDecoder(res.Body).Decode(&result)
        res.Body.Close()
        if res.StatusCode != http.StatusOK { log.Fatalf("request returned %s", res.Status) }
        if err != nil { log.Fatal(err) }
        if len(result.Errors) > 0 { log.Fatal(result.Errors[0].Message) }
        total += len(result.Data.Orders.Edges)

        if !result.Data.Orders.PageInfo.HasNextPage { break } // last page
        cursor := result.Data.Orders.PageInfo.EndCursor
        after = &cursor
    }
    fmt.Println("orders:", total)
}
```

The `after` variable's type matches the schema. Orders cursors are `ID`, and Catalog and Taxes cursors are `String`. Catalog connections also expose `totalCount`. Catalog queries accept a `paginationType` argument that defaults to `CURSOR`.

* Go to [orders](https://developer.godaddy.com/docs/references/rest/orders/order/queries/orders) for the Orders arguments.
* Go to [skus](https://developer.godaddy.com/docs/references/rest/catalog/sku/queries/skus) for the Catalog arguments, including `paginationType`.
* Go to [rates](https://developer.godaddy.com/docs/references/rest/taxes/rate/queries/rates) for the Taxes arguments.

## Common errors

The following table lists pagination errors and how to resolve each one.

| Status | Cause                                                                                                                                                                                                                                         | Action                                                                                                     |
| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `422`  | The request sends both `page` and `pageToken` to an endpoint that accepts only one of them, like the Customers list.                                                                                                                          | Send `pageToken` alone. Use the `rel=next` link instead of building the query yourself.                    |
| `400`  | A Hosting list request changes `pageSize` after the first page, or sends a `page` or other unknown parameter. A Hosting `pageToken` works only with the same `pageSize` as the request that returned it, and Hosting has no `page` parameter. | Keep `pageSize` the same on every request. Use the `rel=next` link instead of building the query yourself. |
| `429`  | You paged too fast or in parallel.                                                                                                                                                                                                            | Page sequentially, and go to [Handle rate limits](https://developer.godaddy.com/docs/api-users/rate-limits) for backoff.                |

## Next

* Go to [List registered domains](https://developer.godaddy.com/docs/api-users/domains/manage/list) for a complete paginated example with filters.
* Go to [Handle rate limits](https://developer.godaddy.com/docs/api-users/rate-limits) for retry and backoff guidance.
