Connect to the Revdoku API with Python
Create a private bucket with its own email address using Python 3 and requests.
API overview · JavaScript example · C# (.NET) example
1. Get an API key
Sign in to Revdoku, then open Account → Access and choose Add connection → Create API key. Named API keys require a paid plan. For this example, choose bucket_admin permission and access to all buckets in the account where you want to create the inbox.
Set REVDOKU_API_KEY privately in the terminal where you will run the example, or through your secret manager. On macOS or Linux, enter the key at the hidden prompt:
printf 'Revdoku API key: '
read -r -s REVDOKU_API_KEY
export REVDOKU_API_KEY
printf '\n'
For PowerShell 7:
$env:REVDOKU_API_KEY = Read-Host "Revdoku API key" -MaskInput
Run the code on your machine or server. Keep the key out of browser code, shared files, and source control.
2. Install requests
Create a virtual environment in your project directory. On macOS or Linux:
python3 -m venv .venv
.venv/bin/python -m pip install requests
On Windows:
py -m venv .venv
.venv\Scripts\python.exe -m pip install requests
3. Create an inbox
Save this complete example as inbox.py. It sends one authenticated request and prints the bucket ID, email address, receiving state, and dashboard link.
import os
import requests
api_key = os.environ["REVDOKU_API_KEY"] # Get a key at https://app.revdoku.com/account/access
response = requests.post(
"https://app.revdoku.com/api/v1/buckets",
headers={"Authorization": f"Bearer {api_key}"},
json={"bucket": {"title": "My agent inbox"}},
timeout=30,
)
response.raise_for_status()
bucket = response.json()["data"]["bucket"]
inbox = bucket["inbound_email"]
print("Bucket ID:", bucket["id"])
print("Email:", inbox["address"])
print("Ready:", inbox["ready"])
print("Open:", bucket["dashboard_url"])
if not inbox["ready"]:
print("Receiving:", inbox["blocked_reason"])
Run it from the terminal where you set REVDOKU_API_KEY. On macOS or Linux:
.venv/bin/python inbox.py
On Windows:
.venv\Scripts\python.exe inbox.py
Each run creates a new private bucket. Save the returned bucket ID and reuse it for later requests. The key’s default account is used; see account selection when working across accounts.
4. Receive and read an email
When Ready is true, send a test email from your normal email account to the printed address. If it is false, check Receiving for the reason and inspect the existing bucket’s receiving state. New addresses can take up to five minutes to activate; rerunning this script creates another bucket.
Follow the send and read walkthrough using the bucket ID printed by this example. Incoming messages are stored as JSON and Markdown alongside their attachments. The dashboard link lets authorized people review them in Revdoku.
For authentication and permission failures, see troubleshooting. For all operations, see the API reference.