Only 401 errors when searching confluence api

Hello all.

I am having trouble searching with the Confluence search api. I have an app set up to have all the scopes I should need (mainly search:confluence and read:confluence-content.all). I also enabled the User Identity API as I will need that.

I am able to successfully generate an access token via OAuth Code Grants.
I am able to hit the self info endpoint successfully.
I am able to hit the token accessible resources successfully.

I am seeing the correct permissions returned by the accessible resources endpoint

I am not able to access the Search api endpoint. I have tried the end point that uses the cloud_id which returned 401 “Unauthorized” and I have tried the atlassian-domain endpoint that returns 401 “Request rejected because issuer is either not authorized or not authorized to impersonate”

For example

curl --request GET --url ‘https://api.atlassian.com/ex/confluence/cloud_id/rest/api/search?cql=type=page&limit=25’ --header ‘Authorization: Bearer TOKEN_HERE’ --header ‘Accept: application/json’

curl --request GET --url ‘https://mydomain.atlassian.net/wiki/rest/api/search?cql=type=page&limit=25’ --header ‘Authorization: Bearer TOKEN_HERE’ --header ‘Accept: application/json’

both return a form of 401.

Since the token works for other endpoints and these are both the recommended search endpoints I would guess that the mistake is somewhere else.

Is there a step I am missing? Is there an issue with the API? Any other advice?

Thanks!
-Cameron

Hi;
Did you fix your issue ? I am having the same problem with the Users (get current user) endpoint.

I am also facing the same issue . Can anyone help?

I use cookie from my browser in the header and it works for me