Create an Image

Image generation via API occurs in 2 stages (asynchronously):

  1. You send a POST request with data (modifications) to generate an image. After that, a generation task is created with pending status and in response you receive the UID of this task. Images are usually rendered within a few seconds. When completed, the status changes to completed.

  2. You need poll the GET endpoint for status updates. The self property of the response provides this endpoint. When completed the image url is found in the result_url property.

Limit. For each account there is a limit of no more than 1000 api requests per minute and no more than 50 active banner generations.

post
Create an Image

https://api.creativemachine.co/v1/creatives/
Request
Response
Request
Headers
Authentication
required
string
Bearer <ACCESS_TOKEN>
Body Parameters
project
required
string
Project UID
modifications
optional
array
Array with modifications, example: { "key": "20s6nx4x6", "fields": { "image_url": "https://site.com/image" } }, { "key": "04qixvypy", "fields": { "text": "New text", "color": "#fff" } }
webhook_url
optional
string
After rendering is complete, the webhook will send a POST request
format
required
string
jpg or png
Response
200: OK
{
"uid": "PH5JTNhfpHtwA9H5XvL6Ua",
"status": {
"state": "pending",
"error_message": null
},
"self": "https://api.creativemachine.co/v1/creatives/PH5JTNhfpHtwA9H5XvL6Ua",
"result_url": null,
"project": "ct7j8oeqiMvvwAfwjsPmka",
"modifications": [
{
"key": "20s6nx4x6",
"fields": {
"image_url": "https://site.com/image"
}
},
{
"key": "04qixvypy",
"fields": {
"text": "New text",
"color": "#fff"
}
}
],
"created_at": "2020-12-09T19:25:50.687049Z",
"webhook_url": null,
"webhook_response_code": null
}

You need poll the GET endpoint for status updates. The self property of the response provides this endpoint. When completed the image url is found in the result_url property.

get
Check status

https://api.creativemachine.co/v1/creatives/<uid>
Request
Response
Request
Headers
Authentication
required
string
Bearer <ACCESS_TOKEN>
Response
200: OK
{
"uid": "PH5JTNhfpHtwA9H5XvL6Ua",
"status": {
"state": "completed",
"error_message": null
},
"self": "https://api.creativemachine.co/v1/creatives/PH5JTNhfpHtwA9H5XvL6Ua",
"result_url": "https://app.creativemachine.co/media/creatives/PH5JTNhfpHtwA9H5XvL6Ua/PH5JTNhfpHtwA9H5XvL6Ua1.png",
"project": "ct7j8oeqiMvvwAfwjsPmka",
"modifications": [
{
"key": "20s6nx4x6",
"fields": {
"image_url": "https://site.com/image"
}
},
{
"key": "04qixvypy",
"fields": {
"text": "New text",
"color": "#fff"
}
}
],
"created_at": "2020-12-09T19:25:50.687049Z",
"webhook_url": null,
"webhook_response_code": null
}

When completed the image url is found in the result_url property.

Link lifetime (result_url) 24 hours. Available without authorization. Do not use as a hotlink.