Image generation via API occurs in 2 stages (asynchronously):
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
.
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.
{"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.
{"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.