Skip to main content
Send your patient’s discharge paperwork to POST /upload and AfterCare immediately queues it for processing. The endpoint accepts a single PDF, JPEG, or PNG file up to 15 MB and returns a documentId you use to track progress and retrieve the finished recovery plan.

Request

file
required
The discharge document to process. Must be a PDF, JPEG, or PNG file no larger than 15 MB. Send this field as multipart/form-data.
If you upload a document that AfterCare has already seen, it will not reprocess it. Instead, the server returns 200 OK with the existing documentId and its current status. Use the returned processUrl to check status — if processing already finished, the SSE stream will replay the full event history and close immediately.

Response — 202 Accepted

A fresh upload returns 202 Accepted with the following fields.
string (UUID)
The unique identifier for this document. Store it — you need it to stream progress, retrieve medications, and list appointments.
string
Always "processing" on a 202 response. Connect to processUrl to receive stage-by-stage progress.
string
The relative path of the SSE stream for this document, e.g. /process/550e8400-e29b-41d4-a716-446655440000. Connect to this URL immediately after uploading to receive real-time pipeline progress.
string
The relative path where you can retrieve the original uploaded file, e.g. /documents/550e8400-e29b-41d4-a716-446655440000/original. Useful for displaying or cross-referencing source text alongside extracted data.
boolean
When true, AfterCare is operating in safe-development mode and no real AI calls were made. The returned plan is a static fixture. In production this is always false.
boolean
false on a 202 response — this is a newly accepted document. When the same document has been uploaded before, the server returns 200 OK with deduplicated: true and the existing documentId instead of queuing a new pipeline run.
Connect to the SSE stream at processUrl immediately after receiving the 202 response. The server buffers all past events, so reconnecting later still replays the full history — but listening from the start lets you show your user live progress as each pipeline stage completes.

Code examples

Sample 202 response

Error responses