Temp Mail API
API for creating temporary email accounts
How it works
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!
Authentication
`/api/register`
POST 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",
}
]
}
`/api/login`
POST 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
`/api/domain`
GET 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.
`/api/email`
GET 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",
}
]
}
`/api/email`
DELETE 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",
}
]
}
`/api/mail`
GET 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,
}
]
}
`/api/mail/{h_mail}`
GET 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,
}
]
}
`/api/mail/{h_mail}`
DELETE 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].