---
title: "Upload Media File"
method: POST
path: "/orgunit/{orgunitId}/messages/file"
tags: ["Send"]
---

# Upload Media File

`POST /orgunit/{orgunitId}/messages/file`

## Request

- Base URL: `https://api-docs.ministrybytext.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api-docs.ministrybytext.com/orgunit/{orgunitId}/messages/file`
- Auth: none declared
- TypeScript: <https://skmtc.dev/ministrybytext/apis/pbt-api-documentation/docs/orgunit/:orgunitId/messages/file/post.ts> (a function with typed inputs; its response is checked against the schema)

This function allows you to upload a file to be sent as an MMS or WhatsApp to the user.
The response will include MediaDetails, which will have an object called
mediaPath. The mediaPath object contains an array of details about the
uploaded file such as fileName, extension, fileSaveId, mimetype, and url.

Supported file types: JPG, PNG, GIF, MP4, MP3, PDF

- MMS File size limit(US): 950 KB
- MMS File size limit(Canada): 750 KB
- WhatsApp File size limit: 15 MB

## Path parameters

- `orgunitId` string, required

## Query parameters

- `UsedFor` 'whatsapp'

## Request body `multipart/form-data`

- object
  - `file` string, binary

## Response `202`

Success

- MediaDetailsExternalApiResponseNew
  - `data` MediaDetails
    - `mediaPath` MediaPath[], nullable
      - `fileName` string
      - `extension` string
      - `fileSaveId` string
      - `mimetype` string
      - `url` string
  - `appCode` string, nullable
  - `message` string, nullable
  - `isError` boolean

## Other responses

- `400`: Bad Request

---

[API](https://skmtc.dev/ministrybytext/apis/pbt-api-documentation.md) - [All operations](https://skmtc.dev/ministrybytext/apis/pbt-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/ministrybytext/apis/pbt-api-documentation/revisions/7d64a1f0b0c3?raw)
