API Documentation

API Endpoint

All URIs below are relative to https://mng.waifu2x.me/api/


API Key

Your API key: Login


Methods

Methods
instance/list GET /api/instance/list
Returns a list of instances.
instance/status GET /api/instance/status
Gets the latest state of instance.
instance/start POST /api/instance/start
Start the specified instance.
instance/stop POST /api/instance/stop
Stops the specified instance.
instance/reset POST /api/instance/reset
Resets the specified instance.
file/convert POST /api/file/convert
Converts the specified file.
file/list GET /api/file/list
Returns a list of convert files.
file/status GET /api/file/status
Gets the latest state of convert file.
file/delete POST /api/file/delete
Delete the specified file.
file/bulk-delete POST /api/file/bulk-delete
Delete all conversion files.

Method: instance/list

HTTP request

GET https://mng.waifu2x.me/api/instance/list

Query parameters

Parameters
apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl "https://mng.waifu2x.me/api/instance/list?apikey={$apikey}"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/instance/list?apikey={$apikey}",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :get, url: 'https://mng.waifu2x.me/api/instance/list?apikey={$apikey}')
puts response

Python Example

import requests
response = requests.get('https://mng.waifu2x.me/api/instance/list?apikey={$apikey}')
print(response.json())

Response

JSON representation
{
    "state": 1,
    "total": "1",
    "instances": [
        {
            "id": "0",
            "name": "GRID K520 x 1",
            "type": "GRID K520 x 1 (Require $0.03 credit / 1 minute)",
            "num": "1",
            "status": "stopped",
            "run_datetime": "2018-04-01 00:00:00",
            "expire_datetime": "2018-04-02 00:00:00",
            "reg_datetime": "2018-04-01 00:00:00",
            "up_datetime": "2018-04-01 00:00:00"
        }
    ]
}
                                            

Method: instance/status

HTTP request

GET https://mng.waifu2x.me/api/instance/status

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl "https://mng.waifu2x.me/api/instance/status?id={$id}&apikey={$apikey}"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/instance/status?id={$id}&apikey={$apikey}",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :get, url: 'https://mng.waifu2x.me/api/instance/status?id={$id}&apikey={$apikey}')
puts response

Python Example

import requests
response = requests.get('https://mng.waifu2x.me/api/instance/status?id={$id}&apikey={$apikey}')
print(response.json())

Response

JSON representation
{
    "state": 1,
    "instance": {
        "id": "0",
        "name": "GRID K520 x 1",
        "type": "GRID K520 x 1 (Require $0.03 credit / 1 minute)",
        "num": "1",
        "status": "stopped",
        "run_datetime": "2018-04-01 00:00:00",
        "expire_datetime": "2018-04-02 00:00:00",
        "reg_datetime": "2018-04-01 00:00:00",
        "up_datetime": "2018-04-01 00:00:00"
    },
    "enabledRunning": true
}
                                            

Method: instance/start

HTTP request

POST https://mng.waifu2x.me/api/instance/start

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} "https://mng.waifu2x.me/api/instance/start"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/instance/start",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/instance/start',
    payload: {
        'id' => id,
        'apikey' => apikey,
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/instance/start',
    params={
        'id': id,
        'apikey': apikey,
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "status": "standby"
}
                                            

Method: instance/reset

HTTP request

POST https://mng.waifu2x.me/api/instance/reset

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} "https://mng.waifu2x.me/api/instance/reset"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/instance/reset",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/instance/reset',
    payload: {
        'id' => id,
        'apikey' => apikey,
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/instance/reset',
    params={
        'id': id,
        'apikey': apikey,
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "status": "standby"
}
                                            

Method: instance/stop

HTTP request

POST https://mng.waifu2x.me/api/instance/stop

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

mail

integer

Optional
Option to send conversion completion email.

  • Don't send: 0 (default)
  • Send: 1

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} "https://mng.waifu2x.me/api/instance/stop"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/instance/stop",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/instance/stop',
    payload: {
        'id' => id,
        'apikey' => apikey,
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/instance/stop',
    params={
        'id': id,
        'apikey': apikey,
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "status": "stopped"
}
                                            

Method: file/convert

HTTP request

POST https://mng.waifu2x.me/api/file/convert

Query parameters

Parameters
id

integer

Required
The instance id.

file

binary

Required
The convert file (jpg, png)

style

string

Required
The convert option: Style

  • Artwork: "art"
  • Photo: "photo"
noise

integer

Required
The convert option: Noise Reduction (expect JPEG Artifact)

  • None: -1
  • Low: 0
  • Medium: 1
  • High: 2
  • Highest: 3
scale

integer

Required
The convert option: Upscaling (0 - 10)

comp

integer

Required
The convert option: Compression (0 - 10)

apikey

string

Required
A valid API key to handle requests for this API.

wait

integer

Optional
Option to wait for file conversion completion.

  • Don't wait: "0" (default)
  • Wait: "1"

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} -F style={$style} -F noise={$noise} -F scale={$scale} -F comp={$comp} -F "file=@{$filepath}" "https://mng.waifu2x.me/api/file/convert"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/file/convert",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
        'style' => $style,
        'noise' => $noise,
        'scale' => $scale,
        'comp' => $comp,
        'file' => new CURLFile($filepath),
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/file/convert',
    payload: {
        'id' => id,
        'apikey' => apikey,
        'style' => style,
        'noise' => noise,
        'scale' => scale,
        'comp' => comp,
        'file' => File.new(filepath),
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/file/convert',
    params={
        'id': id,
        'apikey': apikey,
        'style': style,
        'noise': noise,
        'scale': scale,
        'comp': comp,
        'file': open(filepath, 'rb'),
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "id": "0",
    "src": "https://mng.waifu2x.me/fixtures/0/1/2/sample.png"
}
                                            

Method: file/list

HTTP request

GET https://mng.waifu2x.me/api/file/list

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl "https://mng.waifu2x.me/api/file/list?id={$id}&apikey={$apikey}"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/file/list?id={$id}&apikey={$apikey}",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :get, url: 'https://mng.waifu2x.me/api/file/list?id={$id}&apikey={$apikey}')
puts response

Python Example

import requests
response = requests.get('https://mng.waifu2x.me/api/file/list?id={$id}&apikey={$apikey}')
print(response.json())

Response

JSON representation
{
    "state": 1,
    "total": 1,
    "files": [
        {
            "id": "0",
            "name": "sample.png",
            "status": "waiting",
            "size": 123456,
            "type": "image/png",
            "src": "https://mng.waifu2x.me/fixtures/0/1/2/sample.png",
            "params": {
                "id": "0",
                "fpath": "0/1/2/sample.png",
                "method": "convert",
                "style": "art",
                "noise": "0",
                "scale": "2",
                "comp": "0",
                "mail": null
            },
            "reg_datetime": "2018-04-01 00:00:00",
            "up_datetime": "2018-04-01 00:00:00"
        }
    ]
}
                                            

Method: file/status

HTTP request

GET https://mng.waifu2x.me/api/file/status

Query parameters

Parameters
id

integer

Required
The file id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl "https://mng.waifu2x.me/api/file/status?id={$id}&apikey={$apikey}"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/file/status?id={$id}&apikey={$apikey}",
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :get, url: 'https://mng.waifu2x.me/api/file/status?id={$id}&apikey={$apikey}')
puts response

