Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Error 415 when uploading attachment to Confluence via REST API?


I'm trying to upload a file as an attachment to a Confluence page via the REST API, but I keep getting error 415, which according to this page means "Unsupported Media Type".

I have Confluence Server so I'm going off of this example in Confluence Server's REST API documentation. I've also looked at this from the Confluence Cloud documentation, but it looks basically the same.

I'm using PowerShell; here's my code ('<confluence server>', '<pageID>', and '<basicAuth>' are obviously substitutions):

Invoke-RestMethod `
    -Method POST `
    -Uri https://<confluence server>/confluence/rest/api/content/<pageID>/child/attachment `
    -InFile file.txt `
    -Headers @{
      Authorization = "Basic <basicAuth>"

I've found many of the same/similar questions and most of the answers are to set the correct Content Type. Many of the answers point to this page, which says the same.

I've tried all variations of content types and none of them work:

  • application/json
  • application/text
  • text/plain
  • application/xml
  • multipart/form-data

Nothing is working. The only change happens if I set the content type to simply 'text', then I get a different error:

HTTP Status 400 – Bad Requestbody

It's a plain text file, but ultimately I'll be uploading different file types like docx, etc. so hopefully the content type isn't filetype-specific.

Is there a content type I'd use for any general purpose file upload?

Any help is appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events