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
JPG JPEG PNG BMP GIF WEBP MOV MP4 max 100 MB
Customize upload by clicking on any preview
Customize upload by touching on any preview
Uploader 0 files (0% færdig)
Køen bliver uploadet, det tager kun få sekunder at fuldføre.
Upload gennemført
Uploadet indhold tilføjet til . Du kan create new album med indholdet lige uploadet.
Uploadet indhold tilføjet til .
Du kan create new album med indholdet lige uploadet. You must opret en konto or log ind to save this content into your account.
Ingen file er blevet uploadet
Some errors have occurred and the system couldn't process your request.
    Note: Some files couldn't be uploaded. se mere
    Check fejl rapporten for mere information.