Skip to content

Upload a template

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

Stores a template and returns its id. Syntax is checked now, without data, so a broken template is refused here rather than at its first render. The content never changes: to change a template, store the new one and use its id.

Media typemultipart/form-data

The multipart form POST /v1/templates accepts.

object
name

A name for it, in place of the file’s. The extension stays the file’s.

string | null
template
required

The template: DOCX, XLSX, PPTX, ODT, ODS, ODP, PDF or a text format.

string format: binary

Stored

Media typeapplication/json

A stored template.

object
createdAt
required

RFC 3339.

string
format
required
string
id
required

Pass as templateId to /v1/render, /v1/render/batch or /v1/templates/validate, or point an alias at it with PUT /v1/aliases/{name}.

string
name
required
string
sha256
required

Hex SHA-256 of the content.

string
size
required
integer format: int64

Example

{
"format": "docx",
"id": "01966f3e-7c1a-7d3c-9a44-1d2f5a6b7c8d",
"name": "invoice.docx"
}

Not a template format

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'"
}

This caller’s quota is used up

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'"
}

Too large

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'"
}

RUSTICDOC_STORE is not set

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 store cannot be reached

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'"
}