> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vouchmark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload session attachment

> Upload a file attachment for a module field in a session.

<Note>
  This is an embed runtime endpoint. It is called by the embedded Vouchmark widget in the applicant's browser, not by your backend. It uses the widget's `token` and does **not** take a `Bearer` token.
</Note>

Uploads a single file and attaches it to a module field on an in-progress session. The request is `multipart/form-data`. The session must be `in_progress` and the module must be enabled on the widget. Returns the updated session view, including the new attachment.

Accepted file types: PDF, JPEG, PNG. Maximum size 10 MB.

## Path parameters

<ParamField path="sessionId" type="string" required>
  The session ID (starts with `wses_`).
</ParamField>

## Form fields

<ParamField body="file" type="file" required>
  The file to upload. Field name must be `file`.
</ParamField>

<ParamField body="token" type="string" required>
  The widget's embed link token (`embedLinkToken`, starts with `elt_`).
</ParamField>

<ParamField body="moduleId" type="string" required>
  The module this attachment belongs to. Must be enabled on the widget.
</ParamField>

<ParamField body="fieldName" type="string" required>
  The module field the attachment is stored under.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.vouchmark.com/v1/widget/embed/sessions/wses_.../uploads \
    -F "file=@/path/to/certificate.pdf" \
    -F "token=elt_..." \
    -F "moduleId=document_upload" \
    -F "fieldName=certificateOfIncorporation"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "data": {
      "sessionId": "wses_...",
      "widgetId": "wgt_aBcD...",
      "status": "in_progress",
      "currentModuleId": "document_upload",
      "answers": {},
      "attachments": {
        "document_upload": {
          "certificateOfIncorporation": {
            "url": "https://res.cloudinary.com/.../certificate.pdf",
            "publicId": "kyb-widget-sessions/abc123",
            "format": "pdf",
            "size": 482113,
            "originalName": "certificate.pdf"
          }
        }
      },
      "referenceId": null
    }
  }
  ```
</ResponseExample>

Returns `201`. Rate limited to 40 uploads per hour.
