Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Can we get Confluence Page ID via REST for a given page URL

I need Confluence Page ID and page owner values using REST api for a given Confluence URL. Is it possible?

2 answers

1 accepted

5 votes
Answer accepted
AnnWorley Atlassian Team Nov 21, 2017

Hi Srinivas,

This page has an example of how to get the page ID and creator if you have the URL (which includes the space key and page title):

Confluence REST API Examples

Please see the heading, "Find a page by title and space key".

There are no page owners in Confluence, but perhaps finding the creator will be of help.

Please let us know any follow up questions.



In some case, the page is given with a url with no Title at all. It may be a tiny url. Is there anyway we can get the page Id from that, using REST API?

Like Moritz_Ringler likes this

The way I manage around in this case (no title, no space) is to do one extra step to 'get' this tiny url content first, then extract the space, title and id from the metadata content.

They are kept in the attributes with names ajs-space-key, ajs-page-title and ajs-latest-page-id. 


@AnnWorley Can I get only page ID as a response in JSON instead of all the info of the page?

Here is a code snippet in Python:

import os, re, sys, json, requests
# In the page URL, replace the + symbols with %20
confPage =
auth = (confUsername, confPassword)
headers = { 'Content-type': 'application/json', 'Accept': 'application/json' }
res = requests.get(confPage)  
#print (res.content)
matched_lines = [line for line in (res.text).split('\n') if "ajs-page-id" in line]
if len(matched_lines) == 0: exit("Page ID not found")
# Output line example: <meta name="ajs-page-id" content="544428643"> , need that page-id
pageID = (matched_lines[0].split()[2].strip('<').strip('>').split('"')[1])
print (" Page ID: " + pageID)

Suggest an answer

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

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

40,312 views 28 129
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