Collections
Collection allows you to create multiple images from multiple templates within a single request
Use cases
Generally, there are two use cases of collection,
To create images from multiple similar templates in a collection.
Image if you have a similar template but with different dimension. For example, you could have three templates - one for Instagram post, one for Pinterest, and one for open graph.
To create image from randomly selected template in a collection.
If you have multiple templates with similar content but with different design, you might want to generate an image randomly from the collection of templates. This is useful if you want to create Instagram post but you don't want the design to be the same.
How to create template collection
Before you can send a request to collection endpoint, you need to create the collection first.
Go to "Collections" tab and click on "+ New Collection"
2. Add the template that you want to add into the collection and save your changes.
Templates Compatibility
For best compatibility, each template's fields must have similar types. i.e. a field named text_1
must be of type textbox
in all the templates.
Endpoints
Collection endpoint only available in asynchronous mode.
Create images from a template collection
POST
https://api.usestencil.com/v1/collections
Create images from a template collection. This endpoint returns immediately.
To get the images, you can specify a webhook_url
or poll the collection endpoint.
Request Body
Name | Type | Description |
---|---|---|
select | number | Select |
metadata | object | Additional metadata that you want to add. This will be returned when the images are ready. |
webhook_url | string | Webhook URL to call when the image is ready |
modifications | array | Array of modifications. Similar to modifications in Images section. |
collection | string | Collection ID |
Retrieve images from template collection
GET
https://api.usestencil.com/v1/collections/:id
When the images are ready, the status
field is set to completed
.
Path Parameters
Name | Type | Description |
---|---|---|
id | string | The ID returned from previous POST request |
Last updated