It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

is it possible to upload a image in confluence

Hi All


I am new to confluence, my task is to upload a multiple images to confluence page through rest call. can anyone give a sample example. i tried with curl but i am getting 405 error


curl -D- -u admin:password -X POST -H "X-Atlassian-Token: nocheck" -F "file=@host.txt"

please any one help. 

Thanks in advance



1 answer

1 vote
DPK J Community Leader Dec 18, 2019

@noor basha  Welcome to the community, something like this might work for you.

curl -D- -u '<USER_NAME>:<PASSWORD>' \
-H 'X-Atlassian-Token: nocheck' \
-F 'file=@"<FILE_PATH>"' \

And the response 405 implies method you are using i.e. POST is not applicable, so please check if your page is not blocked for editing etc.

Thanks for quick response sir, I tried this it gives response 200 but image not inserting. page is blank.
curl -D- -u 'admin:password' -X POST -H 'X-Atlassian-Token: nocheck' -F 'file=@"/root/host.txt"' ''

import requests
def upload_image():
url = '' + \
str(id) + '/child/attachment/'
#headers = {'Content-Type: application/json'}
#headers = {'Content-Type': 'image/jpeg'}
headers = {"X-Atlassian-Token": "nocheck"}
content_type = 'image/jpeg'
file = 'download.jpg'
files = {'file': ('download.jpg', open('download.jpg', 'rb'),content_type)}
auth = ("admin", "password")
r =, headers=headers, files=files, auth=auth)

I tried with this script also. in both cases I am getting 200 response but page is blank. please help me. its 2nd day I am working on this same

i tried with different approach then it is working fine. but my problem is the picture is not displaying in confluence page. picture is in attachments, i need to display in confluence page. 

please give some reference to display the picture with rest api

DPK J Community Leader Dec 19, 2019

Displaying attachment on confluence page is another part of story and you will need to fire separate APIs for this.

You need to put something like this in your page body using API,

  <ri:attachment ri:filename="atlassian_logo.gif" />

Here is an working API example, in first API I'm adding image `sample.png` as attachment and later in second API call I'm displaying that in page using Confluence Structure format in body.


curl -D- -u '<USERNAME>:<PASSWORD>' \
-H 'X-Atlassian-Token: nocheck' \
-F 'file=@"./sample.png"' \

curl --request PUT \
--url '<CONFLUNCE_BASE_URL>/rest/api/content/<PAGE_ID>' \
--user '<USERNAME>:<PASSWORD>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"title":"Sample Page",
"value":"<p>Adding image to page</p><ac:image><ri:attachment ri:filename=\"sample.png\" /></ac:image>",

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence Cloud

Bring information from GitHub into Confluence

I’ve got a couple of questions for you. Do you write technical documentation? What about technical documentation that references code and files from GitHub? In this article you will learn how to in...

32 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you