HATEOAS Link Relations Reference

REST HATEOAS link relation names — self, next, edit, describedby — with semantics.

Reference for RESTful HATEOAS link relation types — self, next, prev, edit, collection, describedby and more — with IANA registration status and HAL / JSON:API usage notes. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is HATEOAS?

HATEOAS (Hypermedia As The Engine Of Application State) is a REST constraint where responses include hyperlinks that tell the client what it can do next. Instead of hard-coding URLs, the client follows links by their relation name, so the server can change URLs freely.

In a hypermedia REST API, responses carry links named by relation type so the client follows actions by meaning rather than by hard-coded URL. This reference lists the common IANA-registered relation names with their semantics and notes on use in Link headers, HAL and JSON:API.

How it works

A link relation pairs a target URI with a rel token that names the link’s meaning. The same tokens appear in three common carriers:

Link: </articles/1>; rel="self", </articles?page=2>; rel="next"
{ "_links": { "self": { "href": "/articles/1" },
              "next": { "href": "/articles?page=2" } } }

Registered relations (per IANA, originally RFC 8288 / RFC 5988) have agreed meanings — self, next, prev, first, last, edit, collection, describedby — while custom relations use a full URI to avoid collisions.

The most important registered relation types

RelationMeaning
selfThe canonical URI for the current resource; always include this
nextThe immediately following resource in a series
prevThe immediately preceding resource
firstThe first resource in the series
lastThe last resource in the series

A paged collection should include self, next, prev, first, and last on every page so a client can navigate without knowing the URL structure.

Editing and actions

RelationMeaning
editA URI that accepts PUT or PATCH to modify the resource
deleteA URI to DELETE the resource (extension relation, not IANA-registered)
create-formA form definition for creating a new resource
edit-formA form definition for editing the resource

Describing and linking

RelationMeaning
collectionThe collection resource that contains this item
itemAn item that is part of this collection
describedbyA URI returning documentation or a schema for the resource
profileA profile URI listing semantics or constraints
alternateAn alternative representation, for example a different format

Practical example: a paginated article API

{
  "_links": {
    "self":  { "href": "/articles?page=3" },
    "prev":  { "href": "/articles?page=2" },
    "next":  { "href": "/articles?page=4" },
    "first": { "href": "/articles?page=1" },
    "last":  { "href": "/articles?page=12" },
    "collection": { "href": "/articles" }
  },
  "_embedded": { "items": [ ... ] }
}

A generic client that understands these relations can paginate, navigate to the collection, and show an “edit” button without any hardcoded knowledge of the URL structure.

Extension relations and custom rels

When no IANA-registered name covers your link’s meaning, use a full absolute URI as the relation type — for example https://api.example.com/rels/approve. This avoids collisions with future IANA registrations and makes the semantic unambiguous. Never invent bare words like rel="approve" as that namespace is implicitly reserved for future registration.

Tips and common mistakes

  • Include self on every single resource — not just collections. It lets clients cache, share, and re-fetch the resource reliably.
  • Pagination is a four-link contract: if you only emit next and prev, clients cannot jump to the first or last page without iterating.
  • edit points to the editable URI (often the same as self), not to a form renderer — do not confuse it with edit-form.
  • Extension relations should be full URIs, not bare custom words.