Switchboard Canvas supports creating and caching images based on a GET request.
This support dramatically increases the number of uses cases for where dynamic images can be created.
Typically, an API request is an HTTP POST request to an endpoint. With Switchboard Canvas, you POST a JSON object to our image creation endpoint. The response contains another JSON object that tells you if the image was generated successfully and the URL to the generated image.
With a GET request, all the information required to create the image is sent in the query string of the URL.
GET support is available on all plans.
GET requests require a second API key. This API key can be viewed by clicking View API Keys on the main template page. Only the GET API key can be used with GET requests.
Once you have your API key, you need to tell Switchboard Canvas which hosts are allowed to make requests to generate images. This prevents anyone with your API key from creating images on your account and consuming your usage.
For example, if you have a blog or Wordpress site, you would add the IP address of the server to the Allowed Hosts list in the Integrations page:
The format of the GET request is as follows:
https://images.canvas.switchboard.ai?
apiKey=<your-api-key>
&template=<template_name>
&width=1920
&height=1000
...
Following the template name and dimensions, you can target the properties in your template by seperating the element name and the property with a period (.).
For example:
https://images.canvas.switchboard.ai?
apiKey=<your-api-key>
&template=<template_name>
&width=1920
&height=1000
&headline.text=This is the headline
&headline.textColor=FF0000
The image will be returned directly from the request after a few seconds.
After the initial generation, the image will be cached for 7 days. This means the exact same request will return the same image immediately and will not be regenerated.
We care about the protection of your data. Read our Privacy Policy.