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
Vous pouvez également parcourir depuis votre ordinateur.
Vous pouvez également browse from device ou use camera.
JPG JPEG PNG GIF WEBP MOV MP4 WEBM max 100 MB
Personnalisez le téléchargement en cliquant sur n'importe quel aperçu
Personnalisez le téléchargement touchant sur n'importe quel aperçu
Vous pouvez également parcourir depuis votre ordinateur.
Vous pouvez également browse from device ou use camera.
Importation 0 fichiers (0% complété)
La liste est en cours d'importation, il ne reste que quelques secondes !
Envoi terminé
Contenu importé ajouté à . Vous pouvez créer un nouvel album avec le contenu que vous venez de mettre en ligne.
Contenu importé ajouté à .
Vous pouvez créer un nouvel album avec le contenu que vous venez de mettre en ligne. Vous pouvez créer un compte ou se connecter pour sauvegarder ce contenu dans votre compte.
Aucun fichier n'a été mis en ligne
Certaines erreurs se sont produites et le système n'a pas pu traiter votre demande.
    ou annulerannuler la file
    Remarque : Certains fichiers n'ont pas pu être téléchargés. en savoir plus
    Regardez le rapport d'erreur pour plus d'informations.