Documentation API DokJet
v1
Démarrage rapide
Tout ce dont vous avez besoin pour générer des PDF en production en quelques minutes.
1
Créer un compte
Inscrivez-vous gratuitement — sans carte bancaire. Vous recevez 50 Doks chaque mois.
Créer un compte gratuit2
Générer une clé API
Dashboard → Clés API → Créer une clé. Copiez-la immédiatement — elle ne sera plus affichée.
3
Première requête
Envoyez un POST avec votre template_id et vos données. L'API retourne un PDF binaire ou une URL.
# Générer une facture depuis un 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
Lire la réponse
Sync : 200 OK avec le PDF binaire (ou JSON URL). Async : 202 Accepted avec un task_id à suivre.
→ 200 OK · application/json · 148ms { "url": "https://dokjet.ptitlabo.xyz/upload/42/invoice_a1b2c3.pdf", "credits_left": 49, "response_time_ms": 148 }
Authentification
Chaque requête doit inclure votre clé API dans le header HTTP X-API-Key.
curl https://dokjet.ptitlabo.xyz/v1/credits \ -H "X-API-Key: dk_live_••••••••••••"
Gardez votre clé secrète. Révoquez-la depuis votre dashboard si elle est compromise.
URL de base
https://dokjet.ptitlabo.xyz
Modes de réponse
| 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} |