Title: API endpoints return 401 error
Last modified: March 9, 2023

---

# API endpoints return 401 error

 *  Resolved [ajtallerr](https://wordpress.org/support/users/ajtallerr/)
 * (@ajtallerr)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/)
 * Some of the endpoints return 401 error. But the rest of them are working well(
   posts, comments, etc.)
 * I’m using a username and password of an admin.
    1. curl –user “usenamer:password” [https://”url”/wp-json/wp/v2/plugins](https://”url”/wp-json/wp/v2/plugins){“
       code”:”rest_cannot_view_plugins”,”message”:”Sorry, you are not allowed to manage
       plugins for this site.”,”data”:{“status”:401}}
    2. curl –user “usenamer:password” [https://”url”/wp-json/wp/v2/settings](https://”url”/wp-json/wp/v2/settings){“
       code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to do that.”,”data”:{“
       status”:401}}
    3. curl –user “usenamer:password” [https://”url”/wp-json/wp/v2/themes](https://”url”/wp-json/wp/v2/themes){“
       code”:”rest_cannot_view_themes”,”message”:”Sorry, you are not allowed to view
       themes.”,”data”:{“status”:401}}
 *  -  This topic was modified 3 years, 2 months ago by [ajtallerr](https://wordpress.org/support/users/ajtallerr/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fapi-endpoints-return-401-errors%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544795)
 * Is this a WP multisite setup by chance?
 *  Thread Starter [ajtallerr](https://wordpress.org/support/users/ajtallerr/)
 * (@ajtallerr)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544819)
 * [@littlepackage](https://wordpress.org/support/users/littlepackage/) No
 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544840)
 * You are showing your requests that don’t work. Can you show at least one that
   DOES work for you? They should all work the same, so what’s the difference? Often
   it’s literally just one misplaced character or a spelling error or something…
   🤪
 *  Thread Starter [ajtallerr](https://wordpress.org/support/users/ajtallerr/)
 * (@ajtallerr)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544885)
 * [@littlepackage](https://wordpress.org/support/users/littlepackage/)
 * I checked a lot of them. There are no misplaced characters or something. I’ve
   changed just the last part of the curl request (“/plugins” to “/posts” or to “/
   users”). And “/posts” and “/users” are successful but “/plugins”, “/themes” and“/
   settings” are not.
    -  This reply was modified 3 years, 2 months ago by [ajtallerr](https://wordpress.org/support/users/ajtallerr/).
 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544947)
 * Posts and comments are public, and so don’t require authentication. Your other
   queries are not public and there’s something wrong with your authentication. 
   The API isn’t looking for a built-in WP login admin username/password, you need
   to set up something like [https://github.com/WP-API/Basic-Auth](https://github.com/WP-API/Basic-Auth)–
   more here: [https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#basic-authentication-with-application-passwords](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/#basic-authentication-with-application-passwords)
 *  Thread Starter [ajtallerr](https://wordpress.org/support/users/ajtallerr/)
 * (@ajtallerr)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16544993)
 * [@littlepackage](https://wordpress.org/support/users/littlepackage/)
 * Thank you! It is working!
 *  [Little Package](https://wordpress.org/support/users/littlepackage/)
 * (@littlepackage)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16545004)
 * Great, glad you got the issue sorted even tho I had a typo in my last response(
   I fixed the second link I meant to send).

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

The topic ‘API endpoints return 401 error’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [Little Package](https://wordpress.org/support/users/littlepackage/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/api-endpoints-return-401-errors/#post-16545004)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
