Skip to content

Documents

Drivers must submit and get approved for three document types before they can go online. Documents are stored in S3; only metadata is persisted in the database.


Document lifecycle

Driver uploads document → status: PENDING Admin reviews → status: APPROVED or REJECTED Driver goes ONLINE → all three types must have at least one APPROVED document

Required types: LICENSE · INSURANCE · REGISTRATION


List my documents

GET /api/my-documents 🔒 DRIVER

Returns all documents submitted by the authenticated driver.

Response 200 OK

json [ { "type": "LICENSE", "uploadedAt": "2026-03-15T10:22:00", "status": "APPROVED", "driverId": 7, "fileName": "license.pdf", "fileUrl": "documents/driver-7/uuid-license.pdf", "fileSize": 204800 } ]


Upload a document (S3)

POST /api/my-documents/upload 🔒 DRIVER

Uploads a document file to S3. The document is created with status: PENDING.

Content-Type: multipart/form-data

Form fields

Field Type Description
file binary The document file
type string LICENSE, INSURANCE, or REGISTRATION

File constraints

Constraint Value
Max size 10 MB
Allowed MIME types application/pdf, image/jpeg, image/png

Example (curl)

bash curl -X POST http://localhost:8080/api/my-documents/upload \ -H "Authorization: Bearer <token>" \ -F "file=@license.pdf;type=application/pdf" \ -F "type=LICENSE"

Response 201 Created

json { "type": "LICENSE", "uploadedAt": "2026-04-02T12:00:00", "status": "PENDING", "driverId": 7, "fileName": "license.pdf", "fileUrl": "documents/driver-7/a3f9c2d1-license.pdf", "fileSize": 204800 }

Error responses

Status Condition
400 Bad Request File is empty, exceeds 10 MB, or unsupported MIME type

Add document metadata

POST /api/my-documents 🔒 DRIVER

Adds a document record without file upload (for cases where the URL is already known). Prefer the upload endpoint for new submissions.

Request body

json { "type": "INSURANCE", "fileName": "insurance.pdf", "fileUrl": "https://...", "fileSize": 102400 }

Response 200 OK — list of all driver documents after addition


Delete a document

DELETE /api/my-documents/{documentId} 🔒 DRIVER

Removes a document. Only the owning driver can delete their own documents.

Path parameter: documentId

Response 200 OK — the deleted DocumentDTO

Error responses

Status Condition
404 Not Found Document not found
403 Forbidden Document belongs to a different driver