You need a Gavel API key to authenticate every request. See Creating an API key below.
Authentication
All API endpoints authenticate via theX-Api-Key request header. Pass your Gavel API key as the value of this header on every request.
https://yourdomain.gavel.io.
Creating an API key
Create and copy the key
Enter a name for the key (for your reference only), click Create a Key, and immediately copy the value shown.
Endpoints
1. Create a workflow session with pre-filled data
Use this endpoint to create a new session for a workflow and populate it with data from your system. When all variables are provided, the returnedcontinuation_url takes the user directly to the document download page. When some variables are missing, Gavel prompts the user only for the missing answers before generating documents.
The URL-encoded, case-sensitive name of the workflow. For example,
My%20Gavel%20Workflow.Request body
The body contains a singlevariables object. Keys are variable names; values are the data to pre-fill.
Variable type rules
Variable type rules
- Text / Number: Pass a plain string or number.
- Date: Use the format
"2024-05-30T"(ISO 8601 date with a trailingT). - Date Time: Use full ISO 8601 format, e.g.
"2021-05-01T23:02:02.098Z". - Multi Select: Pass an array of strings matching the exact option labels in your question. Strings that do not match an option are ignored.
- Repeating Items: Pass an array of objects, one per row. Each object’s keys are the attribute variable names for that repeating item. Optional repeating items with no rows can be set to
[]. - Nested Repeating Items: Gavel supports one level of nesting. Add the nested repeating item as a key inside each parent repeating item object, using the same array-of-objects format.
hsl_review_answers: Set totrueto skip the final “Please review your answers” page. Gavel recommends using the Skip the final review page workflow setting instead whenever possible.- Invisible Logic variables: You can post data into Invisible Logic variables by referencing them in single curly brackets inside your workflow, e.g.
{clientnumber}.
Example request
The example below shows a workflow named My Gavel Workflow with every supported variable type.Example response
A URL you can redirect the user to. If all variables were supplied, this lands on the document download page. If variables are missing, the user is prompted to fill in only the missing answers.
The unique identifier for the session. Use this to retrieve documents after the session is complete.
2. Retrieve document metadata from a session
After a workflow session is complete, use this endpoint to get metadata — name, format, type, and download URL — for every document associated with the session.The URL-encoded, case-sensitive name of the workflow.
The session ID returned by the Create Workflow Session endpoint.
Example response
An array of document objects for the session.
File format:
docx or pdf.The output file name.
The source template file name, or
uploadedFile[n] for user-uploaded files.Either
outputDocument (a generated document) or fileUpload (a file the user attached during the workflow).The URL to download this document binary. Pass this to the Download Document endpoint.
3. Download a document
Download the binary contents of a generated or uploaded document. In practice, you should use theurl field returned by the Retrieve Document Metadata endpoint rather than constructing this URL manually.
The internal workflow ID (appears in the metadata response URL).
The session ID associated with the document.
An internal number associated with the specific document.
The file name of the document.
The file extension (e.g.
docx, pdf).4. List workflow names
Returns an array of all workflow names available on your account. Use these names to construct paths for the other endpoints.Example response
The names returned include the
.yml extension. Use the full string (e.g. Divorce Workflow.yml) as the pgtypes parameter in the List Workflow Variables endpoint.5. List workflow variables
Returns the variable schema for a specific workflow — including each variable’s name, data type, input type, label, and whether it is required. Use this to understand what data to pass when creating a session.The workflow name as returned by the List Workflow Names endpoint, including the
.yml extension. Example: Divorce Workflow.yml.Example response
This endpoint also powers the Gavel Word add-in. The response may include additional metadata for button and instruction block elements used in the add-in, which you can safely ignore when building integrations.
