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

# Overview

> Google Docs plugin for Corsair

Use **Google Docs** through Corsair: one client, typed API calls, optional local DB sync, and incoming webhooks documented below.

Google Docs exposes document creation and editing, text operations, structure (headers, footers, footnotes, named ranges, bullets), tables, images, styling, and batch updates for serverless document workflows. Use Corsair permissions for destructive actions such as deleting content ranges, headers, footers, named ranges, table rows, or table columns.

**What you get:**

* 35 typed API operations
* 1 database entity synced for fast `.search()` / `.list()` queries
* 1 incoming webhook event types

## Setup

<Steps>
  <Step title="Install">
    ```bash theme={null}
    pnpm install @corsair-dev/googledocs
    ```
  </Step>

  <Step title="Add the plugin">
    <Tabs>
      <Tab title="Solo">
        ```ts corsair.ts theme={null}
        import { createCorsair } from 'corsair';
        import { googledocs } from '@corsair-dev/googledocs';

        export const corsair = createCorsair({
        	// ... other config options,
        	multiTenancy: false,
            plugins: [googledocs()],
        });
        ```
      </Tab>

      <Tab title="Multi-Tenant">
        ```ts corsair.ts theme={null}
        import { createCorsair } from 'corsair';
        import { googledocs } from '@corsair-dev/googledocs';

        export const corsair = createCorsair({
        	// ... other config options,
            multiTenancy: true,
            plugins: [googledocs()],
        });
        ```

        See [Multi-tenancy](/concepts/multi-tenancy) for account isolation.
      </Tab>
    </Tabs>
  </Step>

  <Step title="Get credentials">
    Follow [Get Credentials](/plugins/googledocs/get-credentials) if you need help getting keys.
  </Step>

  <Step title="Store credentials">
    <Tabs>
      <Tab title="Solo">
        ```bash theme={null}
        pnpm corsair setup --plugin=googledocs
        ```

        Use the key names documented in [Get Credentials](/plugins/googledocs/get-credentials) (for example `api_key=`, `bot_token=`, or OAuth client fields).
      </Tab>

      <Tab title="Multi-Tenant">
        ```bash theme={null}
        pnpm corsair setup --plugin=googledocs --tenant=<tenantId>
        ```

        Store per-tenant secrets after you create the tenant record. See [Multi-tenancy](/concepts/multi-tenancy).
      </Tab>
    </Tabs>
  </Step>
</Steps>

## Authentication

Each tab shows how to register the plugin for that authentication method. The default `authType` from the plugin does not need to appear in the factory call.

<Tabs>
  <Tab title="OAuth 2.0 (Default)">
    ```ts corsair.ts theme={null}
    googledocs()
    ```

    Store credentials with `pnpm corsair setup --plugin=googledocs` (see [Get Credentials](/plugins/googledocs/get-credentials) for field names). For OAuth, you typically store integration keys at the provider level and tokens per account or tenant.

    More: [OAuth 2.0](/concepts/oauth)
  </Tab>
</Tabs>

## Webhooks

This plugin registers **1** webhook handler(s). Configure your provider to POST events to your Corsair HTTP endpoint, then use `webhookHooks` in the plugin factory for custom logic.

See [Webhooks](/plugins/googledocs/webhooks) for every event path and payload shape, and [Webhooks concept](/concepts/webhooks) for how to set up routing.

## Query synced data

Synced entities support `corsair.googledocs.db.<entity>.search()` and `.list()`. See [Database](/plugins/googledocs/database) for filters and operators.

## Example API calls

**Read-style (read):** `documents.exportDocumentAsPdf`

```ts theme={null}
await corsair.googledocs.api.documents.exportDocumentAsPdf({});
```

**Write-style (write):** `documents.copyDocument`

```ts theme={null}
await corsair.googledocs.api.documents.copyDocument({});
```

See the full list on the [API](/plugins/googledocs/api) page. Use `pnpm corsair list --plugin=googledocs` and `pnpm corsair schema <path>` locally to inspect schemas.

***

## Hooks

Use `hooks` on API calls and `webhookHooks` on incoming events to add logging, approvals, or side effects. See [Hooks](/concepts/hooks) and the [Webhooks](/plugins/googledocs/webhooks) page for payload types.

***

## Reference

| Topic       | Link                                                   |
| ----------- | ------------------------------------------------------ |
| API         | [API](/plugins/googledocs/api)                         |
| Database    | [Database](/plugins/googledocs/database)               |
| Webhooks    | [Webhooks](/plugins/googledocs/webhooks)               |
| Credentials | [Get credentials](/plugins/googledocs/get-credentials) |
