Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Upload PDF file in a page | UpdatePage by adding a PDF file | REST API v2

Shivendra Chouksey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2025

I have found Atlassian confluence REST API v2 via their docs :- https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-labels-id-pages-get

There I found api for working with Pages (specially for my usecase)
It includes multiple API’s, I’m using get Page by Id, create page, update pages.
I was able to do the things I wanted, like creating a page, updating a page.

But now I am stuck and doesn’t find anywhere a solution to it.

In confluence page UI, we have a option to add attachment, insert file.
Similarly, I wanted to add a PDF file in my confluence page, but using REST API multipart/form.

But unable to find a way to do so, found an api but I don’t know where it was attaching a file, I couldn’t find it anywhere in my page.

https://domainName.atlassian.net/wiki/rest/api/content/{page_id}/child/attachment
(I believe this is for confluence cloud ?)
It’s response also have some links on clicking it I was landing on a json page.

I need help if anyone here worked with uploading / adding a file in confluence page using REST API please let me know how it can be done.

Please let me know of any docs if any moderator/consultant from Atlassian is reading this.

1 answer

0 votes
Jim Knepley - ReleaseTEAM
Atlassian Partner
April 22, 2025

Welcome to the community @Shivendra Chouksey 

To create an attachment, you need to use the V1 API. Parts of the V1 API are deprecated, other parts are not. This is one of the parts that hasn't been implemented in V2 yet.

ref: https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-post

Shivendra Chouksey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2025

Hi @Jim Knepley - ReleaseTEAM , Thanks for sharing.
But I issue i am facing is the attachment is not reflecting under the page(pageId) against which I have send that pdf.
As per the API response it is giving some link which is taking me to a page full of json, showing my pdf name some details about when created and by me.

But it is not reflecting inside confluence page (pageId i have given).

Can you please help ?

Jim Knepley - ReleaseTEAM
Atlassian Partner
April 23, 2025

I've never seen the behavior you're describing.

If a properly structured API call to create an attachment responds as successful but doesn't result in that content appearing as part of the page, I would bring that up with Atlassian support.

Like Shivendra Chouksey likes this
Shivendra Chouksey
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 23, 2025

I got some updates on this, as I said it is successfully uploading a pdf but unable to show it in a confluence page.

I found this uploaded pdf under attachments, 
{Open the confluence page against which pdf is uploaded > Clicking on three dots, present in top right corner > Attachments > Files > Showing files I have uploaded using attachment api}.


But still this behaviour is strange, I mean If a confluence page have attachments it should show explicitly, but as of current scenario it is showing a empty clean page.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events