Add Headers and Footers

Purpose

This API allows you to add headers and footers on PDF pages with support for static text, dynamic page numbers, and date macros.

Quick Reference

PropertyValue
MethodPOST
Request URL (Download)https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter
Request URL (Store)https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter/store
Request URL (Callback)https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter/callback

Body Parameters

ParameterValueMandatory/OptionalDescription
fileFile or StringMandatoryUpload the PDF file from your local drive or desktop. If the PDF file is available via a publicly accessible web URL, you can provide the URL using the same parameter.
input_options{
  "header_options": [ { ... } ],
  "footer_options": [ { ... } ],
  "font_settings": { ... },
  "margins": { ... },
  "page_range": { ... }
}
MandatorySpecify header and footer content, font settings, margins, and the page range to which the changes should apply.
passwordStringOptionalIf the input PDF is password protected, specify the password to unlock it.
output_settings{
  "name": "<document_name>",
  "folder_id": "<folder_id>",
  "overwrite_existing_file": true | false
}
Mandatory for store variantname – Specify the name for the modified PDF document.
folder_id – Specify the ID of the WorkDrive folder in which to store the output file.
overwrite_existing_file(optional) – Set to true to overwrite an existing file with the same name in the folder.
callback{
  "invoke_url": "<callback_url>",
  "timeout": 60,
  "retry_interval": 60,
  "headers": {
    "header_name": "header_value"
  },
  "http_method_type": "post"
}
Mandatory for callback variantSpecify the callback delivery configuration for the /callback variant.

input_options Parameters

ParameterData TypePossible ValuesDefault Value
header_optionsJSON ArrayArray of header position objects. See header_options Parameters.
footer_optionsJSON ArrayArray of footer position objects. See footer_options Parameters.
font_settingsJSON ObjectGlobal font settings. See font_settings Parameters.Roboto, size 10
marginsJSON ObjectTop, bottom, left, and right margins in millimeters.top 15, bottom 10, left 10, right 15
page_rangeJSON ObjectRange selection for applying headers and footers.start_page = 1

header_options Parameters

ParameterData TypePossible ValuesDefault Value
positionStringleft, center, right
textStringStatic text, page number macros, date macros, or a combination
font_nameStringSupported web fontsInherited from font_settings
font_sizeFloatGreater than 0Inherited from font_settings
ParameterData TypePossible ValuesDefault Value
positionStringleft, center, right
textStringStatic text, page number macros, date macros, or a combination
font_nameStringSupported web fontsInherited from font_settings
font_sizeFloatGreater than 0Inherited from font_settings

font_settings Parameters

ParameterData TypePossible ValuesDefault Value
font_nameStringroboto, open_sans, lato, montserrat, raleway, nunito, poppins and their bold/italic variantsroboto
font_sizeFloatGreater than 010

margins Parameters

ParameterData TypePossible ValuesDefault Value
margin_topFloat0 or greater15
margin_bottomFloat0 or greater10
margin_leftFloat0 or greater10
margin_rightFloat0 or greater15

page_range Parameters

ParameterData TypePossible ValuesDefault Value
start_pageInteger1 or greater1

Supported Page Number Formats

ParameterData TypePossible ValuesDefault Value
<<1>>MacroCurrent page number only
<<1 of n>>MacroCurrent page number and total page count
<<1/n>>MacroCurrent page number slash total pages
<<Page 1>>MacroPage prefix plus current page number
<<Page 1 of n>>MacroPage prefix plus current and total pages

Supported Date Formats

ParameterData TypePossible ValuesDefault Value
Slash-separatedMacro group<<m/d>>, <<mm/dd/yyyy>>, <<d/m/yy>>, <<dd/mm/yyyy>>, <<mm/yyyy>>
Dot-separatedMacro group<<m.d.yy>>, <<mm.dd.yyyy>>, <<d.m.yyyy>>, <<dd.mm.yy>>, <<mm.yyyy>>
Dash-separatedMacro group<<yy-mm-dd>>, <<yyyy-mm-dd>>

callback Parameters

ParameterData TypePossible ValuesDefault Value
invoke_urlStringURL. Maximum length: 300 characters.
timeoutInteger10 to 120 seconds60 seconds
retry_intervalInteger60 to 28800 seconds60 seconds
headersJSON ObjectMaximum 10 keys. Allowed characters for keys: alphabets, numbers, hyphen, underscore, dot. Maximum key length: 100. Maximum value length: 2500.
http_method_typeStringput, postpost

Important: If you want to preserve some existing header/footer positions while changing others, you must re-specify all desired positions in the same API call. Any position not included in header_options or footer_options will be empty after the operation.


Notes and Limits

  • The maximum file size allowed for the input PDF is 50 MB.
  • Existing standard headers and footers are removed before the new ones are added.
  • You can combine static text with page number or date macros in the same header or footer position.
  • Only freely available web fonts are supported.
  • The store variant requires a Zoho WorkDrive account.
  • To use the download or callback variants, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL
  • To use the store variant, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL, WorkDrive.files.ALL, WorkDrive.organization.ALL

