# API tempmail.io free

# 1. Tạo hòm thư

curl --location --request POST 'https://api.internal.temp-mail.io/api/v3/email/new' \
--header 'Host: api.internal.temp-mail.io' \
--header 'authority: api.internal.temp-mail.io' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.9,vi;q=0.8' \
--header 'application-name: web' \
--header 'application-version: 2.2.29' \
--header 'origin: https://temp-mail.io' \
--header 'referer: https://temp-mail.io/' \
--header 'user-agent: Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.80 Mobile Safari/537.36' \
--header 'content-type: application/json' \
--header 'accept-encoding: gzip'
import requests
import json

url = "https://api.internal.temp-mail.io/api/v3/email/new"

payload = {}
headers = {
  'Host': 'api.internal.temp-mail.io',
  'authority': 'api.internal.temp-mail.io',
  'accept': 'application/json, text/plain, */*',
  'accept-language': 'en-US,en;q=0.9,vi;q=0.8',
  'application-name': 'web',
  'application-version': '2.2.29',
  'origin': 'https://temp-mail.io',
  'referer': 'https://temp-mail.io/',
  'user-agent': 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.80 Mobile Safari/537.36',
  'content-type': 'application/json',
  'accept-encoding': 'gzip'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

# Kết quả trả về

{
    "email": "[email protected]",
    "token": "cYN4ec2fgp5H1TFzmrL51"
}

# 2. Đọc danh sách hòm thư

curl --location 'https://api.internal.temp-mail.io/api/v3/email/YOUR_EMAIL/messages' \
--header 'Host: api.internal.temp-mail.io' \
--header 'authority: api.internal.temp-mail.io' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.9,vi;q=0.8' \
--header 'application-name: web' \
--header 'application-version: 2.2.29' \
--header 'origin: https://temp-mail.io' \
--header 'referer: https://temp-mail.io/' \
--header 'user-agent: Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.80 Mobile Safari/537.36' \
--header 'content-type: application/json' \
--header 'accept-encoding: gzip'
import requests
import json

url = f"https://api.internal.temp-mail.io/api/v3/email/{YOUR_EMAIL}/messages"

payload = {}
headers = {
  'Host': 'api.internal.temp-mail.io',
  'authority': 'api.internal.temp-mail.io',
  'accept': 'application/json, text/plain, */*',
  'accept-language': 'en-US,en;q=0.9,vi;q=0.8',
  'application-name': 'web',
  'application-version': '2.2.29',
  'origin': 'https://temp-mail.io',
  'referer': 'https://temp-mail.io/',
  'user-agent': 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.80 Mobile Safari/537.36',
  'content-type': 'application/json',
  'accept-encoding': 'gzip'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

# Kết quả trả về

[
  {
    id: "ba262966-9e80-4546-92dd-41d8098d9a4a",
    from: "from mail",
    to: "data",
    cc: null,
    subject: "data",
    body_text: "data",
    body_html: "html",
    created_at: "",
    attachments: [],
  },
];