SolutionsImage Generation API

Dynamically generate images with our API or use it to integrate with your app or any no-code tools.

One request to rule them all

RESTful API

Send JSON payload of text, image url, rating, and chart modifications to generate your image. Both JPEG and PNG are supported.

Synchronous

Receive response within the same request.

Asynchronous

Send and forget. Call specified webhook when image is ready.

Examples

Images

Send template modifications to generate image variations.


const data = {
  "template": `${TEMPLATE_ID}`,
  "modifications": [
    {
      "name": "image",
      "src": "https://cdn.usestencil.com/uploads/34aacb1e-a7e4-4b4d-bb64-2bffc3c930a4/919d44a2-233b-4cb6-bab3-5ab8e5c02c9b/photo-1.jpeg?ts=1629871710"
    },
    {
      "name": "location",
      "text": "San Francisco, USA"
    }
  ]
}

fetch('https://api.usestencil.com/v1/images', {
  method: 'POST',
  body: JSON.stringify(data),
  headers: {
    'Content-Type' : 'application/json',
    'Authorization' : `Bearer ${API_KEY}`
  }
})
                  
Try the demo

Examples

Collections

Create multiple images in a single request.


const data = {
  "collection": `${COLLECTION_ID}`,
  "modifications": [
    {
      "name": "image",
      "src": "https://cdn.usestencil.com/uploads/34aacb1e-a7e4-4b4d-bb64-2bffc3c930a4/919d44a2-233b-4cb6-bab3-5ab8e5c02c9b/photo-1.jpeg?ts=1629871710"
    },
    {
      "name": "location",
      "text": "Taipei, Taiwan"
    }
  ]
}

fetch('https://api.usestencil.com/v1/collections', {
  method: 'POST',
  body: JSON.stringify(data),
  headers: {
    'Content-Type' : 'application/json',
    'Authorization' : `Bearer ${API_KEY}`
  }
})
                  
Try the demo

Examples

Collections

Create N number of images randomly from a collection.


const data = {
  "collection": `${COLLECTION_ID}`,
  "select": 2,
  "modifications": [
    {
      "name": "image",
      "src": "https://cdn.usestencil.com/uploads/34aacb1e-a7e4-4b4d-bb64-2bffc3c930a4/919d44a2-233b-4cb6-bab3-5ab8e5c02c9b/photo-1.jpeg?ts=1629871710"
    },
    {
      "name": "location",
      "text": "San Francisco, USA"
    }
  ]
}

fetch('https://api.usestencil.com/v1/collections', {
  method: 'POST',
  body: JSON.stringify(data),
  headers: {
    'Content-Type' : 'application/json',
    'Authorization' : `Bearer ${API_KEY}`
  }
})
                  
Try the demo