Title: rest_namespace_index
Published: December 9, 2015
Last modified: May 20, 2026

---

# apply_filters( ‘rest_namespace_index’, WP_REST_Response $response, WP_REST_Request $request )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#wp--skip-link--target)

Filters the REST API namespace index data.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#description)󠁿

This typically is just the route data for the namespace, but you can add any data
you’d like here.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#parameters)󠁿

 `$response`[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)

Response data.

`$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)

Request data. The namespace is passed as the `'namespace'` parameter.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'rest_namespace_index', $response, $request );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/class-wp-rest-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/class-wp-rest-server.php#L1544)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/class-wp-rest-server.php#L1544-L1544)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Server::get_namespace_index()](https://developer.wordpress.org/reference/classes/wp_rest_server/get_namespace_index/)`wp-includes/rest-api/class-wp-rest-server.php` |

Retrieves the index for a namespace.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/rest_namespace_index/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Frest_namespace_index%2F)
before being able to contribute a note or feedback.