Mattermix Docs
  • Welcome to Mattermix
  • API
    • Create API key
    • Authentication
    • Create image
    • Delete image
    • Template syntax
    • Set API limit
  • Integrations
    • Zapier
  • Subscription
    • Manage subscription
Powered by GitBook
On this page
  1. API

Template syntax

PreviousDelete imageNextSet API limit

Last updated 3 years ago

The Mattermix API uses the templating syntax to dynamically update values in HTML or CSS. For example, you could have the following in your HTML: <p>{{title}}</p>. The title value could be updated with the API by passing a title value in the content object of the request body.

Below is an example using the Fetch API from JavaScript:

const body = {
  html: "<html><body><p>{{title}}</p></body></html>",
  content: {
    title: "Hello World!"
  }
}

const res = await fetch("mattermix.com/api/v1/image", {
  method: "POST",
  headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${process.env.MATTERMIX_API_KEY}`
    },
  body: JSON.stringify(body)
});
Handlebars