Kimlik Doğrulama
Tüm API istekleri Authorization header'ı gerektirir.
cURL
# Her istekte header ekleyin curl -X POST https://mirpdf.com/api/compress -H "Authorization: Bearer YOUR_API_KEY" -F "file=@belge.pdf"
Base URL
URL
https://mirpdf.com/api
PDF Sıkıştırma
PDF dosyasını sıkıştırarak boyutunu küçültün.
POST
/api/compress
PDF dosyasını gönderip asenkron iş oluşturun. İş ID ile durumu takip edin.
| Parametre | Tip | Zorunluluk | Açıklama |
|---|---|---|---|
file | File | zorunlu | PDF dosyası (max 50MB) |
level | string | opsiyonel | low / recommended / high (varsayılan: recommended) |
cURL
curl -X POST https://mirpdf.com/api/compress -H "Authorization: Bearer YOUR_API_KEY" -F "file=@belge.pdf" -F "level=recommended"
Python
import requests with open("belge.pdf", "rb") as f: response = requests.post( "https://mirpdf.com/api/compress", headers={"Authorization": "Bearer YOUR_API_KEY"}, files={"file": f}, data={"level": "recommended"} ) job = response.json() print(job["data"]["jobId"]) # İş ID'si
JavaScript
const formData = new FormData(); formData.append('file', fileInput.files[0]); formData.append('level', 'recommended'); const response = await fetch('https://mirpdf.com/api/compress', { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}` }, body: formData }); const { data } = await response.json(); console.log(data.jobId); // Sonraki adım: iş durumu kontrolü
Yanıt (200 OK)
{
"ok": true,
"data": {
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued"
}
}
İş Durumu Kontrolü
Gönderilen işin durumunu kontrol edin.
GET
/api/jobs/{jobId}/status
cURL
curl https://mirpdf.com/api/jobs/JOB_ID/status -H "Authorization: Bearer YOUR_API_KEY"
Yanıt — done (200 OK)
{
"ok": true,
"data": {
"status": "done",
"download_url": "https://mirpdf.com/api/jobs/.../result",
"expires_at": 1710000000000
}
}
Hata Kodları
| Kod | Anlam | Çözüm |
|---|---|---|
401 | API anahtarı geçersiz | API anahtarınızı kontrol edin |
402 | Kredi yetersiz | Kredi satın alın veya planı yükseltin |
413 | Dosya çok büyük | 50MB altı dosya gönderin |
415 | Desteklenmeyen format | Yalnızca PDF gönderin |
429 | Rate limit aşıldı | Retry-After header'ını bekleyin |
5xx | Sunucu hatası | Exponential backoff ile tekrar deneyin |
Rate Limits
| Plan | İstek/dakika | Dosya boyutu | Aylık limit |
|---|---|---|---|
| Ücretsiz | 5 | 25 MB | 150 kredi |
| Pro | 60 | 50 MB | 5.000 kredi |
| Enterprise | Özel | Özel | Özel |
API Erişimi Alın
Kurumsal plan ile tam API erişimi, yüksek limitler ve öncelikli destek.
API Erişimi İste