# Add attachments to support case

Source: https://developer.avalara.com/products/returns/integration-guides/managed-returns/ezl5844098667215/

Guide: Avalara Managed Returns API (U.S. and Canada)

# Add attachments to support case

Learn how to upload and attach files to an existing support case using the GraphQL API.

Uploads one or more files to an existing support case.

When uploading attachments, pass the unique `caseId` associated with the support case, along with an `attachments` array containing each file's details:

-   `fileName`: The name and extension of the file.
-   `fileType`: The file format or MIME type category (for example, `text` or `pdf`).
-   `fileContent`: The file payload encoded as a Base64 string.

When the mutation succeeds, the API returns a unique `attachmentId` for each submitted file.

Note

Attachments are processed and validated asynchronously after upload. An `attachmentId` in the response confirms receipt of the file, not its final acceptance. Use the `supportCaseAttachmentStatus` query to poll and verify whether the final status of the attachment is `ACCEPTED` or `REJECTED`.

**View request**:

```
mutation AddSupportCaseAttachment {
  addSupportCaseAttachment(
    input: {
      caseId: "500VG000016aJctYAE"
      attachments: [
        {
          fileContent: "RW5kLXRvLWVuZCB0ZXN0IGZpbGUgZnVsbCBmbG93IGFmdGVyIHJlcGFja2FnaW5n"
          fileName: "e2e-ips27407-v8.txt"
          fileType: "text"
        },
        {
          fileContent: "base64__PRE_BLOCK_0__quot;
          fileName: "test-invalid.txt"
          fileType: "text"
        }
      ]
    }
  ) {
    attachments {
      attachmentId
      success
      errorMessage
    }
  }
}
```

**View response**:

```
{
  "data": {
    "addSupportCaseAttachment": {
      "attachments": [
        {
          "attachmentId": "bda882a8-5168-41f8-a093-f65ee9cc6d5c",
          "success": "true",
          "errorMessage": ""
        },
        {
          "attachmentId": "",
          "success": "false",
          "errorMessage": "Error executing data process; Caused by: INVALID_REQUEST: fileContent is not valid Base64 encoding.Illegal base64 character 24 (in groovy2 script); Caused by: INVALID_REQUEST: fileContent is not valid Base64 encoding.Illegal base64 character 24"
        }
      ]
    }
  }
}
```