Skip to Content
CerebrumDocs
GuidesAPI referenceTrust & security

Upload File

POST
/v1/file

Upload one file for the authenticated user as multipart/form-data with a single file part named file. No other form fields are required; additional text fields are not used. The file may be at most 10 MiB (10,485,760 bytes); a larger file returns 413. A part with another field name returns 400.

The stored media type is the Content-Type sent with the file part (not detected from content), and the stored name is its filename. HEIC/HEIF images, detected from their content, are converted to JPEG and renamed .jpg; an undecodable HEIC/HEIF file returns 500 and stores nothing.

Retain id: it is the file ID used elsewhere (for example selfieFileId) and by Get File.

curl -X POST "$CEREBRUM_BASE_URL/v1/file" \  -H "apikey: $CEREBRUM_API_KEY" \  -F "file=@selfie.jpg;type=image/jpeg"

Related: Get File

Authorization

apiKey
headerapikey<token>

Request Body

multipart/form-data
  1. body
file*file

The file to store (maximum 10,485,760 bytes). Send its media type as the part Content-Type.

Formatbinary

Response Body

File stored.

application/json
  1. response
id*string

The ID of the uploaded file

Formatuuid
key*string

Storage key of the uploaded file. Informational; use id to refer to the file.

Example Request
cURL
curl -X POST 'https://api.cerebrum.com/v1/file' \  -H 'apikey: CEREBRUM_API_KEY' \  -F 'file=@path/to/file'
Example Response
{  "id": "1d3f5b7a-9c2e-4b6d-8a1f-3e5c7a9b1d42",  "key": "cortex/uploads/1d3f5b7a-9c2e-4b6d-8a1f-3e5c7a9b1d42_selfie.jpg"}