Docs / Quickstart
Run your first query
Ask for the mail your app needs, send a person through the consent screen, and read what they approved. This takes about ten minutes, using a sandbox mailbox with sample mail.
Install the SDK
Section titled “Install the SDK”Create an app in the developer console and copy its test key. Test keys only see sandbox mailboxes.
npm install @permaily/sdkAsk for access
Section titled “Ask for access”Request the smallest access that does the job. Your query says which emails you want, and the response gives you a link to the consent screen.
const { consentUrl, access } = await permaily.access.request({ query: "from:(iberia.com OR booking.com OR renfe.es OR airbnb.com) " + "subject:(booking OR reservation OR itinerary)", parts: ["headers", "body_text"], actions: ["read"], expiresIn: "90d",});Send the person to the consent screen
Section titled “Send the person to the consent screen”They see the exact emails you’d receive, on their own mail, then come back to your redirect address.
47 of 12,304 emails
Read what they approved
Section titled “Read what they approved”Every message carries its receipt id, and only the parts in the access.
for await (const message of permaily.messages.list({ access })) { console.log(message.subject, message.receipt);}