Skip to main content

/v1/image/create

This API is used to generate images with your own content.

Endpoint

https://api.copicake.com/v1/image/create

Method

POST

Authentication

Put this in your header:

Authorization: Bearer [YOUR_API_KEY]

Request Data

FieldSample ValuesExplanations
template_idjfwrFJdR3z1eF8BcEhSnAFyhxgOqYour template id
changes[ { }, { }, ... ]Array of your changes, for now, we support Text Change and Image Change.
- [Image] nameimage-yeavh7The name of your image element
- [Image] srchttps://your_website.com/test.pngImage Url
- [Text] nametext-9so09mThe name of your text element
- [Text] texthello worldAny text you want to replace
- [Text] fill#ff0000Color in the hex format
options{ ... }Option
- webhook_urlhttps://your_website.com/webhook_urlWhen the rendering is finished, you will be notified through this url

Options

webhook_url

If you webhook_url is https://your_website.com/webhook_url, you will receive a GET request to it like this:

https://your_website.com/webhook_url?rendering_id=[RENDERING_ID]&permanent_url=[IMAGE_URL]

FieldSample ValuesExplanations
rendering_idxc17NtfyMaxPDCtz0ZjEZ4guBmiCYour rendering id
permanent_urlhttps%3A%2F%2Fcopicake.s3.ap-northeast-1.amazonaws.com%2Frenderings%2Fxc17NtfyMaxPDCtz0ZjEZ4guBmiC.pngencoded url to your rendered image

Response

You will get a rendering response with processing state. For details, please check here

Sample Codes

const data = {
template_id: "jfwrFJdR3z1eF8BcEhSnAFyhxgOq", // your template id
changes: [
// your changes
{ name: "text-9so09m", text: "hello world", fill: "#ff0000" },
{ name: "image-yeavh7", src: "https://your_website.com/test.png" },
],
options: {
// your options
webhook_url: "https://your_website.com/webhook_url",
},
};
fetch("https://api.copicake.com/v1/image/create", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer [YOUR_API_KEY]",
},
body: JSON.stringify(data),
})
.then((res) => {
return res.json();
})
.then((response) => {
console.log(response);
});