Skip to main content

Upload an Artifact

Uploads a single file to the specified dock. The file is stored with content-addressable deduplication — if a file with the same SHA-256 hash already exists, no additional storage is consumed.
POST /v1/docks/:dockId/artifacts/upload

Path Parameters

ParameterTypeDescription
dockIdstringThe dock ID

Request Body

Multipart form data with a single file field.
FieldTypeRequiredDescription
filefileRequiredThe file to upload

Example Request

curl -X POST https://api.docyard.io/v1/docks/dock_01HQ3K.../artifacts/upload \
  -H "Authorization: Bearer dk_live_a1b2c3d4..." \
  -F "[email protected]"

Response

{
  "id": "art_01HQ3M...",
  "filename": "declaration-page-2025.pdf",
  "contentType": "application/pdf",
  "size": 245760,
  "hash": "sha256:a3f8c2d1e4b5a6f7...",
  "checksum": "a3f8c2d1e4b5a6f7...",
  "storageKey": "docks/dock_01HQ3K.../artifacts/f7a2b3c4.pdf",
  "isDuplicate": false,
  "metadata": {},
  "createdAt": "2025-01-15T10:31:00.000Z"
}

Response Fields

FieldTypeDescription
idstringUnique artifact ID
filenamestringOriginal filename
contentTypestringMIME type detected from file content
sizeintegerFile size in bytes
hashstringSHA-256 content hash prefixed with sha256:
isDuplicatebooleantrue if the file already existed in this dock
storageKeystringInternal storage path
createdAtstringISO 8601 timestamp

Error Handling

StatusCondition
400No file provided in the request
401Missing or invalid API key
404Dock not found
When isDuplicate is true, the response returns the existing artifact’s ID and metadata. No new storage is consumed. The original createdAt timestamp is preserved.