Creates a short URL

POST /

Creates a short URL to the given target

application/json

Body

  • url string(url) Required
  • files array[object]

    The files to upload

    Hide files attributes Show files attributes object
    • name string

      Name of the file (including the extension), randomly generated if not provided

    • content string Required

      Base64 encoded file content

  • name string

    Name of the short URL to use after https://sh0rt.zip/

    Default value is <4 random characters>.

  • date string(date-time)

    When to delete the short URL. Must be parseable using JavaScripts Date() function.

    Default value is <five days from now>.

Responses

  • 201 application/json

    Short URL was created successfully at the given name.

    Hide response attributes Show response attributes object
    • uri string

      Full URL of the created short URL, if a URL was provided

    • name string Required

      Name of the created short URL to use after https://sh0rt.zip/

    • files array[object]

      The file path of a file that was uploaded

      Hide files attributes Show files attributes object
      • uri string Required

        The full URI to the file

      • name string Required

        The file name of the file

      • expires string(date-time) Required

        When the file will be deleted

  • 400 application/json

    Invalid input which prevents the short URL from being created, in this case a missing url.

    Hide response attribute Show response attribute object
    • error string Required

      Value is missingurlbody.

  • 409 application/json

    There is already a short URL with that name.

    Hide response attribute Show response attribute object
    • error string Required

      Value is name_alreadyexists.

  • 413 application/json

    The total file size or the one of a single file in the payload is too large.

    Hide response attributes Show response attributes object
    • error string Required

      Values are file_too_large or files_too_large.

    • limit number Required

      The maximum file/total size in bytes, depending on the error.

  • 422 application/json

    Invalid input which prevents the short URL from being created, such as an invalid URL or a redirect loop.

    Hide response attribute Show response attribute object
    • error string Required

      Values are name_invalid, name_blacklisted, or url_invalid.

POST /
curl \
 -X POST https://sh0rt.zip/ \
 -H "Content-Type: application/json" \
 -d '{"url":"https://github.com/DEVTomatoCake/Bundbot","files":[{"name":"index.js","content":"data:application/text;base64,\u003cbase64 encoded content\u003e"}],"name":"bundbot","date":"2024-05-24T14:58:26.710Z"}'
Request example
{
  "url": "https://github.com/DEVTomatoCake/Bundbot",
  "files": [
    {
      "name": "index.js",
      "content": "data:application/text;base64,<base64 encoded content>"
    }
  ],
  "name": "bundbot",
  "date": "2024-05-24T14:58:26.710Z"
}
Response examples (201)
{
  "uri": "https://sh0rt.zip/bundbot",
  "name": "bundbot",
  "files": [
    {
      "uri": "file/bundbot/index.js",
      "name": "index.js",
      "expires": "2024-05-24T14:58:26.710Z"
    }
  ]
}
Response examples (400)
{
  "error": "missingurlbody"
}
Response examples (409)
{
  "error": "name_alreadyexists"
}
Response examples (413)
{
  "error": "file_too_large",
  "limit": 5242880
}
Response examples (422)
{
  "error": "name_invalid"
}