Title: WP-API get posts with status=draft returns 401
Last modified: July 27, 2020

---

# WP-API get posts with status=draft returns 401

 *  [pelicanpaul](https://wordpress.org/support/users/pelicanpaul/)
 * (@pelicanpaul)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/wp-api-get-posts-with-statusdraft-returns-401/)
 * I understand why for the public you would not want to show posts that are in 
   draft mode, but I have a special circumstance where I need to show posts that
   are in draft to the public, a user not logged in.
 * If I put this post (20512) in draft I get this error when trying the GET the 
   page.
    [http://localhost:2029/wp-json/wp/v2/pages/20512?status=publish,draft](http://localhost:2029/wp-json/wp/v2/pages/20512?status=publish,draft)
 * {
    code: “rest_forbidden”, message: “Sorry, you are not allowed to do that.”,
   data: { status: 401 } }
 * Is there a workaround, plugin or method I can use to get drafts with the API?
 * thanks,
 * Paul
    -  This topic was modified 5 years, 10 months ago by [James Huff](https://wordpress.org/support/users/macmanx/).
      Reason: moved to Localhost Installs since this is a localhost install

Viewing 1 replies (of 1 total)

 *  [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * (@autotutorial)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/wp-api-get-posts-with-statusdraft-returns-401/#post-13177580)
 * > For developers making manual Ajax requests, the nonce will need to be passed
   > with each request. The API uses nonces with the action set to wp_rest. These
   > can then be passed to the API via the _wpnonce data parameter (either POST 
   > data or in the query for GET requests), or via the X-WP-Nonce header. If no
   > nonce is provided the API will set the current user to 0, turning the request
   > into an unauthenticated request, even if you’re logged into WordPress.
 * [https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/)

Viewing 1 replies (of 1 total)

The topic ‘WP-API get posts with status=draft returns 401’ is closed to new replies.

 * In: [Localhost Installs](https://wordpress.org/support/forum/localhost-installs/)
 * 1 reply
 * 2 participants
 * Last reply from: [autotutorial](https://wordpress.org/support/users/autotutorial/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/wp-api-get-posts-with-statusdraft-returns-401/#post-13177580)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
