---
title: "Add file attachment"
method: POST
path: "/me/messages/{messageId}/attachments"
tags: ["me.message"]
---

# Add file attachment

`POST /me/messages/{messageId}/attachments`

Use this API to add a file attachment to a message. An attachment can be one of the following types: fileAttachment, itemAttachment, or referenceAttachment. All these types of attachment resources are derived from the attachment resource. For file attachments smaller than 3 MB, use this endpoint. For larger files, use the createUploadSession endpoint.

## Request body

- MicrosoftGraphAttachment
  - `@odata.type` string
  - `id` string — The unique identifier for an entity. Read-only
  - `lastModifiedDateTime` string, date-time, nullable — The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
  - `size` number — The length of the attachment in bytes
  - `name` string, nullable — The attachment's file name
  - `isInline` boolean — true if the attachment is an inline attachment; otherwise, false
  - `contentType` string, nullable — The MIME type
  - `contentBytes` string, base64url, nullable — The base64-encoded contents of the file attachment. Required only for file attachments

## Response `2XX`

Created attachment

- MicrosoftGraphAttachment
  - `@odata.type` string
  - `id` string — The unique identifier for an entity. Read-only
  - `lastModifiedDateTime` string, date-time, nullable — The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 2014-01-01T00:00:00Z
  - `size` number — The length of the attachment in bytes
  - `name` string, nullable — The attachment's file name
  - `isInline` boolean — true if the attachment is an inline attachment; otherwise, false
  - `contentType` string, nullable — The MIME type
  - `contentBytes` string, base64url, nullable — The base64-encoded contents of the file attachment. Required only for file attachments

## Other responses

- `4XX` — error
- `5XX` — error

---

[API](https://skmtc.net/ballerina-platform/apis/microsoft-graph-mail-api.md) · [All operations](https://skmtc.net/ballerina-platform/apis/microsoft-graph-mail-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ballerina-platform/microsoft-graph-mail-api/versions/af62694b9f2d/schema)
