Upload a file

Upload a single file and get the corresponding URI.

POST https://omegaletter.chat/api/v1/user_uploads

Usage examples

#!/usr/bin/env python3

import zulip

# Download ~/zuliprc-dev from your dev server
client = zulip.Client(config_file="~/zuliprc-dev")

# Upload a file
# (Make sure that 'fp' is a file object)
result = client.call_endpoint(
    'user_uploads',
    method='POST',
    files=[fp]
)
print(result)

Arguments

Argument Example Required Description
file See code examples above. Required

File to be uploaded.

Maximum file size

The maximum file size for uploads can be configured by the administrator of the Zulip server by setting MAX_FILE_UPLOAD_SIZE in the server's settings. MAX_FILE_UPLOAD_SIZE defaults to 25MB.

Response

Return values

  • uri: The URI of the uploaded file.

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "uri": "/user_uploads/1/4e/m2A3MSqFnWRLUf9SaPzQ0Up_/zulip.txt"
}