AnonyMail RESTful API

The AnonyMail API is organized around REST. The API accepts JSON-encoded request bodies and returns JSON-encoded responses. The API uses standard HTTP response codes and HTTP Basic Auth.

Base url: https://api.anonymail.pro


Authentication

Example API key: 1234567890

You need to login or register to be able to generate an API key.

For HTTP Basic Auth, use your email address as your username and your API key as your password. Most client software provides a simple mechanism for supplying a username and password that it then uses to build the required authentication headers automatically. For example, you can specify the -u argument with cURL as follows:

curl -u [email protected]:1234567890 https://api.anonymail.pro/v1/auth 

If you need to, you may construct and send basic auth headers yourself. To do this you need to perform the following steps:
1. Create a string with the format email:api_key, and base-64 encode this string.
2. Supply an Authorization header with content Basic followed by the encoded string.

For example, the string [email protected]:1234567890 encodes to c29tZW9uZUBleGFtcGxlLmNvbToxMjM0NTY3ODkw in base64, so you would make the request with cURL as follows:

curl -H "Authorization: Basic c29tZW9uZUBleGFtcGxlLmNvbToxMjM0NTY3ODkw" https://api.anonymail.pro/v1/auth 

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.


Errors

The API uses conventional HTTP response codes to indicate the success or failure of a request. In general:
-Codes in the 2xx range indicate success.
-Codes in the 4xx range indicate an error in the information provided.
-Codes in the 5xx range indicate an error with AnonyMail's servers.

Error types:
INVALID_AUTH: Invalid or missing HTTP Basic Auth data
NO_HTTPS_REQUEST: API Request was not sent via HTTPS
INVALID_CONTENT_TYPE: Content type is not set to JSON
METHOD_NOT_ALLOWED: Using the wrong request method
MISSING_ARGUMENTS: Not all required arguments provided
ALREADY_SENT: Email was already sent to this address*
INVALID_EMAIL: Invalid email address
INVALID_TOKEN: Invalid token
*Occurs when sending the same email to the same address more than once in 24 hours.


Endpoints


POST /v1/emails/option1

Sends an anonymous email using option 1, which means:
The email is sent from [email protected], and a link will be added which can be used to reply.

Arguments:

to string: 'to' address

message string: base-64 encoded message


Example request:

Content-Type: application/json
{
    "to": "[email protected]",
    "message": "SGVsbG8gV29ybGQh"
}

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "status": "success",
    "data": []
}

POST /v1/emails/option2

Sends an anonymous email using option 2, which means:
You can choose your own 'from' address, but you won't be able to get a reply.

Arguments:

from string: 'from' address

to string: 'to' address

subject string: base-64 encoded subject

message string: base-64 encoded message


Example request:

Content-Type: application/json
{
    "from": "[email protected]",
    "to": "to", (Invalid)
    "subject": "RXhhbXBsZQ==",
    "message": "SGVsbG8gV29ybGQh"
}

Example response:

HTTP/1.1 400 Bad Request
Content-Type: application/json
{
    "status": "error",
    "data": {
        "info": "Invalid 'to' address",
        "error_code": "INVALID_EMAIL"
    }
}