---
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

## Changes

- **2026-07-17** `af62694b9f2d` — 2 info
  - added the new optional request property `allOf[subschema #2: attachment]/contentBytes`
  - added the optional property `allOf[subschema #2: attachment]/contentBytes` to the response with the `2XX` status
- **2026-05-27** `354d90657cdd` — 1 info
  - api operation id `me.messages.CreateAttachments` removed and replaced with `addAttachment`
- **2026-05-26** `5c775c50414c` — 18 info
  - mapped value for discriminator key `#microsoft.graph.attachment` changed from `#/components/schemas/microsoft.graph.attachment` to `#/components/schemas/MicrosoftGraphAttachment` for `allOf[subschema #1: entity]/` request property
  - mapped value for discriminator key `#microsoft.graph.fileAttachment` changed from `#/components/schemas/microsoft.graph.fileAttachment` to `#/components/schemas/MicrosoftGraphAttachment` for `allOf[subschema #1: entity]/` request property
  - mapped value for discriminator key `#microsoft.graph.fileAttachment` changed from `#/components/schemas/microsoft.graph.fileAttachment` to `#/components/schemas/MicrosoftGraphAttachment` for `allOf[subschema #2: attachment]/` request property
  - mapped value for discriminator key `#microsoft.graph.itemAttachment` changed from `#/components/schemas/microsoft.graph.attachment` to `#/components/schemas/MicrosoftGraphAttachment` for `allOf[subschema #2: attachment]/` request property
  - …14 more
- …earlier changes not shown

[Full history](https://skmtc.dev/ballerina-platform/apis/microsoft-graph-mail-api/changes/me/messages/:messageId/attachments/post.md)

---

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