aethexDocs
Google Calendar logo
Scheduling

Google Calendar

Connect a Google account and your agents can check availability and book, reschedule or cancel meetings during a call.

Beta

This connector is in beta. It works end to end and is safe to use on real calendars, but the surface can still change before general availability, so do not pin automation to exact tool names or response shapes yet.

Heads up
While our Google verification is under review, the consent screen shows an unverified app warning. Approving it is safe: the warning is about our review status, not about what the integration does. On a Google Workspace domain, an administrator may need to allow the app first.

How it works

Connect a Google account once, choose which agents may use it, and give each one a read or a write grant. During a call the agent can check availability and offer open times, and with write it can also book, reschedule and cancel, all as ordinary events you can see in Google Calendar. The grant is the whole story, and everything below follows from it.

AETHEXyour agentREAD GRANTCheck availabilityOffer open timesWRITE GRANTBook a meetingReschedule or cancelreadwriteWrite includes everything read can do.
STEP 01

Connect a calendar

Connecting is an OAuth consent flow, so it needs a browser once: the calendar owner approves the access at Google. Aethex gives you the URL to send them to, and you never see their credentials. The authorize and grant calls need an API key with integrations:write; reading connections needs integrations:read.

Heads up
A connected calendar reaches no agent until you grant one. Stop here and the account is linked but every call is unable to touch it, which looks like the integration is broken.
  1. Ask for a consent URL

    Returns the Google URL to open. It is single-use and valid for 10 minutes, so generate it when the person is ready to click.

    bash
    curl -X POST https://api.aethexai.com/api/v1/integrations/google_calendar/authorize \
      -H "X-API-Key: $AETHEX_API_KEY"
    
    # { "authorize_url": "https://accounts.google.com/o/oauth2/v2/auth?..." }
  2. Open it and approve

    The calendar owner signs in at Google and approves the two permissions. Google redirects back to Aethex, which finishes the exchange. Confirm the result from the API, not from where the browser lands.

  3. Confirm the connection

    The connection is live once it appears with status: active. Note its id, since the grant and disconnect calls both take it. agents comes back empty, which means no agent can use it yet.

    bash
    # Keep the id: the grant and disconnect calls below both take it.
    CONNECTION_ID=$(curl -s https://api.aethexai.com/api/v1/integrations \
      -H "X-API-Key: $AETHEX_API_KEY" \
      | jq -r '.data[] | select(.provider == "google_calendar") | .id')
STEP 02

Grant agents access

A connected calendar belongs to the account, not to one agent, so it reaches an agent only when you grant it. Give an agent read to check availability and offer times, or write to also book, reschedule and cancel. The grant call is declarative: it replaces the whole set, and an empty list revokes everyone. Grants are read when a call starts, so a change applies to the next call, not one already in progress. Reschedule and cancel act only on a meeting the agent booked in the same call, since they need its event id and the agent cannot search the calendar for one it did not create.

ActionWhat it doesGrant
Offer open timesReads busy periods over the next few days and proposes only the gaps that fit.read
Book a meetingAdds the event to the calendar and emails the guests an invitation.write
RescheduleMoves a meeting it booked earlier in the same call, and notifies the guests.write
CancelRemoves that meeting and notifies the guests.write
Tip
Use read for an agent that only quotes availability and hands off to a human to confirm. Widening it to write later does not require reconnecting the calendar.
Replace the grant set
bash
curl -X PUT https://api.aethexai.com/api/v1/integrations/$CONNECTION_ID/agents \
  -H "X-API-Key: $AETHEX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agents": [
      { "agent_id": "6b1e...", "access": "write" },
      { "agent_id": "9d02...", "access": "read"  }
    ]
  }'

The access being approved

Connecting asks Google for exactly two permissions, and nothing else. The broader scope that could read your calendar list, its settings, or who it is shared with is a different Google scope, and Aethex does not request it.

ScopeWhat it covers
calendar.eventsRead, create, update and delete events. The write half books, reschedules and cancels; the read half checks an event's current length when rescheduling, so it is preserved.
calendar.freebusyRead busy time ranges. This is what a check for a free slot uses.
Note
Reading busy ranges reveals when the account is busy, not what. The titles, guests and locations of existing events are never read to find a free slot.

Status codes worth knowing

The ones you are most likely to meet while wiring this up. 401 and 403 can come from any call; 404 and 409 come from the grant call; 422 and 503 come from authorize.

401Unauthorized

Every call on this page, before any handler runs. No X-API-Key header, or a key that is invalid, revoked or expired.

Send a live key. Missing API key means the header never arrived; Invalid or expired API key means it did not match.

403Forbidden

The API key is valid but lacks the scope this call needs.

authorize, the grant call and disconnect need integrations:write; listing connections needs integrations:read.

404Not Found

The grant call was handed a connection id that is not this account's, or an agent_id that is not one of your agents.

Re-read GET /integrations for the connection id, and check every agent_id is an agent on this account. It is 404 rather than 422 so it never reveals another account's rows.

409Conflict

A rare conflicting change to the connection while the grants were being written.

Re-read the connection's agents list and send the complete set again.

422Unprocessable Entity

On authorize, a provider that does not use a consent flow. The grant call also returns 422 for a malformed body, such as a bad agent_id or an unknown access level.

Check the provider is google_calendar. Providers that take a credential directly are connected with POST /integrations instead.

503Service Unavailable

On authorize, the consent flow is not available on this deployment, or the state store was briefly unavailable.

If the state store blipped, the same call succeeds on a retry. If the consent flow is not configured on this deployment, retrying will not help, so contact support.

Disconnect

Deletes the connection and the stored access at once, including on calls in progress, so the next calendar action in a live call fails. It does not touch the calendar itself, so booked meetings stay where they are. Disconnecting is idempotent and returns 204 whether the connection was active, already gone, or never existed. You can also revoke access from the Google account's own third-party settings; the connection then turns to status: error on its next token refresh.

bash
curl -X DELETE https://api.aethexai.com/api/v1/integrations/$CONNECTION_ID \
  -H "X-API-Key: $AETHEX_API_KEY"

# 204 No Content

If something does not work

The handful of things that usually explain a calendar that looks broken.

SymptomWhat to check
The connection shows status: errorGoogle stopped accepting the stored access, usually revoked at Google or an expired beta grant. Connect again, then re-grant your agents, since a reconnect starts with an empty grant set.
The agent never offers timesConfirm the agent is in the connection's agents list.
It offers times but never booksThat is read access working. Change the grant to write.
The consent URL stopped workingIt is single-use and expires after 10 minutes. Ask for a fresh one.
The approval cannot completeOn a Google Workspace account, an administrator may restrict third-party access.