create_upload_url
Start an upload for a file this server does not hold, and get back a URL to send the bytes to. Two steps are needed: PUT the bytes to the returned URL with exactly the headers it gives you, then call complete_upload with the id it returns. The link does not work until both have happened. The upload URL is valid for five minutes. If it lapses before the bytes land, call this again for a fresh one rather than reusing the id. size_bytes has to be the exact number of bytes you are about to upload, because it is signed into the URL and storage refuses a body of any other length. Use share_text instead when you already hold the text and want it published in a single call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | The name to store the file under, including its extension. Up to 200 characters. | |
| size_bytes | Yes | The exact number of bytes you are about to upload, as a whole number. This is signed into the upload URL, so a PUT whose body is even one byte longer or shorter is refused by storage. Measure the file rather than estimating. | |
| content_type | Yes | The MIME type of the bytes you are about to upload, such as application/pdf or image/png. Send this exact value as the Content-Type header on the PUT. Storage does not check it, so nothing will refuse a PUT that sends a different one. Send it anyway. This value is stored as the file's type and decides how the link serves the file, and a file stored as something its bytes are not is served wrongly. | |
| desired_slug | No | Optional. A preferred short name for the public link. It is cleaned up and checked on the server, and one that is taken or unusable is replaced with a random one rather than failing the call. The reply always names the slug that was actually assigned. |