---
title: "Upload message attachment"
method: POST
path: "/api/v2/messages/attachment"
tags: ["Outbound Messages"]
---

# Upload message attachment

`POST /api/v2/messages/attachment`

<a class="try-sandbox-link" href="https://sandbox.textmagic.com/#/Messages%3A%20Send%0A/uploadMessageAttachment" target="_blank">Try in sandbox</a><br>Upload a new file to insert it as a link.

## Response `200`

File uploaded with success.

- UploadMessageAttachmentResponse
  - `chars` integer, required — `href` field characters count.
  - `href` string, required — This is a relative link to your file. To construct a full link, just add “[https://my.textmagic.com/”](https://my.textmagic.com/%E2%80%9D) to the beginning (like this: [https://my.textmagic.com/click/Zwcj9](https://my.textmagic.com/click/Zwcj9)). For most modern devices, you can omit the “https://” part and write just [my.textmagic.com/click/Zwcj9](https://my.textmagic.com/click/Zwcj9), which will save you 8 characters.
  - `name` string, required — File name of the uploaded file.
  - `size` integer, required — Attachment size in bytes.
  - `resource` string, required — Internal file name

## Other responses

- `400` — Bad request.
- `401` — Unauthorized request.

---

[API](https://skmtc.net/textmagic/apis/textmagic-api.md) · [All operations](https://skmtc.net/textmagic/apis/textmagic-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/textmagic/textmagic-api/revisions/3e4029d19684/schema)
