Temp Mail API

API for creating temporary email accounts

The general quota limit is 8 queries per second (QPS) per IP address.
Keep in mind that no API keys are required to use our service.

How it works

Fetch our domain names.
Create a new account by using our domain names.
Sign up only on sites that you have acquired permission to.
The site sends an email message to the address you specify.
A message comes to our SMTP server, processed and added to the database.
You make a request to the API to fetch the message list.
That's it.

API Documentation

Base url: https://api.temp-mail.solutions

Error handling

Successful

Generally, the request is successful when the response code is 200

Unsuccessful

Usually, when the request has an error the code is 403 or 401.

Unauthorized 401: Your token isn't correct (Or the headers hasn't a token at all!). Remember, every request (Except POST /accounts and POST /token) should be authenticated with a Bearer token!

In every request!

Remember: You should first create the email and then get the token!***

Authentication

POST `/api/register`

This endpoint allows the account to register by sending a POST request with the user's email and password.

Body

{
    "username": "string",
    "domain": "string",
    "password": "string",
}
  • username (string, required): The username of the email account.
  • domain (string, required): The domain of the mail server is retrieved from the GET API endpoint api/domain.
  • password (string, required): The password for the email account.

Response

{
  "data": [
    {
      "user_name": "string",
      "email": "string",
      "created_at": "string",
      "updated_at": "string",
    }
  ]
}

POST `/api/login`

This endpoint allows the user to log in by sending a POST request to the specified URL

Body

{
    "email": "string",
    "password": "string",
}
  • email (string, required): The email of the account.
  • password (string, required): The password for the account.

Response

{
  "data": [
    {
      "access_token": "string",
      "message": "string",
    }
  ]
}

Domain

GET `/api/domain`

This endpoint allows you to retrieve domain information.

Body

None

Response

{
  "data": [
    {
      "id": "int",
      "domain": "string",
      "active": "bool",
      "created_at": "string",
      "updated_at": "string",
      "deleted_at": string,
    }
  ]
}

When you create an email, you have to know first which domain to use.

Email

GET `/api/email`

The GET API request is used to generate a new random email. The response will return the email, password, and access token of the generated email.

Body

none

Response

{
  "data": [
    {
      "email": "int",
      "password": "string",
      "token": "string",
    }
  ]
}

DELETE `/api/email`

This API is used to delete an email account. It requires authentication by passing the Bearer token in the header with the key 'Authorization'.

Header

{
    "Authorization": "Bearer {token}",
}

The Bearer token is obtained from the POST `/api/login` endpoint.

Body

none

Response

{
  "data": [
    {
      "success": "string",
    }
  ]
}

Mail

GET `/api/mail`

This API is used to retrieve the list of emails in the email account. Authentication is required by passing the Bearer token in the header with the key 'Authorization'.

Header

{
    "Authorization": "Bearer {token}",
}

The Bearer token is obtained from the POST `/api/login` endpoint.

Body

none

Response

{
  "data": [
    {
      "id": "int",
      "h_mail": "string",
      "body": "string",
      "html": "string",
      "from": "string",
      "to": "string",
      "subject": "string",
      "new": "bool",
      "htmlEmbedded": "string",
      "created_at": "string",
      "updated_at": "string",
      "deleted_at": string,
    }
  ]
}

GET `/api/mail/{h_mail}`

The GET API /api/mail/{h_mail} is used to retrieve the content of an mail based on its h_mail. Replace {h_mail} with the actual id of the mail. Authentication is required by passing the Bearer token in the header with the key 'Authorization'. The Bearer token is obtained from the /api/login endpoint.

Header

{
    "Authorization": "Bearer {token}",
}

The Bearer token is obtained from the POST `/api/login` endpoint.

Body

none

Response

{
  "data": [
    {
      "id": "int",
      "h_mail": "string",
      "body": "string",
      "html": "string",
      "from": "string",
      "to": "string",
      "subject": "string",
      "new": "bool",
      "htmlEmbedded": "string",
      "created_at": "string",
      "updated_at": "string",
      "deleted_at": string,
    }
  ]
}

DELETE `/api/mail/{h_mail}`

The DELETE API /api/mail/{h_mail} is used to delete an email based on its h_mail. Replace {h_mail} with the actual id of the email. Authentication is required by passing the Bearer token in the header with the key 'Authorization'. The Bearer token is obtained from the /api/login endpoint.

Header

{
    "Authorization": "Bearer {token}",
}

The Bearer token is obtained from the POST `/api/login` endpoint.

Body

none

Response

{
  "data": [
    {
      "success": "string",
    }
  ]
}

Questions and suggestions

If you have any questions or suggestions, please contact us via email [email protected].