WordPress at a glance
filter is not described

rest_prepare_attachment filter-hook . WP 4.7.0

Filters an attachment returned from the REST API.

Allows modification of the attachment right before it is returned.

Usage

add_filter( 'rest_prepare_attachment', 'filter_function_name_3517', 10, 3 );
function filter_function_name_3517( $response, $post, $request ){
	// filter...

	return $response;
}
$response(WP_REST_Response)
The response object.
$post(WP_Post)
The original attachment post.
$request(WP_REST_Request)
Request used to generate the response.

Where the hook is called

WP_REST_Attachments_Controller::prepare_item_for_response()
rest_prepare_attachment
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 410
return apply_filters( 'rest_prepare_attachment', $response, $post, $request );

Where the hook is used (in WP core)

Does not used.