canonical: https://jentic.com/apis/googleapis.com/script

# Google Apps Script API

The Google Apps Script API manages and executes Google Apps Script projects programmatically, including project creation, content updates, deployments, versions, and execution metrics. It exposes endpoints for retrieving and updating script content, listing and creating versions and deployments, and enumerating script processes and metrics so operators can build CI/CD pipelines around Apps Script. The API enables external systems to deploy and monitor Apps Script automations that extend Google Workspace and Google Sheets.

## For AI agents

Manage Google Apps Script projects - create projects, update script content, manage versions and deployments, and inspect script processes and metrics from external systems.

## Scope

Does not execute arbitrary script functions on demand, edit Drive files outside script projects, or run code outside the Apps Script runtime - use for managing Apps Script project content, versions, and deployments only.

## Capabilities

- Create a new Apps Script project bound to a parent Drive file or standalone
- Get and update the source files inside a script project as a single content payload
- Create a new immutable version of a script and list previous versions
- Create, list, get, update, and delete deployments that publish a version as add-on or web app
- List script processes for the calling user and the user's script projects to monitor executions
- Retrieve project metrics such as execution counts and failure rates over a time window

## Use cases

### CI/CD for Apps Script projects

Engineering teams that maintain Apps Script automations push source updates to GitHub. A CI agent uses the Apps Script API to update the project content, create a new version, and create a new deployment of that version, replacing manual editing in the in-browser script editor. The API lets the team apply code review and rollback discipline to Apps Script.

Example prompt: PUT /v1/projects/{scriptId}/content with the updated files, POST /v1/projects/{scriptId}/versions to create a new version, then POST /v1/projects/{scriptId}/deployments referencing that version.

### Apps Script execution monitoring

An operations agent polls /v1/processes:listScriptProcesses for failed Apps Script executions across the team's automations and routes failures to an incident tracker. Pairing this with the metrics endpoint produces a dashboard of failure rates over time without each team standing up its own monitoring.

Example prompt: GET /v1/processes:listScriptProcesses with statuses=FAILED and post each failure to a ticketing webhook.

### Backup and restore of script content

A backup agent reads the content of every Apps Script project in the team's Drive corpus on a schedule and stores the JSON payload in a versioned bucket. If a project is corrupted, the agent restores it by issuing a content update with the most recent backup, returning the project to a known good state.

Example prompt: GET /v1/projects/{scriptId}/content for each script, store the response, and PUT /v1/projects/{scriptId}/content with the latest backup on demand.

### Agent-driven Apps Script ops through Jentic

An AI agent built on Jentic exposes Apps Script administration as tools for Workspace operators: create a script, deploy a version, list failures. It searches Jentic for the right operation by intent and runs it, with OAuth tokens kept in your Jentic One instance.

Example prompt: Search Jentic for 'create apps script deployment', load the deployment schema, execute against the target scriptId and version.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/projects | Create an Apps Script project |
| GET | /v1/projects/{scriptId} | Get project metadata |
| GET | /v1/projects/{scriptId}/content | Get project source content |
| PUT | /v1/projects/{scriptId}/content | Update project source content |
| POST | /v1/projects/{scriptId}/versions | Create a new immutable version |
| POST | /v1/projects/{scriptId}/deployments | Create a deployment for a version |
| GET | /v1/processes:listScriptProcesses | List script processes for the project |
| GET | /v1/projects/{scriptId}/metrics | Retrieve project execution metrics |

## Key resources

- **Projects** — Create, get, and update Apps Script project metadata and source content.
- **Versions** — Create and list immutable versions of a script project.
- **Deployments** — Create, list, get, update, and delete deployments that publish a script version as a web app or add-on.
- **Processes** — List script processes for a user or project to monitor executions and failures.
- **Metrics** — Retrieve execution and failure counts for a project over a time window.

## Why Jentic

- **Setup:** Wiring the Apps Script API by hand means setting up Google OAuth 2.0, refreshing scoped access tokens, and threading the script project id through the /v1/projects endpoints on script.googleapis.com. Through Jentic you install once, import the Apps Script API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** This API puts the script project id in the URL path (/v1/projects/{scriptId}), so a rule can pin your agent to one script project: it can read content, versions, and metrics for that project and nothing else. You choose the operations it may call, so state-changing ones like updating content or creating a deployment are not included unless you add them.
- **Credential handling:** Your Google OAuth credential is stored once, encrypted, by your own Jentic One instance and a scoped access token is injected at execution time. The credential never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create an Apps Script deployment' or 'list Apps Script processes', and Jentic returns the matching operation with its input schema so the agent calls the right endpoint without browsing the v1 docs.

## Related APIs

- **Google Drive API** — Hosts Apps Script project files and bound documents.
- **Google Sheets API** — Targets the spreadsheets that Apps Script projects automate.
- **Google Workspace Events API** — Subscribe to Workspace events without hosting Apps Script.
- **Cloud Functions API** — Run general-purpose serverless code outside the Apps Script runtime.

## FAQ

### What authentication does the Apps Script API use?

It uses Google OAuth 2.0 with scopes such as scripts.projects, scripts.deployments, and scripts.processes, declared as Oauth2 and Oauth2c. Through Jentic, OAuth tokens are stored encrypted in the vault and exchanged for short-lived access tokens at execution time.

### Can I create deployments through the Apps Script API?

Yes. POST /v1/projects/{scriptId}/deployments creates a deployment of a specific version with a deploymentConfig that specifies whether it is a web app, add-on, or executable. The endpoint returns the new deployment ID, which can then be referenced in update or delete calls.

### What are the rate limits for the Apps Script API?

Google applies per-project quotas to Apps Script API calls; the default is 90 queries per minute per user for read endpoints, with mutating create and update endpoints sharing a separate per-day quota that scales with usage. Quotas can be raised through the Cloud Console for sustained CI/CD usage.

### How do I deploy an Apps Script version through Jentic?

Search Jentic for 'create apps script deployment', load the schema for POST /v1/projects/{scriptId}/deployments, and execute with the version number and deploymentConfig payload. Jentic returns the new deployment ID for downstream verification.

### Is the Apps Script API free?

The API is free to call within Google Cloud quotas; underlying Apps Script execution is metered by the standard Apps Script execution-time quotas tied to the calling user's account, not by the API itself. There is no per-API-call charge.

### How do I monitor failed Apps Script executions?

Call GET /v1/processes:listScriptProcesses with statuses=FAILED to enumerate recent failed executions for the calling user's projects, and pair it with GET /v1/projects/{scriptId}/metrics to retrieve aggregate failure counts. The metrics endpoint accepts a metricsGranularity parameter for daily or hourly bucketing.

### Can I limit what my agent is allowed to do with the Apps Script API?

Yes. Because your Jentic One instance is self-hosted, your own rules decide which operations and credentials the agent may use. The Apps Script API puts the script project id in the URL path (/v1/projects/{scriptId}), so a rule can pin the agent to a single project and let it only read content, versions, and metrics for that project. State-changing operations like updating content with PUT /v1/projects/{scriptId}/content or creating a deployment with POST /v1/projects/{scriptId}/deployments are excluded unless you explicitly add them.
