Browse the docs Open Close
Signed URLs
An image URL you can put in an img tag.
A signed URL renders a template from a plain `<img src>` or an `og:image` tag, with no API call and no bearer token. Your server builds the URL and signs it with a signed URL key from the Developers tab of the account page.
The signing key is a secret. Sign only on a server. Never sign in a browser. The guide at /documentation/guides/signed-urls has code in PHP, JavaScript, Python and Ruby.
/signed-url/image.jpg
Render a signed URL
Renders the published version of a template with the variants in the URL, then redirects to the image. A repeated URL redirects to the cached image.
To sign a URL: 1. Take every query parameter except `signature`. 2. Sort the parameters by key in byte order. 3. Join them as `key=value` with `&`. Use the raw values, not the URL-encoded values. 4. Compute the HMAC-SHA256 of that string with your signing key. Use the lowercase hex digest. 5. Add the digest as `signature`. URL-encode every value in the final URL.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
template_id |
query | string | Yes | UUID of the template. The signing key must belong to the user who owns the template. |
variants |
query | string | No | The JSON array of Variant objects, encoded as standard base64 (RFC 4648 section 4, with `+`, `/` and `=` padding). Do not use base64url: the server decodes with PHP base64_decode. Sign the base64 value, then URL-encode it in the URL. |
format |
query | string | No | Image format. Defaults to png. Any other value renders png. The value is part of the signature. |
transparent |
query | string | No | Set to 1 or true to render on a transparent background. Valid for png and webp. With format=jpeg it returns 400. The value is part of the signature. |
signature |
query | string | Yes | Lowercase hex HMAC-SHA256 of the canonical string. See the description for the algorithm. |
This route is on the site root, not under /api. The full URL is `https://app.snapsbrew.com/signed-url/image.jpg`.
The signed string holds every query parameter except `signature`, including a parameter that the server does not read. Do not send `identifier` or `api_log_uuid`, because the server reserves both names.
A signed URL render counts in the usage log of the template owner.
Example request
curl
curl -L 'https://app.snapsbrew.com/signed-url/image.jpg?template_id=<uuid>&variants=<url-encoded-base64>&signature=<hex>' \
--output image.png
Example responses
{}
{}
{}