POST: Render from Template
Learn how you can make a POST request to render from a template
What are Regular/Library Templates?
These are templates in Orshot which are pre-designed and meant to be used as utilities. Some examples are Website Screenshot, Tweet Image, Dynamic Image Resizer
You can render content from a template by making POST request to Orshot API
https://api.orshot.com/v1/generate/${renderType}Available renderType options
images: To be used for all templates that generate imagespdfs: To be used for all templates that generate pdfs
You can refer to renderType value on template pages on Orshot e.g
POST Request
await fetch("https://api.orshot.com/v1/generate/images", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <ORSHOT_API_KEY>",
},
body: JSON.stringify({
templateId: "website-screenshot",
response: {
format: "png",
type: "base64",
},
modifications: { // different for each template
websiteUrl: "https://pinterest.com",
fullCapture: false,
delay: 500,
width: 1200,
height: 1000,
},
}),
});{
"data": {
"content": "data:image/png;base64,iVBORw0.....",
"format": "png",
"type": "base64",
"responseTime": 10325.22
}
}You can learn more about params:
SDKs
If you prefer, you can use our SDKs which give you abstracted functions to quickly render from templates