Getting started overview
Glitterly offers an API for generating images and videos programmatically from templates. This guide details the steps to initiate your integration, from setting up an account and retrieving API credentials to executing your first API call. The process involves creating a Glitterly account, generating an API key, designing a template within the Glitterly dashboard, and then using the API to populate that template with dynamic data to produce a new image.
The developer experience with Glitterly emphasizes rapid deployment, providing essential endpoints and parameters for core functionality. Once set up, developers can automate the creation of marketing visuals, social media content, or e-commerce graphics at scale. The free Starter plan allows for testing and development, though generated images will include a watermark.
Here's a quick reference for the initial setup:
| Step | What to Do | Where |
|---|---|---|
| 1. Create Account | Register for a Glitterly account. | Glitterly homepage |
| 2. Get API Key | Locate and copy your API key from your dashboard. | Glitterly Dashboard > Settings > API Keys |
| 3. Design Template | Create an image template with dynamic fields. | Glitterly Dashboard > Templates |
| 4. Make First Request | Send a POST request to the Glitterly API to generate an image. | Your preferred HTTP client or programming language |
Create an account and get keys
To begin using the Glitterly API, you must first create an account on the Glitterly platform. Glitterly provides a free Starter plan that permits full access to the API for testing purposes, albeit with watermarked output images. This allows developers to build and test integrations without immediate financial commitment.
Account Registration
- Navigate to the Glitterly homepage.
- Click on the "Sign Up" or "Get Started Free" button.
- Follow the on-screen prompts to register using your email address or a supported single sign-on (SSO) provider like Google.
- Verify your email address if required.
API Key Retrieval
After successfully creating and logging into your Glitterly account, you will need to retrieve your API key. This key authenticates your requests to the Glitterly API.
- From your Glitterly Dashboard, locate the "Settings" or "Account" section.
- Within Settings, find the "API Keys" or "Developer" tab.
- Your API key will be displayed there. Copy this key securely, as it grants access to your Glitterly account's API functionalities. Glitterly typically provides a single primary API key per account, which should be treated as sensitive credentials.
It is crucial to protect your API key. Avoid hardcoding it directly into client-side applications. For server-side integrations, store the key as an environment variable or in a secure configuration management system to prevent unauthorized access. The security principles for API keys are similar to those for any sensitive credential, as outlined by general security best practices for web APIs, such as those recommended by Google's OAuth 2.0 best practices for securing credentials.
Your first request
Before making your first API request, you need to create a template within the Glitterly dashboard. This template serves as the base design for your images, with defined dynamic fields that the API will populate.
Create a Template
- Log into your Glitterly dashboard.
- Navigate to the "Templates" section.
- Click "New Template" and select a blank canvas or a pre-designed template.
- Design your template by adding text layers, image placeholders, and other elements.
- For dynamic content, identify text layers or image placeholders that you want to update via the API. Ensure these layers have unique, descriptive names (e.g.,
product_name,price_text,product_image_url). These names will be used as keys in your API request payload. - Save your template. Note the Template ID, which is usually found in the URL when editing the template or listed in the templates overview.
Making the API Call
The primary API endpoint for Glitterly image generation involves sending a POST request to a specific URL, including your API key in the authorization header and a JSON payload defining the template and dynamic data.
Endpoint: https://api.glitterly.app/v1/images
Method: POST
Headers:
Content-Type: application/jsonAuthorization: Bearer YOUR_API_KEY(ReplaceYOUR_API_KEYwith your actual key)
Request Body (JSON):
{
"templateId": "YOUR_TEMPLATE_ID",
"modifications": [
{
"name": "text_layer_name",
"text": "New Product Title"
},
{
"name": "price_text",
"text": "$99.99"
},
{
"name": "product_image_url",
"image": {
"url": "https://example.com/product-image.jpg"
}
}
],
"output": {
"format": "png",
"quality": 75
}
}
Replace YOUR_TEMPLATE_ID with the actual ID of your Glitterly template. Adjust the modifications array to match the names of the dynamic layers you defined in your template and the data you wish to inject. The output object allows specifying the image format and quality.
Example using curl:
curl -X POST \
https://api.glitterly.app/v1/images \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"templateId": "tmpl_xxxxxxxxxxxxxxxx",
"modifications": [
{ "name": "product_name", "text": "Luxury Smartwatch" },
{ "name": "price_label", "text": "Only $249!" }
],
"output": {
"format": "jpeg",
"quality": 85
}
}'
Upon a successful request, the API will return a JSON response containing a URL to the newly generated image. This URL is temporary and typically expires after a short period, so you should download and store the image on your own infrastructure if permanent storage is needed.
Successful Response Example:
{
"status": "success",
"data":
{
"imageUrl": "https://cdn.glitterly.app/generated/xxxxxxxx.png",
"id": "img_xxxxxxxxxxxxxxxx"
}
}
Common next steps
After successfully generating your first image with Glitterly, consider these common next steps to further integrate and optimize your workflow:
- Dynamic Image Integration: Integrate the Glitterly API into your application backend to automatically generate personalized marketing assets, social media posts, or e-commerce product variations based on user data or product catalogs.
- Advanced Template Design: Explore more advanced features of the Glitterly template editor, such as conditional elements, text styling, and grouping, to create more sophisticated and flexible templates.
- Error Handling and Logging: Implement robust error handling in your application to gracefully manage API errors, rate limits, or invalid requests. Log API responses for debugging and monitoring purposes.
- Webhook Integration: Investigate if Glitterly provides webhooks for asynchronous processing. For long-running image generation tasks, webhooks can notify your application when an image is ready, preventing the need for polling. General information on webhook implementation strategies can be helpful here.
- Image Storage and Delivery: Once you receive the
imageUrlfrom Glitterly, download and store the image on your own cloud storage (e.g., AWS S3, Google Cloud Storage, Cloudflare R2) or content delivery network (CDN) for long-term availability and optimal delivery performance. - Monitoring and Analytics: Set up monitoring for your API usage and the performance of your image generation processes. This can help identify bottlenecks or areas for optimization.
- Explore Pricing Plans: If you're moving beyond the free tier, review Glitterly's pricing plans to understand the costs associated with higher image volumes, advanced features, and removing watermarks.
Troubleshooting the first call
Issues with your initial Glitterly API call often stem from common configuration or network problems. Here are common troubleshooting steps:
- Check API Key: Ensure your API key is correctly copied and included in the
Authorization: Bearer YOUR_API_KEYheader. An incorrect or missing key will result in a401 Unauthorizederror. - Verify Template ID: Double-check that the
templateIdin your request body exactly matches the ID of your template in the Glitterly dashboard. A mismatch will typically lead to a404 Not Foundor400 Bad Requesterror. - Match Modification Names: Confirm that the
namefields within yourmodificationsarray correspond precisely to the dynamic layer names in your Glitterly template. Case sensitivity matters. Incorrect names will result in the dynamic content not appearing on the generated image or an API error. - JSON Payload Structure: Validate your JSON request body. Even minor syntax errors (missing commas, unclosed brackets, incorrect data types) can cause a
400 Bad Requesterror. Use a JSON linter or validator if unsure. - Content-Type Header: Ensure the
Content-Type: application/jsonheader is present and correctly spelled. - Network Connectivity: Confirm that your environment has outbound internet access and can reach
https://api.glitterly.app. Proxy settings or firewall rules can sometimes block API requests. - Rate Limits: While less common for a first request, be aware of API rate limits. If you're sending many requests in a short period during testing, you might encounter a
429 Too Many Requestserror. Refer to Glitterly's documentation for specific rate limit details. - Glitterly Dashboard Status: Check the Glitterly dashboard or their social media for any service outages or announcements if you suspect a broader issue.
- Review Glitterly Documentation: For detailed error codes and parameter explanations, consult the official Glitterly API documentation linked from their homepage.