Schnellstart
Hier der komplette Roundtrip mit curl. Du brauchst einen API-Key
und ein PDF. Exportiere den Key zuerst:
export ACCESSFUL_API_KEY="ak_dein_key_hier"export BASE="https://api.accessful.de/api/v1/upload-service"-
PDF hochladen. Sende es als Multipart-Feld
files:Terminal-Fenster curl -X POST "$BASE/pdf/upload" \-H "X-API-Key: $ACCESSFUL_API_KEY" \-F "files=@dokument.pdf"Die Antwort listet eine
caseIdpro akzeptierter Datei:{"successfulUploads": ["7c2f1e4a-9b0d-4a1e-8f3c-2d6b5a9e1c40"],"duplicateFiles": [],"message": "Upload completed successfully. Uploaded 1 files. 0 duplicates found.","callbackUrl": null} -
Job-Status pollen mit dieser
caseId, bis ercompletedist:Terminal-Fenster curl "$BASE/job-status/7c2f1e4a-9b0d-4a1e-8f3c-2d6b5a9e1c40" \-H "X-API-Key: $ACCESSFUL_API_KEY"{ "jobStatus": "completed", "stage": "finished", "score": 87 }scoreist die Barrierefreiheits-Qualität des Ergebnisses (0–100). Siehe allejobStatus-Werte. -
Herunterladen des konvertierten PDF/UA:
Terminal-Fenster curl -L "$BASE/download/7c2f1e4a-9b0d-4a1e-8f3c-2d6b5a9e1c40" \-H "X-API-Key: $ACCESSFUL_API_KEY" \-o dokument-pdfua.pdf -
Case löschen, wenn du ihn nicht mehr brauchst (optional, aber empfohlen — dies ist eine endgültige Löschung):
Terminal-Fenster curl -X DELETE "$BASE/delete/7c2f1e4a-9b0d-4a1e-8f3c-2d6b5a9e1c40" \-H "X-API-Key: $ACCESSFUL_API_KEY"
Vollständiges Beispiel
Abschnitt betitelt „Vollständiges Beispiel“const BASE = 'https://api.accessful.de/api/v1/upload-service';const headers = { 'X-API-Key': process.env.ACCESSFUL_API_KEY };
// 1. Uploadconst form = new FormData();form.append('files', new Blob([await readFile('dokument.pdf')], { type: 'application/pdf' }), 'dokument.pdf');const up = await fetch(`${BASE}/pdf/upload`, { method: 'POST', headers, body: form });const { successfulUploads: [caseId] } = await up.json();
// 2. Pollen bis Endzustandconst terminal = new Set(['completed', 'failed', 'analyzer_failed', 'canceled', 'quota_exceeded']);let status;do { await new Promise((r) => setTimeout(r, 2000)); status = await (await fetch(`${BASE}/job-status/${caseId}`, { headers })).json();} while (!terminal.has(status.jobStatus));
if (status.jobStatus !== 'completed') throw new Error(`Job ${status.jobStatus}`);
// 3. Downloadconst pdf = await (await fetch(`${BASE}/download/${caseId}`, { headers })).arrayBuffer();await writeFile('dokument-pdfua.pdf', Buffer.from(pdf));console.log(`Fertig — Score ${status.score}`);Lieber klicken statt tippen? Führe denselben Ablauf im Browser auf der Seite Live testen aus.