uploadMedia
# uploadMedia
POST
/media/uploads
const url = 'http://localhost:8080/api/v1/media/uploads';const form = new FormData();form.append('file', 'example');form.append('kind', 'image');
const options = {method: 'POST', headers: {cookie: 'hs_session=<hs_session>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/media/uploads \ --header 'Content-Type: multipart/form-data' \ --cookie hs_session=<hs_session> \ --form file=example \ --form kind=imageUpload bytes for ingest or avatars. Max 50 MB. Images: jpeg, png, webp, gif, heic. Video: mp4, webm. Returns an existing media ID when the SHA-256 matches.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
file
required
string
kind
string
Responses
Section titled “Responses”Stored.
Media typeapplication/json
object
mediaId
required
string
sha256
required
string
Examples
Exampleseed
Derived from fixtures/seed.json.
{ "mediaId": "med_01j9a1b2c3d4e5f6g7h8j9k01w", "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}Too large.
Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
code
required
string
i18nKey
string
detail
string
fields
Array<object>
object
path
required
string
code
required
string
i18nKey
string
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "code": "example", "i18nKey": "example", "detail": "example", "fields": [ { "path": "example", "code": "example", "i18nKey": "example" } ]}