Snapshark API

Generate dynamic images from your templates using simple HTTP requests. Each template has a unique ID that you use to generate images with custom text and images.

Base URL

https://snapshark.io/api/v1
PNG, JPG
Output formats
CDN
Fast global delivery
⚠️
Image Retention
Generated images are automatically deleted after 30 days. Make sure to download or cache images you need to keep.

How It Works

Every template you create in the editor gets a unique UUID. Use this ID to generate images via the API with your custom data.

1
Create a Template
Design your template in the editor with text and image layers.
2
Get Template ID
Copy the UUID from the Generate page or template settings.
3
Call the API
Make a GET or POST request with your variable values.
Example Template ID (UUID)
a1b2c3d4-e5f6-7890-abcd-ef1234567890

Error Handling

All API responses follow a consistent format. Errors include a descriptive message.

Status CodeDescription
200Success
400Bad Request - Invalid parameters
404Not Found - Template doesn't exist
500Server Error
Response404 Error
{
  "status": false,
  "type": "error",
  "title": "Not Found",
  "message": "Template not found",
  "http_code": 404
}
GET

Simple URL

Generate images using a simple GET request. Pass template variables as query parameters. Perfect for embedding directly in HTML or sharing links.

GET https://snapshark.io/api/v1/images/:templateId

Query Parameters

ParameterTypeRequiredDescription
:templateIdUUIDrequiredYour template ID (in URL path)
titlestringoptionalAny text variable name from your template
image.srcURLoptionalAny image variable with .src suffix
outputstringoptional"json" (default) or "image" for binary

Examples

Get JSON response with image URL:
https://snapshark.io/api/v1/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890?title=Hello&subtitle=World
Get image binary directly (for img src):
https://snapshark.io/api/v1/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890?title=Hello&output=image

HTML Embed

<!-- Embed generated image directly in HTML -->
<img src="https://snapshark.io/api/v1/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890?title=My%20Title&output=image" alt="Generated" />

<!-- Dynamic OG Image for social sharing -->
<meta property="og:image" content="https://snapshark.io/api/v1/images/a1b2c3d4-e5f6-7890-abcd-ef1234567890?title=Article%20Title&output=image" />

JSON Response

Response200 OK
{
  "status": true,
  "type": "success",
  "title": "OK",
  "message": "Image generated successfully",
  "http_code": 200,
  "href": ".../generated/2024/01/abc123.png",
  "data": {
    "id": "abc123-uuid",
    "image_url": ".../generated/2024/01/abc123.png",
    "width": 1200,
    "height": 630,
    "format": "png",
    "file_size": 125000,
    "render_time_ms": 450,
    "created_at": "2024-01-15T10:30:00.000Z"
  }
}
POST

API Request

Generate images with a POST request. Ideal for server-side integration and complex variable data.

POST https://snapshark.io/api/v1/images

Request Body

ParameterTypeRequiredDescription
templateUUIDrequiredYour template ID
dataarrayrequiredArray of variable modifications
outputstringoptional"json" (default) or "image" for binary

Data Array Format

Each item in the data array specifies a variable to modify:

{
  "template": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": [
    { "name": "title", "text": "Hello World" },
    { "name": "subtitle", "text": "Welcome to Snapshark" },
    { "name": "avatar", "src": "https://example.com/photo.jpg" },
    { "name": "background", "color": "#FF5733" }
  ],
  "output": "json"
}

cURL Example

cURLbash
curl -X POST 'https://snapshark.io/api/v1/images' \
  -H 'Content-Type: application/json' \
  -d '{
    "template": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "data": [
      { "name": "title", "text": "Hello World" },
      { "name": "subtitle", "text": "Generated via API" }
    ],
    "output": "json"
  }'

Node.js Example

Node.jsjavascript
const response = await fetch('https://snapshark.io/api/v1/images', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    template: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
    data: [
      { name: 'title', text: 'Hello World' },
      { name: 'avatar', src: 'https://example.com/photo.jpg' }
    ],
    output: 'json'
  })
});

const result = await response.json();
console.log(result.href); // Image URL

Download Image Directly

cURL - Save to filebash
curl -X POST 'https://snapshark.io/api/v1/images' \
  -H 'Content-Type: application/json' \
  -d '{
    "template": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "data": [{ "name": "title", "text": "Hello" }],
    "output": "image"
  }' \
  --output generated-image.png

Template Variables

Variables are based on layer names in your template. Each editable layer becomes an API variable.

Variable Types

Text Variables

For text layers. Use text property in POST, or pass value directly in GET query.

GET
?title=Hello%20World
POST
{ "name": "title", "text": "Hello World" }
Image Variables

For image layers. Provide an image URL to replace the placeholder.

GET
?avatar.src=https://example.com/photo.jpg
POST
{ "name": "avatar", "src": "https://..." }
Color Variables

For shape fill colors. Provide a hex color code.

GET
?background.fill=%23FF5733
POST
{ "name": "background", "color": "#FF5733" }
💡
Finding Variable Names
Go to your template's Generate page to see all available variables and their names. The page shows live API URLs as you edit values.

Output Options

Control the API response format using the output parameter.

ValueResponseUse Case
jsonJSON with image URL and metadataAPI integrations, store URL
imageBinary image data (PNG/JPG)Direct embed, download

Output Formats

Images are generated in PNG format by default. JPG is also supported for templates configured with JPG export.

Need help? Contact us at support@snapshark.io

View Pricing →