I changed my domain name and REST API stopped working

WordPress stores the domain of the installation in several places of the database. So you have to change them in numerous tables. In the case of working, look at the options table, entries siteurl and homeurl.
It is also possible to set this via wp-config.php:

// Home URL of your WordPress.
define( 'WP_SITEURL', 'https:/example.com' );
// URL to the WordPress root dir.
define( 'WP_HOME', 'https://example.com' );

Look also inside the wp-config.php for the domain, because it is possible to set this via constant. The .htaccess, if it is an Apache server, should also validate, because the Permalink rules need the domain, especially in the ‘Multisite’ mode.

You should also active the debug mode, constant WP_DEBUG set to true in your wp-config.php to get more information about your installation, your problem. It should also help to find the issue with the REST API after domain change.

If it works fine, check also the whole database for the old domain. Because WordPress stores in various tables. A change for them is possible via SQL statement or a plugin, like ‘Serach Replace’. More notes for a changing of the URL are also inside the codex – https://wordpress.org/support/article/changing-the-site-url/