uploaded-files

Initialize a file upload

Reserves a slot for a new file in the consultation and returns a short-lived presigned S3 URL. Three-step flow:

  1. Call this endpoint to get uploadUrl and fileName.
  2. PUT the file bytes directly to uploadUrl.
  3. Call finalizeUpload with the same fileName to start content extraction, then poll GET .../uploaded-files until the status is analyzed or failed.

De-duplication is by SHA-256: a second initUpload with the same sha256 in the same consultation returns 409 CONFLICT, including when the first upload was never completed (delete that file first to retry). The slot is created immediately with status uploaded. If URL generation fails after the slot is created, the slot is removed so the client can safely retry. Returns 403 for archived consultations.

post/workspaces/{workspaceId}/consultations/{consultationId}/uploaded-files

Request

  • Base URL
    https://vetnio.com/api/v2
  • URL
    https://vetnio.com/api/v2/workspaces/{workspaceId}/consultations/{consultationId}/uploaded-files
  • Auth
    HTTP bearer

Path parameters

workspaceIdstring required

Opaque identifier of the Vetnio workspace (veterinary clinic) that owns the resource. Scopes every request — callers can only access files under workspaces they are a member of.

Example:furunculotic-loud-chihuahua
consultationIdstring required

Identifier of the consultation (a single veterinary visit) the file is attached to. The consultation must belong to the same workspace as the authenticated caller.

Example:a1b2c3d4-e5f6-7890-abcd-ef1234567890

Request body

originalFileNamestring required

The file name as it was on the uploader's device. Shown to users in the UI. May contain characters that are unsafe for object-storage keys, which is why it is never used as a storage identifier.

sha256string required

Hexadecimal SHA-256 digest (64 characters) of the exact bytes you will upload, computed client-side. Used only for de-duplication: a consultation cannot hold two files with the same digest, so a second initUpload with the same value returns 409 CONFLICT. Vetnio does not verify that the uploaded bytes match it.

mimeType'application/pdf' | 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif' | 'text/csv' | 'text/plain' | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | 'application/vnd.ms-excel' required

MIME type of the file. Restricted to the formats Vetnio can analyze: PDF, images (PNG / JPEG / WebP / GIF), plain text, CSV, Word (.docx), and Excel (.xlsx / .xls). Other values are rejected with 400. Not checked against the uploaded bytes, so send the real type: it decides how the content is extracted.

sizeBytesinteger required

Exact size of the file in bytes. finalizeUpload compares it with the size of the uploaded object and returns 412 until they match, so it must equal the number of bytes you PUT. No maximum is enforced by the API.

Example request

{
  "originalFileName": "xray_bella_2024-06-12.pdf",
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "mimeType": "application/pdf",
  "sizeBytes": 184320
}

Response

Upload slot reserved; use uploadUrl to send the bytes and fileName to finalize.

uploadUrlstring uri required

Presigned S3 URL valid for 1 hour. PUT the raw file bytes (no multipart form) to this URL before it expires. If it lapses, delete this file and call initUpload again; a second initUpload with the same sha256 returns 409 while this slot exists.

s3Keystring required

Internal S3 object key where the file will live. Exposed for debugging only — clients should not depend on its format or attempt to access S3 directly with it.

fileNamestring required

Stable internal identifier for the file — a server-generated UUID returned by initUpload. Used in every subsequent endpoint (finalize, download, delete). Not intended for display; use originalFileName for that.

Example response

{
  "uploadUrl": "https://example-bucket.s3.eu-central-1.amazonaws.com/consultationInformation/furunculotic-loud-chihuahua/uploadedFiles/a1b2c3d4-e5f6-7890-abcd-ef1234567890/8f1c4a60-7e3b-4b6f-9a9d-6d9f3c8b2e4a?X-Amz-Expires=3600&X-Amz-Signature=...",
  "s3Key": "consultationInformation/furunculotic-loud-chihuahua/uploadedFiles/a1b2c3d4-e5f6-7890-abcd-ef1234567890/8f1c4a60-7e3b-4b6f-9a9d-6d9f3c8b2e4a",
  "fileName": "8f1c4a60-7e3b-4b6f-9a9d-6d9f3c8b2e4a"
}

Changes

No recorded changes to this operation across all 1 revision of this API.