---
title: "Attach Documents to Record File Field"
method: POST
path: "/api/Public/filefield/attachfile"
tags: ["Public"]
---

# Attach Documents to Record File Field

`POST /api/Public/filefield/attachfile`

## Request

- Base URL: `https://apidocs.cflowapps.com` (the document declares no server; this is the origin it was published from)
- URL: `https://apidocs.cflowapps.com/api/Public/filefield/attachfile`
- Auth: API key in header `X-Api-Key` and API key in header `X-User-Key`
- TypeScript: <https://skmtc.dev/cflowapps/apis/cflow-public-api/docs/api/Public/filefield/attachfile/post.ts> (a function with typed inputs; its response is checked against the schema)

Sample request:
            
    POST 
    {             
         "WorkflowName":"Test Workflow",
         "StageName":"Approval stage",
         "RecordId":"10"
         "FieldName":"File Uploader"
         "File":"File to upload"
    }

## Request body `multipart/form-data`

- object
  - `WorkflowName` string, required: Name of the workflow / lookup
  - `StageName` string, required: For workflows, enter the workflow stage display name as stage name. For lookup workflows, enter the lookup name as the stage name
  - `RecordId` integer, required: Record Id
  - `FieldName` string, required: Field Name
  - `File` string, binary, required: File to upload (Maximum File Size 20MB)

## Response `200`

Return status of the request

- FileAttachStatus
  - `fileName` string, nullable: Attached Filename
  - `status` string, nullable: Returns if the file is uploaded successfully
  - `message` string, nullable: Message of the file

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Unable to attach files
- `500`: Internal Server Error

---

[API](https://skmtc.dev/cflowapps/apis/cflow-public-api.md) - [All operations](https://skmtc.dev/cflowapps/apis/cflow-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cflowapps/apis/cflow-public-api/revisions/af0dadd0ad10?raw)
