Feedback items

POST /feedback_portal/{portalId}/attachment

Changed on

Upload a file so it can be attached to a piece of feedback.

Upload first, then submit. multipart/form-data with the file in a field named file. The response carries an id; pass it in attachmentIds on POST /feedback_portal/{portalId}/feedback or .../plain_feedback to file it with that submission. Call this once per file.

That order is not a preference. A form's file picker fires while the person is still writing, so there is no feedback item to attach to yet — and it means a failed upload costs a retry of one file rather than the whole submission.

Until a create call names it, the file belongs to the portal and to nothing else. It is not visible on any feedback item, and an id from a different portal is refused.

Limits. 20 MB per file, 10 files per feedback item. Executable and script types are refused (422 file_type_not_allowed), as is a file whose bytes do not match an image extension it claims (422 file_content_mismatch). Over the size cap is 413 file_too_large. Files are virus-scanned after this call returns; an infected file is removed along with its links.

Reading attachments back is not part of this release — this endpoint stores them; the portal and the Craft app display them.

Takes the same three credentials as the create routes: an account API key, a widget token, or a development key.

Request

  • Base URL
    https://api.craft.io
  • URL
    https://api.craft.io/feedback_portal/{portalId}/attachment
  • Auth
    API key in header x-api-key

Path parameters

portalIdstring required

Request body multipart/form-data

filestring binary required

The file itself, as multipart field file.

Response

The stored file — pass its id in attachmentIds when you create the feedback item

idstring required

Pass this to attachmentIds on the create call.

namestring required

The original file name, as uploaded.

sizenumber double required

Size in bytes.

mimestring required

Detected MIME type — read from the bytes, not from the upload's Content-Type.

extensionstring required

Lower-cased extension, no dot.

Changes