> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tetherai.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail Pub/Sub push webhook

> Receives Gmail Pub/Sub push notifications. The relay decodes the base64 payload, looks up the matching `EmailAccount` by history id, and triggers an incremental sync. Public endpoint — auth is enforced by the Pub/Sub OIDC token, not bearer JWT.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/webhook/email/gmail
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/webhook/email/gmail:
    post:
      tags:
        - Email
      summary: Gmail Pub/Sub push webhook
      description: >-
        Receives Gmail Pub/Sub push notifications. The relay decodes the base64
        payload, looks up the matching `EmailAccount` by history id, and
        triggers an incremental sync. Public endpoint — auth is enforced by the
        Pub/Sub OIDC token, not bearer JWT.
      operationId: post_webhook_email_gmail
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailWebhookRequest'
      responses:
        '200':
          description: >-
            Plain-text acknowledgement. The body is the literal text `OK`;
            Pub/Sub only checks the 2xx status to mark the push delivery as
            acknowledged.
          content:
            text/plain:
              schema:
                type: string
                example: OK
        '500':
          description: Webhook processing failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailErrorResponse'
components:
  schemas:
    EmailWebhookRequest:
      type: object
      properties:
        message:
          type: object
          description: >-
            Pub/Sub push envelope wrapping the Gmail notification; decoded
            server-side to identify the affected mailbox.
          properties:
            data:
              type: string
              description: Base64-encoded Pub/Sub notification payload from Gmail.
          additionalProperties: true
      additionalProperties: true
      example:
        message:
          data: >-
            eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9
    EmailErrorResponse:
      type: object
      description: >-
        Error envelope returned by Email feature endpoints. Most paths only set
        `error`; a few include `code` for diagnostic context (e.g. provider
        mismatches).
      properties:
        error:
          type: string
        message:
          type: string
        code:
          type: string
      required:
        - error
      additionalProperties: true
      example:
        error: Email account not found

````