This endpoint requires a valid Bearer token.
Endpoint
How pre-signed upload URLs work
Hayon does not proxy file uploads through its own servers. Instead, it issues a temporary pre-signed URL that grants your client direct write access to the S3 bucket for a single object.Request a pre-signed URL
Call
POST /api/posts/media/upload with the contentType of the file you want to upload. The server returns a short-lived uploadUrl, the permanent public s3Url, and the s3Key.Upload the file directly to S3
Make a
PUT request to the uploadUrl with the file as the request body and the Content-Type header set to the same MIME type you specified. No authentication header is needed for this request — the signature is embedded in the URL.Reference s3Url in your post
Use the returned
s3Url and s3Key in the content.mediaItems array when calling Create Post or Update Post.Request body
MIME type of the file to upload. Accepted values:
image/pngimage/jpegimage/jpgimage/webpvideo/mp4video/quicktime
Response
true on success."Upload URL generated"Examples
Example response — Step 1
200
The
uploadUrl contains an AWS signature and expires after a short window. Do not cache it for later use — generate a new URL for each upload.Error responses
400 Unsupported media type
