Spanish Total.js
English
Documentation For AI agents
Contents

REST API overview

The endpoints your apps call and how to send the token.

.md GitHub
On this page

Your apps talk to OpenTemplates over HTTP. The address of every endpoint starts with your OpenTemplates address, for example https://templates.example.com.

Endpoints

Method and pathWhat it does
POST /Render a template.
GET /profiles/List the profiles and templates.
GET /download/{id}.{ext}Open an uploaded file. Public, no token.

Send the token

Every request to / and /profiles/ needs an API token. Send it in one of two ways:

  • in the x-token header:
curl -H "x-token: YOUR_TOKEN" -H "Content-Type: application/json" -d '{"id":"demo/welcome","data":{"name":"Jane Doe"}}' https://templates.example.com/
  • or as the token query argument:
curl -H "Content-Type: application/json" -d '{"id":"demo/welcome","data":{"name":"Jane Doe"}}' "https://templates.example.com/?token=YOUR_TOKEN"

The header keeps the token out of server logs, so prefer it when your app can set headers.

The primary access token of the interface does not work here: use an API token.

Too many wrong tokens

When one address sends more than five requests with a wrong token, OpenTemplates refuses every request from that address for a while, even with a correct token. The block ends by itself within 15 minutes. Check the token in your app before you try again. See Errors.

Made in Europe