Create pre-signed upload

This API generates a pre-signed URL for media uploads. It responds with information required to build a subsequent form data request to upload the media to an S3 bucket. Please refer to Examples below on how to use it.

Create a presigned media upload

post

Creates a pre-signed URL to upload media that can be used when sending messages in a conversation. The maximum fize size is 100MiB.

Authorizations
HTTPRequired

Uses the Authorization header: 'AccessKey ' followed by your access key token (e.g., 'Authorization: AccessKey AbCdEfGhIjKlMnOpQrStUvWxYzAbCdEfGhIj')

Path parameters
workspaceIdstring · uuidRequired

The workspace ID

Example: b4e02c85-c6d2-4b15-8885-e09671799c61
conversationIdstring · uuidRequired

The conversation ID

Example: 67e4d358-ca94-421e-98b7-448860df9d33
Body
contentTypestring · min: 1Required

The MIME type of the media being uploaded.

Example: image/png
Responses
chevron-right
200

OK

application/json
mediaUrlstring · uriRequired

The URL to use when sending messages with this media. Must be passed in the attachments object.

Example: https://media.api.bird.com/workspaces/f08a0fa2-5597-43af-9afb-9cf1015e5c7f/conversations/60c179e7-7e43-423b-bef2-14f4d0132b71/media/0c5e5552-fe12-4c4c-a39d-3604bb30aa81
uploadUrlstring · uriRequired

The URL to upload the media using form data encoding. The media must be sent with the field name file in addition to fields in uploadFormData.

Example: https://example-bucket.s3.eu-west-1.amazonaws.com
uploadMethodstringRequired

The method to use when uploading the media, will always be POST.

Example: POST
uploadFormDataobjectRequired

Form data fields that must be passed in addition to the field file when uploading the media to uploadUrl.

post
/workspaces/{workspaceId}/conversations/{conversationId}/presigned-upload

Examples

In the following example, we'll generate a pre-signed upload URL, then use it to upload media, and finally send a message with it:

  1. Generate URL

  1. Upload media to pre-signed URL

All of the fields in uploadFormData from the previous response need to be passed as form data string fields. Additionally, the field file must contain the media file you'd like to upload.

The response status is 204 (No Content).

  1. Send message with media

Last updated

Was this helpful?