API version 1.1

We now support more upload parameters for user API keys, including title, width, and more!

Our public API has some limitations, such as a maximum upload size of 20MB per image and the inability to manage or delete images after they have been uploaded.

Therefore, we encourage you to use our private API, which offers a maximum image size of 50MB and allows you to manage your images. Click the button below to go to the API access page.

Request method

You have the option of using POST or GET requests for API v1.1 calls. Since GET requests have URL length restrictions, it's usually better to go with the POST method.

Request URL

 

Authorization

API V1.1 supports header-based authorization by passing the X-API-Key header with your API key.


Parameters

Required Parameters

Name Description
source FILES["source"] or a base64 (opens new window) encoded image string..
key The API key

Optional Parameters

Name Description
title Image title
description Image description
album_id Image album id, must be owned by the user (encoded string)
category_id Category id (integer)
width Target resize width (automatic height)
expiration Expiration time to auto-delete the image
format Return format, values json, redirect, txt

Expiration table

Value Expires after
PT5M 5 minutes
PT15M 15 minutes
PT30M 30 minutes
PT1H 1 hour
PT3H 3 hours
PT6H 6 hours
PT12H 12 hours
P1D 1 day
P2D 2 days
P3D 3 days
P4D 4 days
P5D 5 days
P6D 6 days
P1W 1 week
P2W 2 weeks
P3W 3 weeks
P1M 1 month
P2M 2 months
P3M 3 months
P4M 4 months
P5M 5 months
P6M 6 months
P1Y 1 year

Example call

POST https://anh.moe/api/1/upload/?key=YOUR_API_KEY&source=FILES["source"]&format=json

Important: Always use POST requests for uploading local files. URL encoding can corrupt Base64-encoded image data due to character conversion or GET request length limits.

API response

The API will provide different types of answers depending on the format parameter.

Format Output
json Image upload info in JSONformat (default)
txt Image direct URL in text/plain format
redirect Redirects to the image viewer URL

API v1 responses provide the complete details of an uploaded image in JSON format.

The JSON response will include header status codes, making it easy to determine if the image upload request was successful or encountered an error. The response will also contain status properties for more specific information.

Example response (JSON)

Example response (txt)

https://cdn.anh.moe/c/example.jpeg
Customize upload by clicking on any preview
Customize upload by touching on any preview
Đang tải lên 0 files (0% Hoàn tất)
Danh sách đang được tải lên, nó có thể mất đôi chút thời gian để hoàn thành.
Upload xong rồi!
Đã tải nội dung lên . You can create new album with the content just uploaded.
Đã tải nội dung lên .
You can create new album with the content just uploaded. You must tạo tài khoản or đăng nhập to save this content into your account.
No file have been uploaded
Some errors have occurred and the system couldn't process your request.
    Note: Some files couldn't be uploaded. xem tiếp
    Chọn thông báo lỗi để biết thêm chi tiết.