---
title: "Get upload URL"
method: POST
path: "/uploads"
tags: ["upload"]
---

# Get upload URL

`POST /uploads`

## Request

- Base URL: `https://botapi.tamtam.chat`
- URL: `https://botapi.tamtam.chat/uploads`
- Auth: API key in query parameter `access_token`

Returns the URL for the subsequent file upload.

For example, you can upload it via curl:

```curl -i -X POST
  -H "Content-Type: multipart/form-data"
  -F "data=@movie.mp4" "%UPLOAD_URL%"```

Two types of an upload are supported:
- single request upload (multipart request)
- and resumable upload.

##### Multipart upload
This type of upload is a simpler one but it is less
reliable and agile. If a `Content-Type`: multipart/form-data header is passed in a request our service indicates
upload type as a simple single request upload.

This type of an upload has some restrictions:

- Max. file size - 2 Gb
- Only one file per request can be uploaded
- No possibility to restart stopped / failed upload

##### Resumable upload
If `Content-Type` header value is not equal to `multipart/form-data` our service indicated upload type
as a resumable upload.
With a `Content-Range` header current file chunk range and complete file size
can be passed. If a network error has happened or upload was stopped you can continue to upload a file from
the last successfully uploaded file chunk. You can request the last known byte of uploaded file from server
and continue to upload a file.

##### Get upload status
To GET an upload status you simply need to perform HTTP-GET request to a file upload URL.
Our service will respond with current upload status,
complete file size and last known uploaded byte. This data can be used to complete stopped upload
if something went wrong. If `REQUESTED_RANGE_NOT_SATISFIABLE` or `INTERNAL_SERVER_ERROR` status was returned
it is a good point to try to restart an upload

## Query parameters

- `type` 'image' | 'video' | 'audio' | 'file', required: Type of file uploading

## Response `200`

Returns URL to upload attachment

- UploadEndpoint: Endpoint you should upload to your binaries
  - `url` string, required: URL to upload

## Other responses

- `401`: Authorization Error. No `access_token` provided or token is invalid
- `500`: Internal Server Error

## Changes

- **2019-10-10** `05b455737d1e`: 1 breaking, 1 info
  - removed the enum value `photo` from the `query` request parameter `type`
  - added the new enum value `image` to the `query` request parameter `type`

[Operation history](https://skmtc.dev/tamtam/apis/tamtam-bot-api/changes/uploads/post.md)

---

[API](https://skmtc.dev/tamtam/apis/tamtam-bot-api.md) - [All operations](https://skmtc.dev/tamtam/apis/tamtam-bot-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tamtam/apis/tamtam-bot-api/revisions/fa85402ea716?raw)
