tether developers
Contents

API reference

Files

Uploading, downloading and refreshing links to files.

Request Attachment Uploads

POST/channels/{channel.id}/attachmentsPeople and botstether only

Step 1 of tether's two-step upload: ask for an address to PUT each file to.

The web app uses this flow; bots can use it or send files as multipart/form-data (see Files). PUT the raw bytes to each upload_url, then pass uploaded_filename: upload_filename in the message's attachments. Uploads nobody claims are deleted after an hour.

Permissions needed

SEND_MESSAGESbit 2048
Send messages
ATTACH_FILESbit 32768
Attach files

Path parameters

channel.id
A snowflake id.

Body

application/json

filesarray of object · 1 to 10 itemsrequired
files[].idstring | integer · max 32 charactersrequired
files[].filenamestring · 1 to 255 charactersrequired
files[].file_sizeinteger · min 1required

Example request

{
  "files": [
    {
      "id": 0,
      "filename": "cat.png",
      "file_size": 48213
    }
  ]
}

Response

200 APIAttachmentUploads

{
  "attachments": [
    {
      "id": 0,
      "upload_url": "https://chat.example.com/api/v1/uploads/abc123?signature=…",
      "upload_filename": "abc123/cat.png"
    }
  ]
}

Errors

UNKNOWN_CHANNEL10003 · HTTP 404
The channel does not exist, or you are not in its server.
MISSING_ACCESS50001 · HTTP 403
You are in the server but cannot see the channel (VIEW_CHANNEL).
MISSING_PERMISSIONS50013 · HTTP 403
You lack a permission the route needs.
FILE_TOO_LARGE50045 · HTTP 400
A file is larger than MAX_UPLOAD_BYTES (25 MiB by default).
CANNOT_SEND_IN_NON_TEXT_CHANNEL50008 · HTTP 400
The channel takes no messages.

Rate limits

attachmentRequestPerUserbucket 444e6567
30 per 60 seconds, counted per user. See Rate limits.

Discord

Only on tether: Discord has no such route.

Discord has a similar two-step flow for its own clients (/attachments).

Download Attachment

GET/channels/{channel.id}/attachments/{attachment.id}/{filename}No sign-in needed

The file itself. Send your token, or use a signed link from Refresh Attachment URLs.

There is no public CDN. A person gets attachments[].url as this path, relative to the API origin; a bot gets it as an absolute link already signed for an hour (?ex=&is=&hm=), which opens the file without signing in (so Attachment.read() works). The file is served with the type read from its bytes.

Who can call it

  • No sign-in is needed (public).
  • A person, with a session token.
  • A bot, with its token.

Permissions needed

READ_MESSAGE_HISTORYbit 65536
Read message history

Path parameters

channel.id
A snowflake id.
attachment.id
A snowflake id.
filename
The file name as in the message (URL-encoded).

Response

200 no body

The file's bytes.

Errors

GENERAL0 · HTTP 404
There is no such attachment (404: Not Found).
UNKNOWN_CHANNEL10003 · HTTP 404
The channel does not exist, or you are not in its server.
MISSING_ACCESS50001 · HTTP 403
You are in the server but cannot see the channel (VIEW_CHANNEL).
MISSING_PERMISSIONS50013 · HTTP 403
You lack a permission the route needs.

Discord

Like Discord’s Attachment URLs, with differences.

Not a public CDN link: it needs your token or a signed link.

Refresh Attachment URLs

POST/attachments/refresh-urlsPeople and bots

Signed links (valid for an hour) for attachments you can read, to open outside the app.

A link that is not one of this server's attachments, or one you cannot read, is left out of the answer.

Body

application/json

attachment_urlsarray of string · 1 to 50 itemsrequired

Example request

{
  "attachment_urls": [
    "/api/v1/channels/107441200000000010/attachments/107441200000000700/cat.png"
  ]
}

Response

200 APIRefreshedAttachmentUrls

{
  "refreshed_urls": [
    {
      "original": "/api/v1/channels/107441200000000010/attachments/107441200000000700/cat.png",
      "refreshed": "/api/v1/channels/107441200000000010/attachments/107441200000000700/cat.png?ex=6540a3c0&is=653e3d40&hm=8f2c…"
    }
  ]
}

Errors

INVALID_FORM_BODY50035 · HTTP 400
A field is missing, the wrong type or outside its limits.

Discord

The same as Discord’s Refresh Attachment URLs.