Craft icon

Craft

Interact with your Craft documents via the API

Block → Upload File

AI-generated

Summary

Upload a binary file from workflow input data as a block to a Craft document, specifying its type and position within the document.

Inputs

  • Binary Property (required) — Name of the binary property in the input data that contains the file to upload.
  • File Name — Optional override for the file name sent to Craft; uses the binary file name if left empty.
  • MIME Type — Optional override for the MIME type sent to Craft; defaults to the binary MIME type or application/octet-stream.
  • Block Options — Settings for the new block, including Block Type (File, Image, or Video), optional Alt Text, and optional Width for image or video blocks.
  • Upload Position — Position where to insert the uploaded block: at the End of Page (requires Page ID), Before Block, or After Block (both require Sibling ID).

Output shape

a single JSON object representing the uploaded block(s) as returned by the Craft API

The operation returns an array of JSON items containing the uploaded block data corresponding to each input item processed. The exact structure depends on the Craft API response. Errors during upload produce error entries unless 'Continue on Fail' is enabled.

Examples

Example 1: Uploading an image file located in the binary property "data", inserting it as an Image block at the end of a specified page.

Set Binary Property to "data", Block Type to "Image", specify Page ID under Upload Position as End of Page, optionally provide File Name and MIME Type overrides.

Discussion