Skip to main content

File upload endpoint

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.

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:

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

Request Body REQUIRED
data object[] REQUIRED

List of blobs to upload

filename Filename REQUIRED

Possible values: 3 ≤ length ≤ 255, Value must match regular expression ^[\w\-. '\"()]+$`

File name. Ex: 'awesome_file.mp4'

mime_type AllowedMIMEType REQUIRED

Possible values: [audio/x-wav, audio/wav, audio/mp3, audio/x-m4a, audio/mpeg, audio/flac, video/webm, video/mp4, video/mpeg]

Allowed MIME types

display_name Display Name

File display name.

description Description

File description.

item_id Item Id

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.

Responses
200

Successful Response

Schema OPTIONAL
ok Ok OPTIONAL

Indicates if the request was successful or not.

data object[]
item_id Item Id

Possible values: 1 ≤ length ≤ 36

Identifier of the item from upload request.

blob_id Blob Id

Blob ID

url uri

Possible values: 1 ≤ length ≤ 2083

Upload URL

form_data Form Data

Form data for uploading the file

default

Default Response

Schema OPTIONAL
ok Ok OPTIONAL

Indicates if the request was successful or not.

errors object[]

List of errors

type uri

Possible values: 1 ≤ length ≤ 2083

A string containing a URI reference that identifies the problem type.

status Status

Possible values: 399 < value < 600

A number indicating the HTTP status code.

title Title

Possible values: 5 ≤ length

A string containing a short, human-readable summary of the problem type.

detail Detail

Possible values: 5 ≤ length

A string containing a human-readable explanation specific to this occurrence of the problem.

instance Instance

Possible values: 1 ≤ length

A string containing a URI reference that identifies the specific occurrence of the problem.

error_code Error Code

A Number that indicates the error type that occurred.