diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index 716f329..11ae1ec 100644
--- src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
+++ src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
@@ -1094,7 +1094,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
 	}
 
 	/**
-	 * Sets the template for a page.
+	 * Sets the template for a post.
 	 *
 	 * @since 4.7.0
 	 * @access public
@@ -1922,14 +1922,12 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
 			);
 		}
 
-		if ( 'page' === $this->post_type ) {
-			$schema['properties']['template'] = array(
-				'description' => __( 'The theme file to use to display the object.' ),
-				'type'        => 'string',
-				'enum'        => array_keys( wp_get_theme()->get_page_templates() ),
-				'context'     => array( 'view', 'edit' ),
-			);
-		}
+		$schema['properties']['template'] = array(
+			'description' => __( 'The theme file to use to display the object.' ),
+			'type'        => 'string',
+			'enum'        => array_keys( wp_get_theme()->get_page_templates( null, $this->post_type ) ),
+			'context'     => array( 'view', 'edit' ),
+		);
 
 		$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
 		foreach ( $taxonomies as $taxonomy ) {
diff --git tests/phpunit/tests/rest-api/rest-posts-controller.php tests/phpunit/tests/rest-api/rest-posts-controller.php
index 57d5deb..e632455 100644
--- tests/phpunit/tests/rest-api/rest-posts-controller.php
+++ tests/phpunit/tests/rest-api/rest-posts-controller.php
@@ -1025,6 +1025,49 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
 		$this->check_create_post_response( $response );
 	}
 
+	/**
+	 * @ticket 38698
+	 */
+	public function test_create_item_with_template() {
+		wp_set_current_user( self::$editor_id );
+		add_filter( 'theme_post_templates', array( $this, 'filter_theme_post_templates' ) );
+
+		$request = new WP_REST_Request( 'POST', '/wp/v2/posts' );
+		$params = $this->set_post_data( array(
+			'template' => 'post-my-test-template.php',
+		) );
+		$request->set_body_params( $params );
+		$response = $this->server->dispatch( $request );
+
+		$data = $response->get_data();
+		$post_template = get_page_template_slug( get_post( $data['id'] ) );
+
+		remove_filter( 'theme_post_templates', array( $this, 'filter_theme_post_templates' ) );
+
+		$this->assertEquals( 'post-my-test-template.php', $data['template'] );
+		$this->assertEquals( 'post-my-test-template.php', $post_template );
+	}
+
+	/**
+	 * @ticket 38698
+	 */
+	public function test_create_item_with_template_none_available() {
+		wp_set_current_user( self::$editor_id );
+
+		$request = new WP_REST_Request( 'POST', '/wp/v2/posts' );
+		$params = $this->set_post_data( array(
+			'template' => 'post-my-test-template.php',
+		) );
+		$request->set_body_params( $params );
+		$response = $this->server->dispatch( $request );
+
+		$data = $response->get_data();
+		$post_template = get_page_template_slug( get_post( $data['id'] ) );
+
+		$this->assertEquals( '', $data['template'] );
+		$this->assertEquals( '      ', $post_template );
+	}
+
 	public function test_rest_create_item() {
 		wp_set_current_user( self::$editor_id );
 
@@ -2469,4 +2512,11 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
 		return $query;
 	}
 
+	public function filter_theme_post_templates( $post_templates ) {
+		return array(
+			'post-my-test-template.php' => 'My Test Template',
+		);
+
+		return $post_templates;
+	}
 }
