Übersicht über die REST-API
OpenAPI 3.1 Spezifikation, Basis-URLs, HTTP-Header und einheitliche JSON-Struktur.
Die SmallPict API basiert auf RESTful-Prinzipien und entspricht der OpenAPI 3.1 Spezifikation. Sie liefert deterministische Antwortzeiten und strukturierte JSON-Antworten.
Basis-URLs
| Umgebung | Basis-URL | Verwendung |
|---|---|---|
| Produktion | https://api.smallpict.app/v1 | Live-Betrieb (beansprucht das monatliche Kontingent). |
| Sandbox | https://api.smallpict.app/v1 | Lokale Entwicklung & CI/CD mit sp_test_... Schlüsseln (kostenlos). |
Zentrale Endpunkte
| Methode | Endpunkt | Beschreibung |
|---|---|---|
POST | /optimize | Bild synchron oder asynchron optimieren und transkodieren. |
GET | /status/{job_id} | Status eines asynchronen Verarbeitungsauftrags abfragen. |
GET | /quota | Tarifdetails, Restkontingent und Verbrauchsdaten abrufen. |
POST | /purge | Veraltete Assets aus dem SmallPict Edge-Cache entfernen. |
Standardisiertes JSON-Antwortformat
Response · 200 OK
{ "success": true, "data": { "job_id": "job_1a2b3c4d5e6f", "status": "completed", "original_size": 2048500, "optimized_size": 256100, "savings_percentage": 87.49, "format": "avif", "url": "https://cdn.smallpict.app/media/hero.avif" }}