EspoCRM icon

EspoCRM

Interact with EspoCRM API

Attachment → Upload

AI-generated

Summary

Upload a file as an attachment to a related EspoCRM entity, providing the file data either from a binary property on the input item or directly as a base64-encoded string.

Inputs

  • Input Source (required) — Choose how to provide the file data: from a binary field in the input item or directly as base64-encoded content.
  • Binary Property — When using Binary Field as input source, specify the name of the binary property containing the file data (default 'data').
  • Base64 Data — When using Base64 Direct as input source, provide the base64-encoded file content without data URI prefix.
  • File Name — When using Base64 Direct, specify the file name including extension (e.g., document.pdf).
  • MIME Type — When using Base64 Direct, optionally specify the MIME type (e.g., application/pdf); if omitted, it is auto-detected from the file extension.
  • Role (required) — Specify the attachment role; defaults to 'Attachment' and must be 'Attachment'.
  • Related Type (required) — Entity type the attachment relates to, such as Document or Note (default 'Document').
  • Field (required) — Field name on the related record to which the attachment will be uploaded (default 'file').
  • Additional Fields — Optional additional parameters including parentType, relatedId, parentId, file name, and MIME type to further specify the attachment's metadata.

Output shape

a single record

Returns details of the created attachment record in EspoCRM. The output includes metadata about the uploaded file and its relationship to the related entity.

Examples

Example 1: Upload file from binary property 'data' on input item related to a Document entity

Set 'Input Source' to 'Binary Field', 'Binary Property' to 'data', 'Related Type' to 'Document', and provide related IDs if needed.

Example 2: Upload base64-encoded file directly as attachment related to a Note entity

Set 'Input Source' to 'Base64 Direct', provide 'Base64 Data', 'File Name', optionally 'MIME Type', set 'Related Type' to 'Note', and specify 'Related ID' in additional fields.

Links

Discussion