Skip to content

List a file's variables

POST
/v1/templates/variables
curl -H "X-Api-Key: $KEY" -F template=@invoice.docx \
http://localhost:9027/v1/templates/variables

Lists the data a template sent as a file reads, as GET /v1/templates/{id}/variables does for a stored one, without storing it. Needs no store.

Media typemultipart/form-data

The form POST /v1/templates/variables takes.

object
template
required

The template: Office, text, HTML or a PDF form.

string format: binary

What the template reads

Media typeapplication/json

What a template sent as a file reads from its data.

object
example
required

Data of the right shape, with empty strings where values go.

object
format
required
string
variables
required

Every path the template reads, parents first, as for a stored template.

Array<object>

One path the template reads.

object
path
required

Dotted, with [] for each item of an array: items[].price. items[] itself says what each item is.

string
type
required

What a template does with a path.

string
Allowed values: value object array

Example

{
"format": "docx",
"variables": [
{
"path": "items[].price",
"type": "value"
}
]
}

The request has no template file

Media typeapplication/json

The JSON body of every error response.

object
error
required

A stable, machine-readable kind.

string
message
required

What went wrong, for a person.

string

Example

{
"error": "invalid_request",
"message": "unknown step 'teleport'"
}

The template has syntax errors

Media typeapplication/json

The JSON body of every error response.

object
error
required

A stable, machine-readable kind.

string
message
required

What went wrong, for a person.

string

Example

{
"error": "invalid_request",
"message": "unknown step 'teleport'"
}