डेवलपर्स के लिए Jo Mail API

अपने कोड से अस्थायी इनबॉक्स बनाएँ और आने वाले संदेश पढ़ें, जैसे साइन-अप फ़्लो के परीक्षण के लिए।

प्रमाणीकरण

डैशबोर्ड में कुंजी बनाएँ और हर अनुरोध में इन हेडर में से किसी एक में भेजें।

X-Api-Key: jm_xxxxxxxxxxxxxxxx
# or
Authorization: Bearer jm_xxxxxxxxxxxxxxxx

एंडपॉइंट

POST   /api/inbox                         create an inbox   {"guest":true,"name":"optional","domain":"jo-mail.org","ttl_minutes":60}
                                          -> {"inbox":{"id":1,"address":"...","expires_at":...},"key":"1.abcdef..."}
GET    /api/inbox                         list messages     (header X-Inbox: <key>)
GET    /api/inbox/wait?after=<lastId>     long-poll: returns {"changed":true} as soon as a new message arrives
GET    /api/inbox/messages/{id}           read one message  (subject, from, text, html, attachments)
GET    /api/inbox/attachments/{id}        download an attachment
DELETE /api/inbox/messages/{id}           delete a message
POST   /api/inbox/renew                   extend the lifetime
DELETE /api/inbox                         delete the inbox

उदाहरण

# 1) create an inbox
curl -s -X POST https://jo-mail.org/api/inbox \
  -H "X-Api-Key: $JM_KEY" -H "Content-Type: application/json" \
  -d '{"guest":true}'

# 2) wait for mail, then read it
curl -s "https://jo-mail.org/api/inbox/wait?after=0" -H "X-Inbox: $INBOX_KEY"
curl -s https://jo-mail.org/api/inbox -H "X-Inbox: $INBOX_KEY"
// JavaScript
const r = await fetch('https://jo-mail.org/api/inbox', {
  method: 'POST',
  headers: { 'X-Api-Key': KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({ guest: true }),
});
const { inbox, key } = await r.json();
console.log(inbox.address);   // use it to sign up, then poll /api/inbox/wait

सीमा: प्रति कुंजी प्रति घंटे 600 इनबॉक्स। इनबॉक्स कुंजियाँ गोपनीय हैं: जिसके पास कुंजी है वह उस इनबॉक्स को पढ़ सकता है।