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

REST API call to return page attachments (created or modified after a certain date)

Hello community,


There was a post from a while back asking about how to get attachments of a confluence page via REST API.


The reason I'm asking is I have over 1000 attachments on a page and its growing every day. The problem is I don't want to see the old attachments anymore in my REST call because the data has already been handled from them and I just want to look at newer attachments only with the call. I was wondering if this could be taken a step further somehow and get attachments for a page within a specified time range or greater than a certain start time (this can based off either its modified or creation date)? I didn't see any attributes showing dates in the returned JSON but maybe someone knows a way to check for this :/



1 answer

1 accepted

1 vote
Answer accepted
Davin Studer Community Leader Feb 19, 2020

You could use the CQL search REST API like this. Replace {Your Server} with your Confluence server and {Containing Page ID} with the page id that the attachments are attached to. This will get attachments to that page that are created or updated in the last 14 days.

https://{Your Server}/rest/api/search?cql=type%20%3D%20attachment%20and%20container%20%3D%20{Containing Page ID}%20and%20(created%20%3E%3D%20startOfDay(%22-14d%22)%20or%20lastmodified%20%3E%3D%20startOfDay(%22-14d%22))

 This is the CQL not URL encoded ...

type = attachment and container = {Containing Page ID} and (created >= startOfDay("-14d") or lastmodified >= startOfDay("-14d"))

I was not even aware that Confluence had its own query language. This was exactly what I needed. Thank you!

Like Davin Studer likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

4,118 views 4 6
Join discussion

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