Assets APIPOST /api/v1/assets/{id}/documents
Product availability AlgaPSA
Associate document with asset Creates a document_associations row that links the path asset ID to the supplied document_id. The body is validated with createAssetDocumentSchema; document_id is required and notes is optional. The service inserts entity_type=asset, entity_id from the path, document_id, notes, tenant from context, and created_at, then returns the inserted row. It does not verify that the asset or document belongs to the same tenant before insert, does not set created_by, and publishes no event. Foreign-key or unique constraint errors surface through handleApiError.
Path parameters id string <uuid> Required
Asset UUID from assets.asset_id.
Request body Content type: application/json · schema AssetDocumentAssociationRequest
document_id string <uuid> Required
Document UUID from documents.document_id to associate with the asset.
notes string
Optional notes stored on document_associations.notes.
Response body Success response 201 · schema AssetDocumentAssociationResponse
success boolean Required
Enum: true
association_id string <uuid> Required
Primary key from document_associations.association_id.
entity_type string Required
Entity type stored on document_associations; always asset for these routes.
Enum: asset
entity_id string <uuid> Required
Asset UUID from document_associations.entity_id.
document_id string <uuid> Required
Document UUID from document_associations.document_id.
notes string Nullable
Optional association notes.
tenant string <uuid> Required
Tenant UUID from document_associations.tenant.
created_at string <date-time>
Association creation timestamp.
original_filename string
Original filename from the joined documents table, present on list responses.
file_size number
File size in bytes from the joined documents table, present on list responses.
mime_type string
MIME type from the joined documents table, present on list responses.
uploaded_at string <date-time>
Document upload timestamp from the joined documents table, present on list responses.
timestamp string <date-time> Required
Response codes 201
Document association created successfully.
400
Request body validation failed or a database foreign-key reference is invalid.
401
x-api-key is missing at middleware.
403
Authenticated request context lacks permission to update asset documents when auth wiring is present.
409
Duplicate association rejected by a database unique constraint.