Put this code in function.php
add_action( 'init', 'my_customer_cpt' );
function my_customer_cpt() {
$labels = array(
'name' => _x( 'Customers', 'post type general name', 'your-plugin-textdomain' ),
'singular_name' => _x( 'Customer', 'post type singular name', 'your-plugin-textdomain' ),
'menu_name' => _x( 'Customers', 'admin menu', 'your-plugin-textdomain' ),
'name_admin_bar' => _x( 'Customer', 'add new on admin bar', 'your-plugin-textdomain' ),
'add_new' => _x( 'Add New', 'Customer', 'your-plugin-textdomain' ),
'add_new_item' => __( 'Add New Customer', 'your-plugin-textdomain' ),
'new_item' => __( 'New Customer', 'your-plugin-textdomain' ),
'edit_item' => __( 'Edit Customer', 'your-plugin-textdomain' ),
'view_item' => __( 'View Customer', 'your-plugin-textdomain' ),
'all_items' => __( 'All Customers', 'your-plugin-textdomain' ),
'search_items' => __( 'Search Customers', 'your-plugin-textdomain' ),
'parent_item_colon' => __( 'Parent Customers:', 'your-plugin-textdomain' ),
'not_found' => __( 'No customers found.', 'your-plugin-textdomain' ),
'not_found_in_trash' => __( 'No customers found in Trash.', 'your-plugin-textdomain' )
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.', 'your-plugin-textdomain' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'customer' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'show_in_rest' => true,
'rest_base' => 'customers-api',
'rest_controller_class' => 'WP_REST_Posts_Controller',
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'customer', $args );
}
Then hit the url http://yourdomian.com/wp-json/wp/v2/customers-api
If result not showing
then simply hit the http://yourdomian.com/wp-json url
then check the routes and search the rest_base name in it ‘customers-api’
Make sure you have post in customer post type.