Orshot Logo
OrshotDocs

POST: Render from Studio Template

Learn how you can make a POST request to render from a custom template on Orshot

What are Studio Templates?

Templates that you've designed in Orshot Studio are Studio Templates. These templates are custom designs that you can customize and paramterize

You can render content from a custom template that you've designed using Orshot Studio by making POST request to Orshot API

https://api.orshot.com/v1/studio/render

POST Request

await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: "Bearer <ORSHOT_API_KEY>",
  },
  body: JSON.stringify({
    templateId: <TEMPLATE_ID>, 
    modifications: {
      canvasBackgroundColor: "#eff2fa", // Supports CSS Color Values(HEX, RGBA, linear-gradient)
      canvasBackgroundImage: "https://acme.com/public/web-background.png",
      title: "Custom Title",
      imageUrl: "Custom Image URL"
    },
    response : {
      type: "base64",
      format: "png",
      scale: 1,
      includePages: [1, 3] // only for multi-page templates
    },
    pdfOptions : { // applicable only if response.format is "pdf"
      margin: "20px",
      rangeFrom: 1, // show only from page 1(set to "null" to show all pages)
      rangeTo: 2 // to page 2(set to "null" to show all pages)
    },
  }),
});

Single Page Templates

  • Templates with only one page
  • Response can be accessed at the value at data.content, it's in string format
  • (base64 format + binary type) response combination isn't supported

Multi Page Templates

  • Templates with more than one pages
  • Response can be accessed at data.content, it's in array format with content

You can learn more about params:

  • templateId: Each Studio template has a unique templateId(integer) which you can see on Template's page or payground
  • modifications: Object structure of the dynamic modidifcations that you've set in the template
  • response/format
  • response/type

On this page