Email, calendar & files

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 Google Microsoft Guide
Email: list, search, read, send, reply, label or flag, move, trash, attachments Gmail Outlook mail Email
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"
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).

#Endpoints

Endpoint What it does
GET /v1/calendar/calendars List calendars
GET /v1/calendar/events List events in a window
POST /v1/calendar/events Create an event
GET /v1/calendar/events/{eventId} Get an event
PATCH /v1/calendar/events/{eventId} Update an event
DELETE /v1/calendar/events/{eventId} Delete an event
POST /v1/calendar/events/{eventId}/rsvp Respond to an invitation
POST /v1/calendar/free-busy Busy blocks for one or more accounts
POST /v1/calendar/availability Find meeting slots across accounts
GET /v1/email/threads List email threads
GET /v1/email/threads/{threadId} Get an email thread with its messages
PATCH /v1/email/threads/{threadId} Update every message in a thread
GET /v1/email/messages List email messages
POST /v1/email/messages Send an email
GET /v1/email/messages/{messageId} Get an email message
PATCH /v1/email/messages/{messageId} Mark read or starred, or move a message
DELETE /v1/email/messages/{messageId} Move a message to trash
POST /v1/email/messages/{messageId}/reply Reply to a message
GET /v1/email/folders List mailbox folders
GET /v1/email/attachments/{attachmentId} Download an attachment
GET /v1/files List files in a folder or search the drive
POST /v1/files Upload a file
POST /v1/files/folders Create a folder
POST /v1/files/picker-sessions Create a hosted Google Picker session (not available yet)
GET /v1/files/{fileId} Get a file or folder
PATCH /v1/files/{fileId} Rename or move a file
DELETE /v1/files/{fileId} Move a file to the trash
GET /v1/files/{fileId}/download Download a file
GET /v1/files/{fileId}/share-link Get an anyone-with-the-link share link