register_rest_field() – Function | Developer.WordPress.org
Registers a new field on an existing WordPress object type.