Generate API
The Generate API is the primary endpoint for creating new documents in Avocazo. When called, this API initiates the document generation process and starts the associated approval workflows. The API supports multiple document types, including Analytical Reports, Transactional Documents, and Structured Forms, using either static or dynamic templates.
Every request must include a valid API Key in the header (X-API-KEY), as described in the Authentication section.
Endpoint
POST /api/generate
Request Body
The request body must be a JSON object containing the document structure. Each field is described below.
| Field | Type | Required | Description |
|---|---|---|---|
title |
string | Yes | The title of the document to be shown to signers in emails. |
direction |
string | Yes | Text alignment direction: LEFT_TO_RIGHT or RIGHT_TO_LEFT. |
header |
object | No |
Header configuration. Includes:
|
body |
object | Yes |
Body template configuration. Includes:
|
footer |
object | No |
Footer configuration. Includes:
|
Example Request
{
"title": "Employee Join Request",
"direction": "LEFT_TO_RIGHT",
"header": {
"template": "HEADER_1",
"show_logo": true,
"title": "Customer Join Request",
"subtitles": ["123 Main Street,","San Francisco CA, 94103"],
"metadata": [
{
"label": "Join Date",
"value": "01 May 2025"
},
{
"label": "To Date",
"value": "01 Jun 2025"
}
],
"separator": true
},
"body": {
"template": "BOXED_SECTIONS"
"spacing": 5,
"decoration":{
"field_fill_color": "#f7feff",
"field_border": "BOTTOM"
},
"sections": [
{
"title": "1. Personal Information",
"items": [
{ "type": "field", "label": "Full Name (as per ID)", "value": "Johnathan A. Doe", "flex": 1 },
{ "type": "field", "label": "Gender", "value": "Male", "flex": 1 },
{ "type": "field", "label": "Date of Birth", "value": "1990-05-12", "flex": 1 },
{ "type": "field", "label": "Nationality", "value": "American", "flex": 1 },
{ "type": "field", "label": "ID / Passport Number", "value": "X123456789", "flex": 1 },
{ "type": "field", "label": "Expiry Date", "value": "2030-05-12", "flex": 1 },
{ "type": "field", "label": "Place of Birth", "value": "San Francisco, CA", "flex": 1 },
{ "type": "field", "label": "Mother's Maiden Name", "value": "Anderson", "flex": 1 },
{ "type": "checkbox", "label": "Marital Status", "value": "Married", "options": ["Single", "Married"], "flex": 1 }
]
},
{
"title": "2. Contact Details",
"items": [
{ "type": "field", "label": "Mobile Number", "value": "+1 555-123-4567", "flex": 1 },
{ "type": "field", "label": "Phone Number (Optional)", "value": "+1 555-987-6543", "flex": 1 },
{ "type": "field", "label": "Email Address", "value": "john.doe@example.com", "flex": 1 },
{ "type": "field", "label": "Residential Address", "value": "1234 Elm Street, Apt 7B", "flex": 2 },
{ "type": "field", "label": "City", "value": "Los Angeles", "flex": 1 },
{ "type": "field", "label": "Country", "value": "USA", "flex": 1.5 },
{ "type": "field", "label": "Preferred Communication Language", "value": "English", "flex": 1.5 }
]
},
]
},
"footer": {
"template": "BLANK",
"separator": false,
"signatures": [],
}
}
Example Response
{
"status": "Scheduled",
"message": "Your document has been scheduled for generation.",
"document": {
"id": "A.YDUMPIMAGQ8JJNE",
"title": "Employee Join Request",
"header_template": "HEADER_1",
"footer_template": "BLANK",
"page_template": "BOXED_SECTIONS",
"service": "Structured Form Document Generation"
},
"billing": {
"plan": "Free"
},
"tracking_api": "https://avocazo.com/api/track/A.YDUMPIMAGQ8JJNE"
}
Notes
- The
bodytemplate may contain additional attributes depending on the template type. To see the full schema for a specific template, clients can browse the Templates section in their dashboard and click the Scheme button for the page template. - Clients can choose a Dynamic Template to fully control the schema, or a Static Template to simply fill in the required data fields.
- The
headerandfooterconfigurations can be inspected similarly via the Header & Footer section of the dashboard. - Custom templates can be requested through the dashboard. Once the custom design is completed by Avocazo, it will appear in the client’s library ready for use in document generation.
- Each document generation request should be submitted individually. Multiple requests for the same template should be made in separate calls.