Curl REST API - {"message":"Current user not permitted to use Confluence","statusCode":403}
Asked by Senthil Prasanth:

Hello Experts,

I am recently exploring confluence REST APIs. I was trying examples at <https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/>

So I created a my free sample Space \& Confluence Page at Atlassian cloud [https://userid.atlassian.net/](https://senthilprasanth.atlassian.net/)

When I tried using curl GET example I am getting

{  
"message": "Current user not permitted to use Confluence",  
"statusCode": 403  
}

I referred all the examples \& Suggestions given at below links but couldn't able to figure out the issue. If you could help me out in understanding and showing me the direction that would be great.

<https://community.atlassian.com/t5/Confluence-questions/Confluence-Cloud-REST-API-quot-message-quot-quot-Current-user/qaq-p/1566379>

<https://community.developer.atlassian.com/t/current-user-not-permitted-to-use-confluence-error-when-getting-app-properties/38472>

<https://community.developer.atlassian.com/t/401-unauthorized-with-bearer-token-from-oauth/42561>

Error step:

C:\\Users\\sent\>curl -D- --ssl-no-revoke -u \<userid\>:\<Api token\> -X GET -H "Content-Type: application/json" <https://userid.atlassian.net/wiki/rest/api/content/>\<pageno\>  
HTTP/1.1 403 Forbidden  
Server: AtlassianProxy/1.19.3.1  
vary: Accept-Encoding  
cache-control: no-cache, no-store, must-revalidate  
Content-Type: application/json  
Strict-Transport-Security: max-age=315360000; includeSubDomains; preload  
Date: Thu, 27 Jan 2022 20:28:40 GMT  
ATL-TraceId: 08513d1914924ded  
expires: Thu, 01 Jan 1970 00:00:00 GMT  
X-XSS-Protection: 1; mode=block  
Transfer-Encoding: chunked  
x-envoy-upstream-service-time: 42  
X-Content-Type-Options: nosniff  
ATL-Confluence-Via: h:confluence-prod-us-7-3.prod.atl-paas.net  
Expect-CT: report-uri="<https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy>", enforce, max-age=86400  
Connection: Keep-Alive

{"message":"Current user not permitted to use Confluence","statusCode":403}


Answers:
author: Art Linkov
body: Hi [@Senthil Prasanth](/t5/user/viewprofilepage/user-id/4011135)

I just faced the same problem, after digging a little bit in the suggested examples by [@Pramodh M](/t5/user/viewprofilepage/user-id/3691224) I found the solution that worked for me.

What you need to do is essentially just add an \`Authorization\` header with the following format:

\`Authorization: Basic \<base64 encoded token\>\`

Where the \`\<base64 encoded token\>\` should be generated by encoding the following string:

\`your_email@domain.com:your_user_api_token\` =\> Base64 encoding =\> \`eW91cl9lbWFpbEBkb21haW4uY29tOnlvdXJfdXNlcl9hcGlfdG9rZW4=\`

(Atlassian recommends this site for the encoding <https://www.base64encode.net/>)

Keep in mind, at first I could not make it work too, but then I remembered that my email was changed so I had to generate a new encoded token, following which the API call worked.

Hope this helps!

Regards,

Art Linkov


author: Abdullah Khawer
body: The Atlassian user should have access to Confluence app, the \`View\` and \`Add\` permissions in the space on it and the \`Can edit\` permission on the page in that space. Also, you need to create an API token as the password won't work. After doing all of this, it worked for me.


author: Dara O hEidhin
body: This did my nut in until I realised that being logged into multiple Confluence accounts was causing the issue.  

I use my company email for day to day and my personal email to test my scripts before I use them in production.

As it turned out, even though I was logged into my personal account in the dev spaces, when I clicked the link from there, in settings, to create an API, the resultant settings page was under the work email.   

Long story short, see if when creating an API key you are logged into the correct account.


author: Yu Qiu
body: Same here.. Took 3 hours and cannot find a reason. I am the org owner but I cannot change the permission of a space.


author: Pramodh M
body: Hi [@Senthil Prasanth](/t5/user/viewprofilepage/user-id/4011135)

Did you create a token from here

<https://id.atlassian.com/manage-profile/security/api-tokens>

And can you navigate to Confluence UI?

Let me know

Thanks

comments: author: Senthil Prasanth
body: Hello [@Pramodh M](/t5/user/viewprofilepage/user-id/3691224)

Yes, I created a API token at <https://id.atlassian.com/manage-profile/security/api-tokens>

* I could able to login to my Confluence UI and I can able to navigate to Confluence UI
* Even I can able to get the required content from browser ( Chrome \& Edge ) <https://userid.atlassian.net/wiki/rest/api/content/>\<pageno\>
* But when I use a Curl (or) Python script to GET the same content, I get the following error.

{  
"message": "Current user not permitted to use Confluence",  
"statusCode": 403  
}

Thanks in Advance.


author: Senthil Prasanth
body: Hello Experts,

Could you please assist us here.

Thanks in Advance;


author: Peng Xi
body: I just found it here. I also encountered a similar problem. The difference is that I can upload successfully using curl, but I try to send about 800m files in GitHub action (I'm waiting for pipeline to update some features to switch to bitbucket)

\`{"message":"Current user not permitted to use Confluence","statusCode":403}\`

Any suggestions?


author: Pramodh M
body: Hi [@Senthil Prasanth](/t5/user/viewprofilepage/user-id/4011135) [@Peng Xi](/t5/user/viewprofilepage/user-id/4674065)

Please follow the format here to successfully call the API

<https://developer.atlassian.com/cloud/confluence/rest-api-examples>


author: Senthil Prasanth
body: Hello [@Pramodh M](/t5/user/viewprofilepage/user-id/3691224)

Thanks for your reply. But I am still facing the same error.

I am following the same procedure as you pointed out. Any help is much appreciated here

Regards,

Senthil Prasanth K


author: Jake Porter
body: [@Senthil Prasanth](/t5/user/viewprofilepage/user-id/4011135) make sure you don't forget to replace the "your-domain.atlassian.net" in the url variable with your actual domain... may not be the issue you are having, but i totally missed it  

url = "https://**your-domain.atlassian.net** /wiki/rest/api/content/{id}/child"  


author: MarkusS
body: Same problem here, no solution.  
I am doing REST calls every day as part of my job.

But I can't make it work with Atlassian :-(

Do I have to enable the API access on my Spaces?

Where do you control if the "Basic User" is allowed to access the requested page via API? Or is a user per s? allowed to access pages via API if he has a token?

```
GET https://<MyDomain>.atlassian.net//wiki/rest/api/content/166662/child

Authorization: Basic {{Atlassian.Basic}}
Content-Type: application/json
```

```
HTTP/1.1 403 Forbidden 
{  "message": "Current user not permitted to use Confluence",  
"statusCode": 403 }
```


author: SiDawg
body: I got same issue after successfully using the "create page" V2 API's: the code i was referencing (chatgpt!) was adding authorization header with "Bearer \[auth string\]" in my create attachment code, rather than "Basic \[auth string\]" like I had been using with the other API's.... Good news is im no longer getting this error: bad news im now getting "no multipart boundary" error but I think after I whip chatGPT a few times it will work :D


author: SiDawg
body: ...and yeah, the auth string = Base64(USERNAME + ":" + APITOKEN) where username = your email address and apitoken = from Atlassian site <https://id.atlassian.com/manage-profile/security/api-tokens>


author: gabriel.fournier
body: Same issue here. I have created a page and now I can't add tags cause of permissions apparently...


Tags: cloud

confluence-cloud