# Attachments

This is a resource representing a binary file hosted on Navarik's servers. A file can be uploaded and attached to a specific document using create attachment request with media type multipart/form-data.

# Data Model

Field Type Description
workspace UUID Reference to the parent workspace.
document UUID Reference to the parent document.
caption string File name.
size int File size in bytes.
location string Uploaded file's internal identifier for Navarik infrastructure.
format string File type.

# Example Body

{
    "workspace": "a2070b04-ca32-4a36-af58-c56e25715cb5",
    "document": "ff16bb4f-e595-47d1-b945-acd8a0a898e1",
    "caption": "4qj46d.jpg",
    "size": 56068,
    "location": "1b8c926876d980d7797f20f00",
    "format": "image/jpeg"
}

# List Attachments

Returns all files for a specified document within a specified workspace.

GET /v2/workspaces/{workspace_id}/documents/{document_id}/attachments

# Request parameters

Parameter Description Type Required Default
workspace_id Workspace id UUID yes
document_id Document id UUID yes
limit Maximum number of records to return integer no 25
offset The number of records to skip integer no 0
sort List of comma-separated ordering criteria string: field:asc|desc no "created_at:desc, id:asc"

# Request body

None

# Response

An array of entity envelopes with the type set to navarik.bridge.attachment and the body formatted to the attachment model.

# Create Attachment

Attaches a file to a document.

POST /v2/workspaces/{workspace_id}/documents/{document_id}/attachments

# Request parameters

Parameter Description Type Required Default
workspace_id Workspace id UUID yes
document_id Document id UUID yes

# Request body

Use only multipart/form-data media type with this request.

Field Description Type Required Default
file Attachment file content binary yes

# Response

A single entity envelope with the type set to navarik.bridge.attachment and the body formatted to the attachment model.

# Get Attachment Descriptor

Retrieves the details of a specific file that was attached to a document.

GET /v2/workspaces/{workspace_id}/documents/{document_id}/attachments/{attachment_id}

# Request parameters

Parameter Description Type Required Default
workspace_id Workspace id UUID yes
document_id Document id UUID yes
attachment_id Attachment id UUID yes

# Request body

None

# Response

A single entity envelope with the type set to navarik.bridge.attachment and the body formatted to the attachment model.

# Download Attachment Content

Downloads a copy of specific file that was attached to a job.

GET /v2/workspaces/{workspace_id}/documents/{document_id}/attachments/{attachment_id}/content

# Request parameters

Parameter Description Type Required Default
workspace_id Workspace id UUID yes
document_id Document id UUID yes
attachment_id Attachment id UUID yes

# Request body

None

# Response

Binary content of the requested attachment.

# Delete Attachment

Deletes an attachment file from the specified document.

DELETE /v2/workspaces/{workspace_id}/documents/{document_id}/attachments/{attachment_id}

# Request parameters

Parameter Description Type Required Default
workspace_id Workspace id UUID yes
document_id Document id UUID yes
attachment_id Attachment id UUID yes

# Request body

None

# Response

The latest known version of the deleted attachment as a single entity envelope with the type set to navarik.bridge.attachment and the body formatted to the attachment model.