> ## Documentation Index
> Fetch the complete documentation index at: https://onextel-09023014.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Media Upload

> Upload media files for use in RCS rich cards and carousel messages.

Upload an image, GIF, or video so you can reference it by URL in a
[rich card standalone or carousel message](/api-reference/rcs/send-messages), instead of hosting
the file yourself.

## Endpoint

```
POST https://api.onexaura.com/rcs/mediaupload
```

**apikey** `string` *required*

Your OneXtel API key.

**accept** `string`

`application/json` — specifies the response format.

> [!NOTE]
>
> This is a `multipart/form-data` request, not JSON.

## Request parameters

**senderProfileName** `string` *required*

Registered RCS sender profile name (your RCS bot/sender ID).

**message\_type** `string` *required*

Type of RCS message the media will be used with, e.g. `transactional` or `promotional`.

**file** `file`

The media file to upload (multipart), e.g. an image, GIF, or video. Required unless you supply
`url` instead.

**url** `string`

A public URL to fetch the media from, instead of uploading a file.

> [!WARNING]
>
> **Supply exactly one of `file` or `url`.** Sending neither is rejected with
> `Either file or url must be provided`, and sending both with
> `Only one file or url can be provided`.

## cURL

```bash Upload a file theme={null}
curl --location 'https://api.onexaura.com/rcs/mediaupload' \
--header 'apikey: YOUR_API_KEY' \
--form 'senderProfileName="your_rcs_sender"' \
--form 'message_type="transactional"' \
--form 'file=@"/path/to/file"'
```

```bash Fetch from a URL theme={null}
curl --location 'https://api.onexaura.com/rcs/mediaupload' \
--header 'apikey: YOUR_API_KEY' \
--form 'senderProfileName="your_rcs_sender"' \
--form 'message_type="transactional"' \
--form 'url="https://example.com/banner.jpg"'
```

## Response

```json Response theme={null}
{
  "id": "DL6+bVHuwLm7N3kstC270cfrehEzZOn3pa84pyewspE=",
  "status": "success",
  "http_status": 200,
  "onextel_media_url": "https://warcssm.1xtel.co/media/media/6dc9571d-3805-4ac2-9e92-0eb1c35b1b6e/e04a2aac-83f5-45a8-9429-58669e8dd207.jpeg"
}
```

**id** `string`

Unique identifier for the uploaded media.

**status** `string`

Result status, e.g. `success`.

**http\_status** `integer`

HTTP status code of the upload operation.

**onextel\_media\_url** `string`

Hosted URL of the uploaded media. Pass this as `fileUrl` in a rich card's
`cardContent.media.contentInfo.fileUrl` when sending a
[rich card standalone or carousel message](/api-reference/rcs/send-messages).

## Error codes

| Error | Response Status | Error Description |
| - | - | - |
| Invalid Method | 405 | Method Not Allowed |
| Missing ApiKey | 114 (200) | NO VALID AUTH\_KEY FOUND |
| Invalid ApiKey | 200 | AUTHENTICATION FAILURE |
| Missing Content-Type | 400 | Missing Content-Type / Missing form data |
| Invalid Content-Type | 400 | Content-Type must be multipart/form-data or application |
| Missing message\_type (if BotId is empty) | 400 | message\_type is mandatory |
| Neither File nor URL is provided | 400 | Either file or url must be provided |
| Both File and URL provided | 400 | Only one file or url can be provided |
| Missing BotId, when messageType is empty | 400 | channelId is mandatory |
| Invalid Json | 400 | Invalid JSON |
| Upstream Req Failure | 503 | Reason of Failure can be multiple |
| Upstream service unavailable | 503 | Upstream service unavailable |
| Unknown Request | 500 | Internal server error - unexpected arguments |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.