Title: API unexpected behaviour
Last modified: February 8, 2022

---

# API unexpected behaviour

 *  [edo78](https://wordpress.org/support/users/edo78/)
 * (@edo78)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/api-unexpected-behaviour/)
 * Hi, wordpress newbie here. Not even 100% sure this is the right place for my 
   question but there are so many support channels that I’m a bit lost.
 * I have a self-hosted instance of wordpress and I’m having an issue with a specific
   endpoint.
 * I’ve done some test and calling GET `/wp/v2/posts` is working as intended returning
   public posts (eg. only published posts and no drafts) but GET `/wp/v2/posts` 
   return a 401 error with code `rest_forbidden`
 * Am I missing something? I’d expect the settings should be public (I’m trying 
   to get the title, description and url of the site) but wordpress doesn’t want
   to show them to me …
    -  This topic was modified 4 years, 4 months ago by [t-p](https://wordpress.org/support/users/t-p/).
      Reason: Moved to Fixing WordPress from Everything else WordPress
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fapi-unexpected-behaviour%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Teddy Patriarca](https://wordpress.org/support/users/tykoted/)
 * (@tykoted)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/api-unexpected-behaviour/#post-15344509)
 * > I’ve done some test and calling GET /wp/v2/posts is working as intended returning
   > public posts (eg. only published posts and no drafts) but GET /wp/v2/posts 
   > return a 401 error with code rest_forbidden
 * Hi, I believe your concern is you’re getting 401 error in the `/wp/v2/settings`
   endpoint? You’ve mentioned the same endpoint in your post.
 * If you really mean `wp/v2/settings` endpoint, you need to implement authentication
   to access it. Some endpoints require an authentication for security purposes.
   Basically, you need to add a cookie and nonce to do that. See this documentation
   for the details. [https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#cookie-authentication)
    -  This reply was modified 4 years, 4 months ago by [Teddy Patriarca](https://wordpress.org/support/users/tykoted/).
 *  Thread Starter [edo78](https://wordpress.org/support/users/edo78/)
 * (@edo78)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/api-unexpected-behaviour/#post-15344873)
 * Sorry I made a “copy&paste” error. My problem is with the settings endpoint.
 * Is there any endpoint that doesn’t require authentication to return title, description
   and url of a site?
 * Those are all public info and I struggle to find a way to obtain them without
   struggling with an auth mechanism.
 * BTW thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘API unexpected behaviour’ is closed to new replies.

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [edo78](https://wordpress.org/support/users/edo78/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/api-unexpected-behaviour/#post-15344873)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
