Free Support Forum -

Add Footer text and page number to all pages

Hi Guys,

I felt the documentation regarding header and footer a little superficial, specially on the body content.

Can anyone help me on how to add a text as footer and page number to all pages using REST API?



You can add Header/Footer to Word document using following steps:

  1. Add Header/Footer to a document Section
    ​PUT/words​/{name}​/{sectionPath}​/headersfooters Inserts to document header or footer

The possible values of header/footer type request body are:

  1. Add Text to a Header/Footer of a Section

POST ​/words​/{name}​/{paragraphPath}​/runs Adds run to document, returns added paragraph’s data.

curl -X POST "" 
-H "accept: application/json" 
-H "Authorization: Bearer [Access_Token]" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" 
-d "{"Text":"Aspose.Words Cloud"}"
  1. Update Section Setup

Now finally set DifferentFirstPageHeaderFooter value using following API as per your scenario.

PUT ​/words​/{name}​/sections​/{sectionIndex}​/pageSetup Updates page setup of section.


Please use the following API to add Page number in the Word document. It will add page numbers in the footer as per the section page setup. The Request body value can use {PAGE} and {NUMPAGES} fields.


PUT ​/words​/{name}​/PageNumbers Inserts document page numbers.

@tilal.ahmad, tks.

I´m still getting an error. What is wrong with this body request?

“HeaderFooter”: {
“link”: {
“Type”: “FooterFirst”,
“Text”: “Aspose.Words Cloud”


You already passed the header/footer index in paragraphpath parameter, so now only you need to pass the Text like

“Text”: “Aspose.Words Cloud”