Create an Image
Creating an image is done by sending a POST request to the following URL:
https://krumzi.com/api/dynamic/imageThe image creation process is synchronous. This means that the image will be created and you will receive a response with the image URL in the response body, without having to wait for a webhook request.
Creating an image usually takes less than 10 seconds.
Request Headers
The following header is required:
X-API-KEY: Your API key
Request Body
The request body should contain the following attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
| template_id | string | Yes | The ID of the dynamic template that you want to use to create the image. |
| modifications | object | Yes | An object containing the modifications to be made to the image. Each key in the object represents the placeholder_key of each element that you defined as a placeholder in your dynamic template. The value of each key is an object with a content key, which is the content that you want to replace the placeholder with. |
Modifications Object Values
| Attribute | Type | Required | Description |
|---|---|---|---|
| content | string | Yes | The content that you want to replace the placeholder with. If the placeholder is an image or video, the content should be the URL that points to the new image or video. |
| hide | boolean | No | If true, the placeholder will be hidden. |
Example Request
SAMPLE REQUEST
const data = {
template_id : "550e8400-e29b-41d4-a716-446655440000",
modifications: {
first_placeholder: {
content: "Example content 1",
hide: false
},
second_placeholder: {
content: "Example content 2",
hide: true
}
}
}
fetch('https://krumzi.com/api/dynamic/image', {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type' : 'application/json',
'API-KEY' : `${API_KEY}`
}
})Response Body
SAMPLE RESPONSE
{
url: "https://assets.krumzi.com/images/1234567890.png"
}Important Notes
- This endpoint is not available for free plan users. You must have a paid plan to use this feature.
- Each image creation consumes 1 automation credit from your account.
- There is a rate limit of 10 requests per 10 seconds for this endpoint.
- Ensure you have sufficient automation credits before making a request.
Error Responses
- 401 Unauthorized: If the API key is missing or invalid
- 402 Payment Required: If you don't have enough automation credits
- 403 Forbidden: If you're on a free plan
- 429 Too Many Requests: If you exceed the rate limit
- 500 Internal Server Error: If there's an issue creating the image