Skip to content
Anya File Hosting Web
UploadAPI docsStatus
© 2026 Anya File Hosting. Your files stay encrypted.
UploadAPI docsStatusTerms & Conditions
Anya File Hosting Web
UploadAPI docsStatus
Open uploader
API reference

Anya File Hosting API

Upload a file and get a permanent direct link back. Every response is JSON and you do not need an API key.

Base URLhttps://anyafilehost.vercel.app
Getting startedOverview
EndpointsUpload a fileImport from a linkLarge filesOpen a file
ReferenceResponsesEncryptionAdmin accessGood to know

#Overview

Three endpoints cover most needs: upload a file, import one from a link, and open it again from its direct URL.

Fast

Cached delivery with support for range requests.

Private

Files are encrypted before they reach storage.

Simple

Plain JSON and nothing to configure.

  • POST/upload
    Multipart upload, up to about 4.5 MB per request.
  • GET/hosturl?url={media_url}
    Copy a file from a public link.
  • GET/{timestamp}.{ext}
    Open a stored file by its direct link.

#Upload a file

POST/upload

Send the file as multipart/form-data. Vercel limits one request body to about 4.5 MB, so use this for small files. For anything bigger, see Large files.

NameTypeRequiredDescription
filefileYesThe file to upload.
curl -X POST https://anyafilehost.vercel.app/upload \
  -F "file=@path/to/file.jpg"

#Import from a link

GET/hosturl?url={media_url}

We download the remote file on our server and store it for you. It works for files up to the 100 MB limit, which makes it handy for copying images that already live somewhere else.

NameTypeRequiredDescription
urlstringYesA public http or https link to the file. Remember to URL-encode it.
curl "https://anyafilehost.vercel.app/hosturl?url=https://example.com/image.jpg"

#Large files

The website cuts each file into pieces of at most 4,000,000 bytes, uploads every piece, and then asks the server to save the result. You can do the same from your own code, for files up to 100 MB.

POST/api/upload/chunk

The body is the raw bytes of one piece. Send x-upload-id (random, 8 to 64 characters, the same for every piece), x-chunk-index (0, 1, 2 and so on) and x-file-name (URL-encoded). You get back a signed record for that piece.

POST/api/upload/complete

Send JSON with { uploadId, name, type, meta?, chunks }, where chunks are the records from the step above. meta can hold width, height and duration. The response is the normal success JSON.

JavaScript
const CHUNK = 4_000_000;
const uploadId = crypto.randomUUID().replaceAll('-', '');
const chunks = [];

for (let i = 0; i * CHUNK < file.size; i++) {
  const res = await fetch('https://anyafilehost.vercel.app/api/upload/chunk', {
    method: 'POST',
    headers: {
      'x-upload-id': uploadId,
      'x-chunk-index': String(i),
      'x-file-name': encodeURIComponent(file.name),
    },
    body: file.slice(i * CHUNK, (i + 1) * CHUNK),
  });
  chunks.push(await res.json());
}

const done = await fetch('https://anyafilehost.vercel.app/api/upload/complete', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ uploadId, name: file.name, type: file.type, chunks }),
});
console.log((await done.json()).url);

#Open a file

GET/{timestamp}.{ext}

Every upload returns a direct link such as https://anyafilehost.vercel.app/1753020712833.png. Open it in a browser, put it in an <img> tag, or hot-link it anywhere. The file is decrypted as it is sent, and range requests work, so video and audio can seek. Types that can run code in a browser (html, js, css, xml and svg) always download.

#Responses

Success 200
{
  "data": "https://anyafilehost.vercel.app/1753020712833.png",
  "url": "https://anyafilehost.vercel.app/1753020712833.png",
  "id": "1753020712833.png",
  "filename": "sample.png",
  "size": 83638,
  "uploaded_on": "2025-07-20T14:11:52.833Z",
  "media_type": "image/png"
}
data and url
The direct link to the stored file.
id
The file key, which is the last part of the link.
filename
The original file name.
size
File size in bytes.
uploaded_on
Upload time as an ISO 8601 timestamp.
media_type
The MIME type of the file.
Error 4xx or 5xx
{
  "error": "Failed to download file from URL"
}

#Encryption

Every file is split into pieces and each piece is encrypted on our server before it is sent to Telegram. The pieces are saved with random names, so the people who can see the Telegram chat only find unreadable data.

When someone opens your link, the pieces are fetched, checked and decrypted on the fly. If a piece was changed in storage, the download stops instead of serving damaged data. Files uploaded before encryption was added keep working as they are.

#Admin access

The admin dashboard has its own sign in page at /admin. For scripts, the same routes also accept HTTP Basic credentials built from the USERNAME and PASSWORD environment variables.

GET/admin Needs sign in

Browse, preview, copy and delete everything that has been uploaded.

GET/admin/api/media?page=1&limit=100 Needs sign in
POST/delete-images Needs sign in
curl -X POST https://anyafilehost.vercel.app/delete-images \
  -u admin:YOUR_PASSWORD \
  -H "Content-Type: application/json" \
  -d '["https://anyafilehost.vercel.app/1753020712833.png"]'

#Good to know

  • Use POST /upload for small files and /hosturl for files that already exist online.
  • If the site owner turns on ENABLE_AUTH, uploads need the admin credentials too.
  • For each upload we keep the file name, size, type and, for images and video, the dimensions and duration.
© 2026 Anya File Hosting. Your files stay encrypted.
UploadAPI docsStatusTerms & Conditions