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
| Property | Value |
|---|---|
| Method | POST |
| 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
| Parameter | Value | Mandatory/Optional | Description |
|---|---|---|---|
| file | File or String | Mandatory | Upload 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": { ... } } | Mandatory | Specify header and footer content, font settings, margins, and the page range to which the changes should apply. |
| password | String | Optional | If 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 variant | name – 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 variant | Specify the callback delivery configuration for the /callback variant. |
input_options Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| header_options | JSON Array | Array of header position objects. See header_options Parameters. | – |
| footer_options | JSON Array | Array of footer position objects. See footer_options Parameters. | – |
| font_settings | JSON Object | Global font settings. See font_settings Parameters. | Roboto, size 10 |
| margins | JSON Object | Top, bottom, left, and right margins in millimeters. | top 15, bottom 10, left 10, right 15 |
| page_range | JSON Object | Range selection for applying headers and footers. | start_page = 1 |
header_options Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| position | String | left, center, right | – |
| text | String | Static text, page number macros, date macros, or a combination | – |
| font_name | String | Supported web fonts | Inherited from font_settings |
| font_size | Float | Greater than 0 | Inherited from font_settings |
footer_options Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| position | String | left, center, right | – |
| text | String | Static text, page number macros, date macros, or a combination | – |
| font_name | String | Supported web fonts | Inherited from font_settings |
| font_size | Float | Greater than 0 | Inherited from font_settings |
font_settings Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| font_name | String | roboto, open_sans, lato, montserrat, raleway, nunito, poppins and their bold/italic variants | roboto |
| font_size | Float | Greater than 0 | 10 |
margins Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| margin_top | Float | 0 or greater | 15 |
| margin_bottom | Float | 0 or greater | 10 |
| margin_left | Float | 0 or greater | 10 |
| margin_right | Float | 0 or greater | 15 |
page_range Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| start_page | Integer | 1 or greater | 1 |
Supported Page Number Formats
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| <<1>> | Macro | Current page number only | – |
| <<1 of n>> | Macro | Current page number and total page count | – |
| <<1/n>> | Macro | Current page number slash total pages | – |
| <<Page 1>> | Macro | Page prefix plus current page number | – |
| <<Page 1 of n>> | Macro | Page prefix plus current and total pages | – |
Supported Date Formats
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| Slash-separated | Macro group | <<m/d>>, <<mm/dd/yyyy>>, <<d/m/yy>>, <<dd/mm/yyyy>>, <<mm/yyyy>> | – |
| Dot-separated | Macro group | <<m.d.yy>>, <<mm.dd.yyyy>>, <<d.m.yyyy>>, <<dd.mm.yy>>, <<mm.yyyy>> | – |
| Dash-separated | Macro group | <<yy-mm-dd>>, <<yyyy-mm-dd>> | – |
callback Parameters
| Parameter | Data Type | Possible Values | Default Value |
|---|---|---|---|
| invoke_url | String | URL. Maximum length: 300 characters. | – |
| timeout | Integer | 10 to 120 seconds | 60 seconds |
| retry_interval | Integer | 60 to 28800 seconds | 60 seconds |
| headers | JSON Object | Maximum 10 keys. Allowed characters for keys: alphabets, numbers, hyphen, underscore, dot. Maximum key length: 100. Maximum value length: 2500. | – |
| http_method_type | String | put, post | post |
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
}
}
}