API Documentation


UPLOAD

You send us files with POST and we will store them and return an url for you in JSON.

Request Example

curl -F "file=@test.txt" https://api.megaupload.nz/upload

Successful Response

{
    "status": true,
    "data": {
        "file": {
            "url": {
                "full": "https://megaupload.nz/u1C0ebc4b0/file.txt",
                "short": "https://megaupload.nz/u1C0ebc4b0"
            },
            "metadata": {
                "id": "u1C0ebc4b0",
                "name": "file.txt",
                "size": {
                    "bytes": 6861,
                    "readable": "6.7 KB"
                }
            }
        }
    }
}

Error Response

{
    "status": false,
    "error": {
        "message": "The file is too large. Max filesize: 5 GiB",
        "type": "ERROR_FILE_SIZE_EXCEEDED",
        "code": 31
    }
}

Error Codes & Types

  • (10) ERROR_FILE_NOT_PROVIDED
  • (11) ERROR_FILE_EMPTY
  • (12) ERROR_FILE_INVALID
  • (20) ERROR_USER_MAX_FILES_PER_HOUR_REACHED
  • (21) ERROR_USER_MAX_FILES_PER_DAY_REACHED
  • (22) ERROR_USER_MAX_BYTES_PER_HOUR_REACHED
  • (23) ERROR_USER_MAX_BYTES_PER_DAY_REACHED
  • (30) ERROR_FILE_DISALLOWED_TYPE
  • (31) ERROR_FILE_SIZE_EXCEEDED
  • (32) ERROR_FILE_BANNED
  • (40) STATUS_ERROR_SYSTEM_FAILURE

INFO

You can send us a GET request to grab info about a file. We respond with a JSON array.
Hint: Use the "status" key (true/false) if you want to check if a file exists.
Also, if the requested file does not exist, the response will be sent as a 404.

The URL format is:

https://api.megaupload.nz/v2/file/{id}/info

Example Request

https://api.megaupload.nz/v2/file/u1C0ebc4b0/info

INFO Response

{
    "status": true,
    "data": {
        "file": {
            "url": {
                "full": "https://megaupload.nz/u1C0ebc4b0/file.txt",
                "short": "https://megaupload.nz/u1C0ebc4b0"
            },
            "metadata": {
                "id": "u1C0ebc4b0",
                "name": "file.txt",
                "size": {
                    "bytes": 6861,
                    "readable": "6.7 KB"
                }
            }
        }
    }
}

Info Error Response

{
    "status": false,
    "error": {
        "message": "The file you are looking for does not exist.",
        "type": "FILE_NOT_FOUND",
        "code": 404
    }
}