# Hypermedia as the engine of application state (HATEOAS)

Explains how the Payroc API uses HATEOAS links to surface related resources and paginate large result sets within API responses.

We implement HATEOAS throughout our API to help you:

- [View additional information about a resource.](#view-additional-information-about-a-resource)
- [Navigate a list of records using pagination.](#navigate-a-list-of-records-using-pagination)

<a id="view-additional-information-about-a-resource"></a>
## View additional information about a resource

If a resource has a relationship with other resources in our API, we provide HATEOAS links to the other resources in our response.

<a id="example"></a>
### Example

If you retrieve the details of a payment, we include a `links` object that contains links to any referenced refunds or reversals that are related to the payment.

The following example response contains links to two refunds related to the payment.

```json
"links": [
  {
    "rel": "refund",
    "method": "get",
    "href": "https://api.payroc.com/v1/refunds/CD3HN88U9F"
  },
  {
    "rel": "refund",
    "method": "get",
    "href": "https://api.payroc.com/v1/refunds/FPU8P48WN8"
  }
]
```

<a id="navigate-a-list-of-records-using-pagination"></a>
## Navigate a list of records using pagination

If a GET request returns a large number of results, we send the results as a [paginated list](/api/pagination). To help you navigate through the results, we include HATEOAS links so that you can navigate through the results.

<a id="example-1"></a>
### Example

The following example response contains a `links` object with HATEOAS links to the next page and previous page of a paginated list of payments.

```json
{
  "links": [
    {
      "rel": "next",
      "method": "get",
      "href": "<https://api.payroc.com/v1/payments?processingTerminalId=1001&limit=2&after=CW4BA4MUH0>"
    },
    {
      "rel": "previous",
      "method": "get",
      "href": "<https://api.payroc.com/v1/payments?processingTerminalId=1001&limit=2&before=IFA1T74OBS>"
    }
  ]
}
```
