Direct Upload API

tiny[stash] Direct Upload API allows you to upload files using various HTTP libraries for programming languages or HTTP clients such as curl.

Examples

# Upload video (.mp4) file curl https://tinystash.undef.im/upload/file -H App-ID:example -H Content-Type:video/mp4 --data-binary @/path/to/video.mp4
# Upload text from pipe, get JSON response echo 'This is my first text upload' | curl https://tinystash.undef.im/upload/text -H App-ID:example -H Accept:application/json --data-binary @-
# Upload image via URL curl https://tinystash.undef.im/upload/url -H App-ID:example -d url=https://www.gnu.org/graphics/gnu-head.png

Endpoints

  • File uploads: https://tinystash.undef.im/upload/file
  • Text uploads: https://tinystash.undef.im/upload/text
  • URL uploads: https://tinystash.undef.im/upload/url

Common Headers

The following headers are used by all endpoints.

  • App-ID Required. An arbitrary string.
  • Accept Optional. Set to application/json to get a JSON response (plain text will be used otherwise).

File Upload

Endpoint

https://tinystash.undef.im/upload/file

Headers

  • Content-Length Required. The size of a body in bytes. Maximum file size is 20 MiB.
  • Content-Type Optional. The default value is application/octet-stream.

Body

Raw file content. Compressed or chunked transfer encodings are not supported.

Text Upload

Endpoint

https://tinystash.undef.im/upload/text

Headers

  • Content-Length Required. The size of a body in bytes. Maximum file size is 20 MiB.

Body

Text content. Compressed or chunked transfer encodings are not supported.

URL Upload

Endpoint

https://tinystash.undef.im/upload/url

Headers

  • Content-Type Required. One of:
    • application/json
    • application/x-www-form-urlencoded
    • text/plain

Body

  • JSON: {"url": "<URL>"}
  • URL-encoded form: url=<URL>
  • Plain text: <URL>

Maximum file size is 20 MiB.