How to use the TempMail API

Want to use the TempMail.lol API? Now you can! Check out our pre-made libraries or use the raw API.

Thank you to everyone who is using the TempMail.lol website. If you are a developer, you can use our API on your own platforms (as long as it isn’t your own TempMail site)!

The API for TempMail.lol is under the GNU AGPLv3 License.

Libraries

As of now, we have libraries for the following languages:

Raw API

Do we not have a library for your language yet? Feel free to reach out to me via email: [email protected] if you want your library added. In the meantime, you can use the raw API via HTTP requests to access our services.

The base URL should be stored as a constant. It is https://api.tempmail.lol

There are two endpoints currently. First, to generate emails, the /generate endpoint. Upon successfully generating an email, the server will return the following data:

{
    "address": "[email protected]",
    "token": "token_to_check_for_emails"
}

Afterwards, use the token to check for new emails.

Important

Inboxes expire after one hour, there is no avoiding this. If you do not check for new emails within 10 minutes of last check (or inbox creation) it will be deleted early.

To use the token to check for emails, GET the following endpoint: /auth/<token>

If you get an email (or multiple emails), you will be returned an array of email objects:

{
    "email": [
        {
            "from": "[email protected]",
            "to": "[email protected]",
            "subject": "sub",
            "body": "hi",
            "html": "this field may not be present",
            "date": 1652814863785
        },
        {
            "from": "someotheremail@address",
            "to": "[email protected]",
            "subject": "subject",
            "body": "hello",
            "html": "<b>hello</b>",
            "date": 1652814873785
        }
    ]
}

Note: once you get the emails, they are permanently deleted from our servers.

If there are no emails, the following response will be returned:

{
    "email": null
}

And finally, if your token is invalid, the following response will be returned:

{
    "email": null,
    "token": "invalid"
}

Conclusion

Let me know what you end up creating! I can be reached via email at [email protected]

You can also join the Discord server below by clicking the “connect” button: