For file uploads greater than 10 MB, obtain a presigned URL to upload a file.
Maximum file upload size 5 GB.
Upload presigned URL valid for 30 minutes after being generated.
Access URL available for 30 days after uploaded. All published posts are unaffected at the
social networks. Scheduled posts beyond that time frame will result in errors at time of
publishing.
If you already have your media accessible by an external URL, such as an S3 bucket, you can skip uploading the files to Ayrshare. Just POST to the /post endpoint with your externally accessible URL in the mediaURLs body parameter and your file will automatically be uploaded.
If the contentType is not present, then a full file name with extension is required.Name of the file to be uploaded. Must include an extension such as .png, .jpg, .mov, .mp4, etc.
The content-type of the media being uploaded. Valid formats include: mp4, mov, png, jpg, or jpeg.For example, if the file is a Quicktime .mov file, then the contentType should be mov.If not present, application/octet-stream will be used.
Copy
Ask AI
curl \-H "Authorization: Bearer [API Key]" \-X GET https://api.ayrshare.com/api/media/uploadUrl?fileName=test.mov&contentType=mov
Obtain an uploadURL and accessURL via the /media/uploadUrl endpoint. Please see above.
Upload the file via a PUT with Content-Type set to the returned contentType.
Upload the media by using the --upload-file with a media file and the uploadUrl.
On a successful upload, a 200 response will be returned.
After uploading the media file, POST to the /post endpoint with the accessUrl in the
mediaUrls body parameter.
The presigned upload URL may only be uploaded to once. If you sent a bad file you must
create a new upload URL. No error response will occur if the file is not successfully uploaded.
See below of verifying the URL exists.
Copy
Ask AI
curl -X PUT \-H 'Content-Type: video/mp4' \--upload-file LOCAL_FILE_PATH uploadUrl
Please be sure that the contentType set when creating the uploadUrl matches the Content-Type and the file type when PUTing the file.
For example, if you set the contentType to “image/png” when creating the uploadUrl, be sure to set the Content-Type: image/png and the uploaded file ends in .png.On a successful upload, a 200 response will be returned.
You may also use Postman to upload the binary file to the uploadUrl.In Postman:
Select the HTTP Method PUT.
Paste your uploadUrl in the url field. Note, the url will expire after an hour and may only be used once. If you make a call and it fails, you must regenerate the uploadUrl.
In Headers set the Content-Type to be the content type returned in the /uploadUrl endpoint. For example: Content-Type: image/png.
Select Body -> binary and select the file to upload.
Press Send.
Important: No return response will occur, so you should check if the upload was successful by opening the accessUrl returned from the /uploadUrl endpoint in a browser. You may also use the verify URL endpoint.