Download Testimony
Returns a short-lived download link for the final testimony PDF.
HTTP Request
GET /api/v1/testimonies/{testimonyId}/download
Response
200 OK
{
"data": {
"url": "https://storage.example.com/testimonies/01J5X3Y8ZK2Q4R6T8V0W2X4Y6Z/a1B2c3D4e5F6.pdf?X-Amz-Expires=300&X-Amz-Signature=..."
}
}url is a presigned object-storage URL valid for 5 minutes — treat it as opaque and use it exactly as returned. That URL requires no authentication and serves the file with Content-Type: application/pdf and Content-Disposition: attachment; filename="posudok-{number}.pdf" (the testimony's order number, e.g. posudok-2648213.pdf).
Frontend integration
The API request itself needs the Authorization: Bearer header, so a plain <a href> or window.open() pointing at the API URL fails with 401. Fetch the link first, then send the browser to it:
const response = await fetch(`/api/v1/testimonies/${testimonyId}/download`, {
headers: { Authorization: `Bearer ${accessToken}`, Accept: 'application/json' },
});
const { data } = await response.json();
window.location.assign(data.url); // the attachment disposition triggers a downloadThe presigned URL is self-authenticating — do not send the Authorization header to it. Request a fresh link for every download instead of storing one; it expires after 5 minutes.
Authentication
Requires authentication via Bearer token and a verified email. Only the testimony's client or the assigned expert may download the document (403 Forbidden otherwise).
401 Unauthorized
{
"message": "Unauthenticated."
}Error Handling
404 Not Found — the testimony has no document yet (it is not completed):
{
"message": "Testimony file not found."
}In production the message is the generic Not Found (see Error Responses). An unknown testimony ID answers 404 Not Found as well.