Pagination via Headers:

Link Header

This is a standard method wherein the response headers contain pagination details. It typically uses the RFC 5988 format for web linking.

Custom Headers

Other headers such as X-Total-Count (to convey the total number of items) or X-Page (to indicate the current page) can be used.

For instance, the headers might look like:

Link: <https://api.example.com/data?page=2>; rel="next",  
      <https://api.example.com/data?page=5>; rel="last"

Pagination in Response Body:

Rather than utilizing headers, the response embeds the data alongside pagination metadata within the body. For example:

{
  "data": [...],
  "pagination": {
    "current_page": 1,
    "per_page": 10,
    "total_pages": 20,
    "total_items": 200
  }
}