Python Example

import requests
response = requests.get('https://mng.waifu2x.me/api/file/status?id={$id}&apikey={$apikey}')
print(response.json())

Response

JSON representation
{
    "state": 1,
    "file": {
        "id": "0",
        "name": "sample.png",
        "status": "running",
        "size": 123456,
        "type": "image/png",
        "src": "https://mng.waifu2x.me/fixtures/0/1/2/sample.png",
        "params": {
            "id": "74",
            "fpath": "0/1/2/sample.png",
            "method": "convert",
            "style": "art",
            "noise": "0",
            "scale": "2",
            "comp": "0",
            "mail": null
        },
        "reg_datetime": "2018-04-01 00:00:00",
        "up_datetime": "2018-04-01 00:00:00"
    }
}
                                            

Method: file/delete

HTTP request

POST https://mng.waifu2x.me/api/file/delete

Query parameters

Parameters
id

integer

Required
The file id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} "https://mng.waifu2x.me/api/file/delete"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/file/delete",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/file/delete',
    payload: {
        'id' => id,
        'apikey' => apikey,
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/file/delete',
    params={
        'id': id,
        'apikey': apikey,
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "file": {
        "id": "0",
        "name": "sample.png",
        "status": "deleted",
        "size": 123456,
        "type": "image/png",
        "src": "https://mng.waifu2x.me/fixtures/0/1/2/sample.png",
        "params": {
            "id": "74",
            "fpath": "0/1/2/sample.png",
            "method": "convert",
            "style": "art",
            "noise": "0",
            "scale": "2",
            "comp": "0",
            "mail": null
        },
        "reg_datetime": "2018-04-01 00:00:00",
        "up_datetime": "2018-04-01 00:00:00"
    }
}
                                            

Method: file/bulk-delete

HTTP request

POST https://mng.waifu2x.me/api/file/bulk-delete

Query parameters

Parameters
id

integer

Required
The instance id.

apikey

string

Required
A valid API key to handle requests for this API.

CURL Example

curl -X POST -F id={$id} -F apikey={$apikey} "https://mng.waifu2x.me/api/file/bulk-delete"

PHP Example

$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL         => "https://mng.waifu2x.me/api/file/bulk-delete",
    CURLOPT_POST        => true,
    CURLOPT_POSTFIELDS  => [
        'id' => $id,
        'apikey' => $apikey,
    ],
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_RETURNTRANSFER => true,
]);
$result = curl_exec($ch);
$response = json_decode($result, true);
print_r($response);
curl_close($ch);

Ruby Example

require 'rest_client'
response = RestClient::Request.execute(method: :post, url: 'https://mng.waifu2x.me/api/file/bulk-delete',
    payload: {
        'id' => id,
        'apikey' => apikey,
    }
)
puts response

Python Example

import requests
response = requests.post(
    'https://mng.waifu2x.me/api/file/bulk-delete',
    params={
        'id': id,
        'apikey': apikey,
    }
)
print(response.json())

Response

JSON representation
{
    "state": 1,
    "total": 1,
    "files": [
        {
            "id": "0",
            "name": "sample.png",
            "status": "deleted",
            "size": 123456,
            "type": "image/png",
            "src": "https://mng.waifu2x.me/fixtures/0/1/2/sample.png",
            "params": {
                "id": "0",
                "fpath": "0/1/2/sample.png",
                "method": "convert",
                "style": "art",
                "noise": "0",
                "scale": "2",
                "comp": "0",
                "mail": null
            },
            "reg_datetime": "2018-04-01 00:00:00",
            "up_datetime": "2018-04-01 00:00:00"
        }
    ]
}