Getting Started
Getting Started
Section titled “Getting Started”1. Create an API key
Section titled “1. Create an API key”Sign in to TempMailHush and create an API key from your account page.
https://tempmailhush.com/accountKeep the key private. API keys use the sk- prefix.
2. Create a mailbox
Section titled “2. Create a mailbox”curl -X POST https://tempmailhush.com/api/v1/mailboxes \ -H "X-API-Key: sk-your_api_key"The response includes the mailbox ID, generated address, expiration time, and polling hints.
3. Use the address
Section titled “3. Use the address”Submit the generated address to the flow you are testing. Keep the mailbox ID because message endpoints use it.
4. Poll for messages
Section titled “4. Poll for messages”curl https://tempmailhush.com/api/v1/mailboxes/{mailbox_id}/messages \ -H "X-API-Key: sk-your_api_key"Poll at a reasonable interval and stop when the expected sender, subject, code, or confirmation link appears.
Python example
Section titled “Python example”import osimport requests
headers = {"X-API-Key": os.environ["TEMPMAILHUSH_API_KEY"]}
mailbox = requests.post( "https://tempmailhush.com/api/v1/mailboxes", headers=headers,).json()
messages = requests.get( f"https://tempmailhush.com/api/v1/mailboxes/{mailbox['id']}/messages", headers=headers,).json()
print(mailbox["address"], messages)