---
title: "File upload endpoint"
method: POST
path: "/saas/upload"
tags: ["Blob"]
---

# File upload endpoint

`POST /saas/upload`

### Description
Endpoint provides a functionality to upload multiple client files direct to Palabra cloud.

Files submission occurs in several requests:
1. Client sends a POST request to the endpoint with a list of files to upload. Server verify the request
and generates a pre-signed URL for each submitted file.
2. Client sends a POST request to each pre-signed URL with the file to upload.

### Limitations
A client is allowed to upload up to `10` files at a time.
Each file must be greater than `0.1 MB` and less than `10 MB` in size. Reach out to the support team
if you need to upload larger files.

Following MIME types are granted:
 - `audio/mpeg`
 - `audio/aac`
 - `audio/wav`
 - `audio/webm`
 - `audio/mp3`
 - `video/webm`
 - `video/mp4`
 - `video/mpeg`

### Examples
#### cURL

**1. Submitting a list of files to receive pre-signed URLs for each file.**

```shell
curl -X 'POST' \
  'https://api.palabra.ai/saas/upload' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <JWT_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "data": [
    {
      "filename": "A7 E.bf7FPG_6bvIa9cDodiL41RtSZ_",
      "mime_type": "audio/x-wav",
      "display_name": "string",
      "description": "string",
      "item_id": "string"
    }
  ]
}'
```

**2. Submitting files**

Endpoint respond with a JSON array object containing `url` and `form_data` keys for each submitted file.
In the following example, we're use cURL command making a POST FormData request to upload a file:
```shell
curl -X POST \
-F 'key=bl...0f' \
-F 'x-amz-algorithm=AWS4-HMAC-SHA256' \
... Other form data fields from the response...
-F 'policy=eyJleHBpc...zA3WiJ9XX0=' \
-F 'x-amz-signature=463f78071...847af0c' \
-F file=@<file path at your file system> \
https://url.from.the/response/
```

### References
- [Basics: Browser-Based Uploads Using POST](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html)
- [Example: Browser-Based Upload using HTTP POST](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-post-example.html)
- [AWSJavaScriptSDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-s3-presigned-post/)

## Request body

- UploadRequest
  - `data` BlobMetadata[], required — List of blobs to upload
    - `filename` string, required — File name. Ex: 'awesome_file.mp4'
    - `mime_type` 'audio/x-wav' | 'audio/wav' | 'audio/mp3' | 'audio/x-m4a' | 'audio/mpeg' | 'audio/flac' | 'video/webm' | 'video/mp4' | 'video/mpeg' | 'image/png' | 'image/jpeg' | 'image/webp', required — Allowed MIME types
    - `display_name` string — File display name.
    - `description` string — File description.
    - `item_id` string — Identifier of the item. It represents the file ID in the request when uploading multiple files. Use it to identify the upload URL in the response related to the target file.

## Response `200`

Successful Response

- GenericResponsePayloadListUploadBlobResponseData
  - `ok` boolean — Indicates if the request was successful or not.
  - `data` UploadBlobResponseData[], required
    - `item_id` string, required — Identifier of the item from upload request.
    - `blob_id` string, required — Blob ID
    - `url` string, uri, required — Upload URL
    - `form_data` object, required — Form data for uploading the file

## Other responses

- `default` — Default Response

---

[API](https://skmtc.dev/palabra/apis/palabra-api.md) · [All operations](https://skmtc.dev/palabra/apis/palabra-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/palabra/palabra-api/revisions/cb8721654525/schema)