Possible Errors

Refer to the following pages for the list of possible errors for this API:

Download Variant Sample Request

CopiedDefault font for all positions: No font_name or font_size specified. All positions will use the default font (roboto, size 10).

curl --location --request POST "https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@/Users/username/Documents/Original.pdf' \
  --form 'password="pdf_password"' \
  --form 'input_options={
    "header_options": [
      { "position": "center", "text": "Confidential Document" },
      { "position": "right", "text": "<<mm/dd/yyyy>>" }
    ],
    "footer_options": [
      { "position": "left", "text": "<<Page 1 of n>>" },
      { "position": "right", "text": "Generated by Zoho" }
    ],
    "margins": { "margin_top": 15, "margin_bottom": 10, "margin_left": 10, "margin_right": 15 },
    "page_range": { "start_page": 1 }
  }'

Store Variant Sample Request

CopiedOne font for all positions: A single global font_settings group is set. All positions inherit this font — no need to specify font individually for each position.

curl --location --request POST "https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter/store" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@/Users/username/Documents/Original.pdf' \
  --form 'password="pdf_password"' \
  --form 'input_options={
    "header_options": [
      { "position": "center", "text": "Annual Report 2026" },
      { "position": "right", "text": "<<mm/dd/yyyy>>" }
    ],
    "footer_options": [
      { "position": "center", "text": "<<Page 1 of n>>" },
      { "position": "right", "text": "Company Inc." }
    ],
    "font_settings": { "font_name": "lato_bold", "font_size": 11 },
    "margins": { "margin_top": 12, "margin_bottom": 12, "margin_left": 15, "margin_right": 15 }
  }' \
  --form 'output_settings={"name": "Report_With_Headers.pdf", "folder_id": "<folder_id>", "overwrite_existing_file": true}'

Callback Variant Sample Request

CopiedDifferent fonts per positions: Each position specifies its own font_name and font_size. Positions without per-position font settings fall back to the global font_settings (or the default roboto if omitted).

curl --location --request POST "https://{zohoapis_domain}/pdfeditor/api/v1/pdf/content/headerfooter/callback" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@/Users/username/Documents/Original.pdf' \
  --form 'password="pdf_password"' \
  --form 'input_options={
    "header_options": [
      { "position": "left", "text": "<<yyyy-mm-dd>>", "font_name": "nunito_italic", "font_size": 9 },
      { "position": "center", "text": "Draft", "font_name": "montserrat_bold", "font_size": 14 }
    ],
    "footer_options": [
      { "position": "right", "text": "<<1/n>>" }
    ],
    "font_settings": { "font_name": "roboto", "font_size": 8 },
    "page_range": { "start_page": 2 }
  }' \
  --form 'callback={"invoke_url": "https://www.example.com/v1/api/callback/savecallback", "timeout": 120, "retry_interval": 60, "http_method_type": "post"}'

Download Variant Sample Response

Copied{
  "status": "inprogress",
  "status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/headerfooter/job/e9051e30fd7f0093cba4247d1f831e03e945a127bde429ed6e9ef3a703b15a6060b830256c650cb88a3f687773c33076"
}

Download Variant Success Response

Copied{
  "status": "success",
  "download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/headerfooter/download/6407839f35722159e06ed5231827a497e0f57c7f7a248c7f2af73a4252247d911c91260ac3f84219db980dff4d89a855",
  "response_generated_time": 1780912499331
}

Store Variant Sample Response

Copied{
  "status": "inprogress",
  "status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/headerfooter/job/2ae74c719bdb14ed9941fe351ade742439bf75ab0fb8fdf0a68b57a7a60cbd54ab7cb7bea5d0fafb4d2560a90331aaf8",
  "document_id": "hf3e60435a4c7576f4d21a16cfc292a4c64a9",
  "document_url": "https://workdrive.zoho.com/file/hf3e60435a4c7576f4d21a16cfc292a4c64a9"
}

Store Variant Success Response

Copied{
  "status": "success",
  "document_id": "hf3e60435a4c7576f4d21a16cfc292a4c64a9",
  "document_url": "https://workdrive.zoho.com/file/hf3e60435a4c7576f4d21a16cfc292a4c64a9",
  "response_generated_time": 1780912529135
}

Callback Variant Sample Response

Copied{
  "status": "inprogress",
  "status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/headerfooter/job/1d358192770dc68d173ca34b8f7c9dcb121ad0bf3d6307b7387be79e76dacf586f9d62cd253c26020f8c3dcf79d51b6b"
}

Callback Variant Success Response

Copied{
  "status": "success",
  "callback_response": {
    "invoked_time": 1780912655806,
    "http_status_code": 200,
    "message": {
      "download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/content/headerfooter/download/6407839f35722159e06ed5231827a497e0f57c7f7a248c7f2af73a4252247d911c91260ac3f84219db980dff4d89a855",
      "response_generated_time": 1780912656237
    }
  }
}