100% local processing - your files and data never leave your browser.
No accounts, no tracking - we don't save your credentials, files, or usage.
Free forever - donations are welcomed, but every tool is and always will be free.
Open in spirit - need a special tools..? Drop a message.
API v1 · Stable

API Documentation

The TPL Tools API gives you programmatic access to the same conversion and utility tools available on the website. It's free for hobby projects, side projects, and reasonable production use.

Need a key first? Sign up - takes 30 seconds, no credit card. You'll get 1,000 requests per day instantly.

Authentication

Every request needs an API key. You'll get one when you sign up - the key starts with tpl_. Send it with each request using one of these methods:

MethodExample
Header (recommended)X-API-Key: tpl_yourkeyhere
Bearer tokenAuthorization: Bearer tpl_yourkeyhere
Query string?api_key=tpl_yourkeyhere (use the header instead in production)
Treat your API key like a password. Don't commit it to git, don't put it in client-side JavaScript, don't share it publicly. If your key leaks, regenerate it from your dashboard.

Rate Limits

Every API key is capped at 1,000 requests per day by default. The counter resets at midnight UTC. Need more? Hit the contact form from your dashboard - if your use case is real, I'll bump your limit. Free.

Every API response includes these headers so you don't have to guess:

HeaderWhat it means
X-RateLimit-LimitYour daily request cap (1000 by default)
X-RateLimit-RemainingHow many requests you can still make today
X-RateLimit-ResetSeconds until the counter resets at midnight UTC

When you hit the cap, the API returns HTTP 429 Too Many Requests with a JSON body explaining what happened and a link to request a higher limit.

Error Format

Errors always come back as JSON with the same shape. The HTTP status code tells you the category, and the error + message fields tell you exactly what to fix.

{
  "ok": false,
  "error": "missing_input",
  "message": "Provide either \"svg\" or \"url\".",
  "fields": {
    "svg": "string (svg markup)",
    "url": "string (URL)"
  }
}
StatusWhat it means
200Success, response data is in the body
400Bad request - check your input fields
401Missing or invalid API key
403Your key was disabled (contact me if you think it's wrong)
404Endpoint doesn't exist
405Wrong HTTP method (most endpoints want POST)
413Input too large (each endpoint has its own limit)
429Rate limit hit - wait until reset or request more
500Something broke on my end - please report it

Code Examples

The same request, in 6 languages. All examples use the svg-to-tpl endpoint as a reference - the pattern is identical for every other endpoint.

curl -X POST https://svgtotpl.com/api/v1/svg-to-tpl \
  -H "X-API-Key: tpl_yourkeyhere" \
  -H "Content-Type: application/json" \
  -d '{"svg":"<svg width=\"100\"><rect/></svg>","class":"logo"}'
<?php
$ch = curl_init('https://svgtotpl.com/api/v1/svg-to-tpl');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'X-API-Key: tpl_yourkeyhere',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'svg'   => '<svg width="100"><rect/></svg>',
        'class' => 'logo',
    ]),
]);
$response = curl_exec($ch);
$result   = json_decode($response, true);
echo $result['tpl'];
// Browser fetch (note: don't expose your key in frontend code in production)
const response = await fetch('https://svgtotpl.com/api/v1/svg-to-tpl', {
  method: 'POST',
  headers: {
    'X-API-Key': 'tpl_yourkeyhere',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    svg: '<svg width="100"><rect/></svg>',
    class: 'logo'
  })
});
const data = await response.json();
console.log(data.tpl);
import requests

response = requests.post(
    'https://svgtotpl.com/api/v1/svg-to-tpl',
    headers={'X-API-Key': 'tpl_yourkeyhere'},
    json={
        'svg':   '<svg width="100"><rect/></svg>',
        'class': 'logo'
    }
)
data = response.json()
print(data['tpl'])
// Node.js (built-in fetch in Node 18+, or use 'node-fetch' for older)
const response = await fetch('https://svgtotpl.com/api/v1/svg-to-tpl', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.TPL_API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    svg:   '<svg width="100"><rect/></svg>',
    class: 'logo'
  })
});
const data = await response.json();
console.log(data.tpl);
require 'net/http'
require 'json'

uri = URI('https://svgtotpl.com/api/v1/svg-to-tpl')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key']     = 'tpl_yourkeyhere'
request['Content-Type']  = 'application/json'
request.body = {
  svg:   '<svg width="100"><rect/></svg>',
  class: 'logo'
}.to_json

response = http.request(request)
data = JSON.parse(response.body)
puts data['tpl']

Endpoints

The endpoints listed below are currently live. New endpoints are added as new tools come online - bookmark this page and check back, or watch the announcements section.

Currently live: 1 endpoint

POST https://svgtotpl.com/api/v1/svg-to-tpl

Converts an SVG (or PNG) into an OpenCart-style .tpl image declaration.

Request Body

{
//     "svg":          "<svg>...</svg>",     // required (or "url")
//     "url":          "https://...",        // alternative to "svg"
//     "alt":          "logo",               // optional, alt text
//     "class":        "site-logo",          // optional, CSS class
//     "strip_styles": true                  // optional, remove inline styles
//   }

Response

{ "ok": true, "tpl": "...", "format": "svg" }

Need More?

Hit a wall? Drop me a message. If you need a higher daily limit, a new endpoint, or you found a bug - I read every message.

— Chenzo David

Accent colour
Custom