DokJet API Documentation v1

Quick Start

Everything you need to generate production-grade PDFs in minutes.

1
Create an account

Sign up for free — no credit card required. You get 50 Doks every month.

Create a free account
2
Generate an API key

Go to your dashboard → API Keys → Create a key. Copy it immediately — it won't be shown again.

3
Make your first request

Send a POST request with your template ID and data. The API returns a PDF binary stream or a hosted URL.

POST /v1/generate
# Generate an invoice from a template
curl -X POST https://dokjet.ptitlabo.xyz/v1/generate \
  -H "X-API-Key: dk_live_••••••••••••" \
  -H "Content-Type: application/json" \
  -d '{
  "template_id": "invoices/invoice",
  "data": { "client": "Acme Corp", "total": "$564" },
  "return_type": "url"
}'
// No SDK required — standard fetch
const res = await fetch('https://dokjet.ptitlabo.xyz/v1/generate', {
  method: 'POST',
  headers: {
    'X-API-Key':     'dk_live_••••••••••••',
    'Content-Type':  'application/json',
  },
  body: JSON.stringify({
    template_id: 'invoices/invoice',
    data: { client: 'Acme Corp', total: '$564' },
    return_type: 'url',
  }),
});
const { url, credits_left } = await res.json();
// → { url: 'https://dokjet.ptitlabo.xyz/upload/...pdf', credits_left: 49 }
$ch = curl_init('https://dokjet.ptitlabo.xyz/v1/generate');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST           => true,
  CURLOPT_HTTPHEADER     => [
    'X-API-Key: dk_live_••••••••••••',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS     => json_encode([
    'template_id' => 'invoices/invoice',
    'data'        => ['client' => 'Acme Corp', 'total' => '$564'],
    'return_type' => 'url',
  ]),
]);
$data = json_decode(curl_exec($ch), true);
// → ['url' => '...', 'credits_left' => 49]
import requests

response = requests.post(
    'https://dokjet.ptitlabo.xyz/v1/generate',
    headers={
        'X-API-Key':    'dk_live_••••••••••••',
        'Content-Type': 'application/json',
    },
    json={
        'template_id': 'invoices/invoice',
        'data':        {'client': 'Acme Corp', 'total': '$564'},
        'return_type': 'url',
    }
)
data = response.json()
# → {'url': '...', 'credits_left': 49}
4
Read the response

Sync: 200 OK with PDF binary (or JSON URL). Async: 202 Accepted with a task_id to poll.

200 OK · 148ms · 1 Dok
→  200 OK · application/json · 148ms

{
  "url":               "https://dokjet.ptitlabo.xyz/upload/42/invoice_a1b2c3.pdf",
  "credits_left":     49,
  "response_time_ms": 148
}

Authentication

Every request must include your API key in the X-API-Key HTTP header.

X-API-Key header
curl https://dokjet.ptitlabo.xyz/v1/credits \
  -H "X-API-Key: dk_live_••••••••••••"
Keep your API key secret. Revoke it immediately from your dashboard if compromised.

Base URL

https://dokjet.ptitlabo.xyz

Response modes

async_mode HTTP Content-Type Body
false (default) 200 application/pdf PDF binary stream
false + return_type: "url" 200 application/json {url, credits_left, response_time_ms}
true 202 application/json {task_id, status, check_status_url}

What's next?

API Reference →
Full reference for all 8 endpoints with parameters, code examples and response schemas.
Doks & Credits →
Understand how credits work, option costs, and how to check your balance.