404 error custom post type rest api

You need to declare that your CPT supports REST via show_in_rest when registering it, then use the REST API endpoint for that post type.

For example, I have a CPT on my own site for talks named tomjn_talks, and it has an endpoint at /wp/v2/tomjn_talks