Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

JSON:API Resources

7,731 sites Security covered
View on drupal.org

This module allows you to define custom JSON:API routes for providing unique data collections and contextual information. It supports GET and POST requests, enabling the creation of custom resources that go beyond standard entity collections.

The JSON:API Resources module makes it possible to define custom JSON:API routes. It does not define any custom routes of its own.

This can be incredibly valuable for providing custom collections (like a/jsonapi/featured-posts route) and contextual data (like a /jsonapi/me route).

In addition to GET, this module also makes it easy to accept POST requests. For example, one could define a /jsonapi/user/{id}/reminders route where a new reminder entities could be created and automatically associated with a user.

You can see examples of how to define routes here.

You can find examples of the classes that respond with your custom data here.

Pair with JSON:API Hypermedia

Add typed links and actions to your custom resources with JSON:API Hypermedia. Together they enable HATEOAS-style decoupled behaviors — attach flag, unflag, or subscribe link relations to a node resource without inventing ad-hoc URL conventions.

Looking for a Views-based alternative?

If your custom endpoint is "a filtered list of entities with sorting and pagination," use JSON:API Views instead. It exposes any Views display as a JSON:API collection — no PHP required.

Reach for JSON:API Resources when:

  • The response shape doesn't map to a single entity collection (aggregates, computed fields, mixed resource types).
  • You need request-scoped logic — auth checks, contextual filters from the session, side effects on POST.
  • The route is non-entity, like /jsonapi/me or /jsonapi/user/{id}/reminders.

Reach for JSON:API Views when the query is already expressible in Views.

Activity

Total releases
5
First release
May 2025
Latest release
4 weeks ago
Releases (12 mo)
4 ▲ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Release date
8.x-1.7 Stable Jun 18, 2026
8.x-1.6 Stable Jun 9, 2026
8.x-1.5 Stable May 21, 2026
8.x-1.4 Stable Jan 6, 2026
8.x-1.3 Stable May 7, 2025