Skip to main content

Replace a model's preview image with a viewport capture.

POST/api/v1/documents/{document_id}/model-viewer/set-preview-imagedocuments:write

Sets the representative image every viewer of the model sees (the Explorer's thumbnail of a model, export_document_thumbnails page 0) from image_base64, a capture of the viewport of up to 2 MiB; the Portal decodes and re-encodes it as JPEG, at most 1600 px. expected_source_file_hash is the revision the capture was taken of (source_file_hash of the model viewer): a model that changed meanwhile is 409. Needs Edit Model Preview Images and an edit grant on the model document. Answers the model viewer with View Model Viewer, otherwise the write receipt.

Scopedocuments:write
AsynchronousNo
MCP toolset_document_model_viewer_preview_image
Portal permissionsedit_model_preview_images

Parameters​

NameInTypeRequiredDescription
document_idpathstringRequired
Docwize-Versionheaderstring (date)Optional
Idempotency-KeyheaderstringOptionalmax 255

Request body​

Content typeType
application/jsonModelPreviewSetInput

Responses​

StatusDescriptionBody
200Success.application/json ModelViewer or object
400invalid_version, malformed_jsonapplication/problem+json Problem
401token_expired, unauthenticatedapplication/problem+json Problem
403forbidden, insufficient_scope, token_owner_inactiveapplication/problem+json Problem
404not_foundapplication/problem+json Problem
405method_not_allowedapplication/problem+json Problem
406not_acceptableapplication/problem+json Problem
409conflict, idempotency_in_progressapplication/problem+json Problem
413payload_too_largeapplication/problem+json Problem
415unsupported_media_typeapplication/problem+json Problem
421wrong_regionapplication/problem+json Problem
422idempotency_key_reused, validation_failedapplication/problem+json Problem
500internal_errorapplication/problem+json Problem
503tenant_unavailable, unavailableapplication/problem+json Problem
504timeoutapplication/problem+json Problem

Errors​

The problem codes this operation can answer with. Each code links to its page.

Schemas​

ModelPreviewSetInput​

FieldTypeRequiredDescription
expected_source_file_hashstringRequiredsource_file_hash of the model the capture was taken of.
image_base64stringRequiredThe viewport capture (PNG or JPEG), base64 encoded, up to 2 MiB.

ModelViewer​

FieldTypeRequiredDescription
configuration_requiredbooleanRequiredWhether the viewer must be configured before it can open this model.
document_idstringRequired
extensionstring or nullRequiredThe model file's extension.
max_bytesstring or nullRequiredThe largest model the viewer opens.
messagestring or nullRequiredWhat the viewer tells the person while a model is prepared or when it cannot open it.
progressinteger or nullRequired0 to 100 while a model is being prepared.
rendererstring or nullRequirednative_ifc, native_three or autodesk for a model; null otherwise.
source_file_hashstring or nullRequiredThe revision of the model file a preview and the model notes are tied to.
tierstring or nullRequired
viewerstringRequiredpdf, model3d, model3d_pending or download.