Dynamic Image Placeholders
When working with dynamic image templates, you can retrieve information about the placeholders available in a specific template. This is useful for understanding what fields you can modify when creating an image.
Get Template Placeholders
Retrieve a list of all placeholders available in a specific dynamic image template.
Endpoint: GET /api/dynamic/image/fields
Headers:
X-API-KEY: Your API key (required)
Query Parameters:
templateId: The ID of the dynamic image template (required)
Response:
The response will be an array of objects, each representing a placeholder in the template:
[
{
"key": "title",
"label": "title",
"type": "string",
"placeholder": "Enter text..."
},
{
"key": "background_image",
"label": "background_image",
"type": "file",
"placeholder": "Enter URL..."
}
]Response Fields:
key: The unique identifier for the placeholder (same asplaceholder_keyin the template)label: A human-readable label for the placeholder (currently same askey)type: The type of content expected for this placeholder. Can be either:"string"for text content"file"for image or video content (expects a URL)
placeholder: A hint text for what kind of content to enter
Error Responses:
- 400 Bad Request: If the
templateIdquery parameter is missing - 401 Unauthorized: If the API key is missing or invalid
Example Usage:
curl -X GET 'https://krumzi.com/api/dynamic/image/fields?templateId=your_template_id' \
-H 'X-API-KEY: your_api_key_here'This endpoint allows you to retrieve information about the placeholders available in a specific dynamic image template. You can use this information to understand what modifications you can make when creating an image using this template.
Using Placeholders
When creating a dynamic image, you'll use the placeholder key values in your modifications object. For example:
const modifications = {
title: {
content: "My Dynamic Image Title"
},
background_image: {
content: "https://example.com/my-background-image.jpg"
}
};This modifications object specifies the content for the title and background_image placeholders in the dynamic image template.
By using the placeholder keys in the modifications object, you can dynamically populate the image with the desired content.
Refer to the Create an Image documentation for more details on how to use these placeholders when creating a dynamic image.