Email, calendar & files
Read and send email, manage calendar events and work with files in your users' own Google and Microsoft accounts through one API.
Connect a user's Google or Microsoft account and you can work in their own mailbox, calendar and drive with your Pozy key. Send a follow-up from their Gmail, book a meeting in their Outlook calendar, save a report to their OneDrive. The endpoints are the same for both providers: every object carries provider (google or microsoft) and accountId, so one integration covers both.
#What you can do
| Area | Microsoft | Guide | |
|---|---|---|---|
| Email: list, search, read, send, reply, label or flag, move, trash, attachments | Gmail | Outlook mail | |
| Calendar: events, invitations, RSVP, free-busy, meeting slots | Google Calendar with Meet | Outlook Calendar with Teams | Calendar |
| Files: list, search, upload, download, folders, share links | Google Drive (picked or created files only) | OneDrive (every file the user can reach) | Files |
Contacts: read-only sync into /v1/contacts |
Google Contacts | Outlook contacts | Contacts |
Incoming mail also lands in the inbox as conversations, one per thread, so the same inbox that handles DMs and comments can handle email.
#Connect an account
Pass the areas you need in scopes when you request the connect link. One account is one mailbox, and you can add areas later without changing the account id.
curl "https://api.pozy.ai/v1/connect/google?profileId=6710c3a9e4b0d2f1a8c95e21&scopes=email,calendar,files&redirect_url=https://app.example.com/connected" \
-H "Authorization: Bearer $POZY_API_KEY"const res = await fetch("https://api.pozy.ai/v1/connect/microsoft?profileId=6710c3a9e4b0d2f1a8c95e21&scopes=email,calendar&redirect_url=https:%2F%2Fapp.example.com%2Fconnected", {
headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);import os, requests
resp = requests.get(
"https://api.pozy.ai/v1/connect/google",
headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
params={"profileId": "6710c3a9e4b0d2f1a8c95e21", "scopes": "email,calendar,files", "redirect_url": "https://app.example.com/connected"},
)scopes value |
Unlocks |
|---|---|
email |
The Email endpoints and email in the inbox |
calendar |
The Calendar endpoints |
files |
The Files endpoints |
contacts |
A read-only daily contacts sync |
A call that needs an area the account was not granted returns 412 account_scope_missing, with grantedAreas and missingArea in details. Reconnect with the area added. Provider specifics (Gmail send caps, Drive's file grants, Microsoft admin consent) are on the Google Workspace and Microsoft 365 pages.
#Find the accounts
GET /v1/accounts?platform=google and GET /v1/accounts?platform=microsoft list connected mailboxes. Every call in this section takes the mailbox's accountId: in the query on reads, in the body on writes.
#Shared rules
| Topic | Rule |
|---|---|
| Ids | The provider's own message, thread, event and file ids |
| Times | ISO 8601 with an offset |
| Pagination | limit and cursor; responses return pagination.hasMore and pagination.nextCursor |
| Reads | Live calls to the provider, not billed per call, counted against your rate limit |
| Provider throttling | 429 rate_limited with Retry-After |
| Lost access | 401 reconnect_required. When the provider refuses to renew access, the account is marked disconnected and account.disconnected fires |
#Stay in sync with webhooks
When an account connects, Pozy subscribes to the provider's push notifications for the granted areas and renews them for you. Subscribe your webhook endpoint to the events you care about. Calendar, file and contact events carry the changed object's id and changeType: fetch it to read its current state.
| Event | When it fires |
|---|---|
account.rate_limited |
Mailbox sending cooldown started. |
calendar.event.created |
Calendar event created. |
calendar.event.updated |
Calendar event updated. |
calendar.event.deleted |
Calendar event deleted. |
file.created |
File created. |
file.updated |
File updated. |
file.picked |
Files picked. |
file.deleted |
File deleted. |
contact.updated |
Contact updated. |
contact.deleted |
Contact deleted. |
New mail arrives as the inbox events message.received, message.sent and conversation.started. See Inbox.
#Health
GET /v1/accounts/{accountId}/health reports the mailbox's daily send allowance as sendCap (limit, used, resetsAt) and the push subscription state as push (active, pending, failed or not_applicable).