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

# Google Service Consumer Management API

Service Consumer Management is the Google Cloud API service producers use to manage tenant projects and tenancy units for services built on Service Infrastructure. It lets producers create per-consumer tenant projects, attach existing projects, apply project-level configuration like IAM bindings and billing accounts, and clean up by detaching, removing, or undeleting projects. This is the control plane behind multi-tenant SaaS-on-GCP offerings such as Cloud SQL or AlloyDB private services.

## For AI agents

Programmatically provision and manage per-consumer tenant projects for services built on Google's Service Infrastructure.

## Scope

Does not handle service definition publishing, end-user authentication, or workload deployment - use for producer-side tenant project provisioning and lifecycle only.

## Capabilities

- Create and search tenancy units associated with a service and consumer
- Add and remove tenant projects within a tenancy unit, including dedicated and shared modes
- Attach existing GCP projects as tenant projects on a tenancy unit
- Apply project-level configuration (IAM, billing, services) to attached tenant projects
- Delete or undelete tenant projects to manage consumer offboarding and recovery
- Track long-running operations for asynchronous tenancy actions

## Use cases

### Multi-Tenant SaaS Provisioning on GCP

Service producers building managed offerings on top of GCP (private databases, dedicated networks, regulated workloads) use Service Consumer Management to spin up an isolated tenant project per customer, apply baseline IAM and billing config, and tear it down when the customer leaves. The API replaces ad-hoc Resource Manager + Billing + IAM scripts with a single tenancy-unit abstraction.

Example prompt: Call POST /v1/{+parent}/tenancyUnits:addProject with a tenant project config that sets billingConfig.billingAccount and an IAM policy for the customer's service account.

### Customer Offboarding Cleanup

When a customer leaves, automation walks the tenancy unit, removes each tenant project, and cancels any in-flight long-running operations. Service Consumer Management exposes deleteProject, removeProject, and undeleteProject so the workflow is auditable and reversible if a project is removed in error.

Example prompt: Call POST /v1/{+name}:removeProject for each tenant project in the tenancy unit, then poll the returned operations until done=true.

### Tenant Configuration Refresh

Periodically reapply baseline configuration (services enabled, IAM bindings, audit log settings) across every tenant project to enforce policy drift back to a known-good state. The applyProjectConfig action is idempotent and supports drift correction without recreating the project.

Example prompt: Call POST /v1/{+name}:applyProjectConfig with the standard tenant config for every tenancy unit returned by tenancyUnits.list.

### AI Agent Tenancy Operator

An AI agent runs the on-call tenancy operations for a managed-service team - provisioning new tenants, retrying failed apply operations, and answering 'where is project X?' from chat. Through Jentic the agent searches by intent and never holds the producer's service account credentials directly.

Example prompt: On chat command, call tenancyUnits:addProject for the named customer, watch the long-running operation, then post the resulting tenant project id back to the channel.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/{+parent}/tenancyUnits | Create a tenancy unit |
| POST | /v1/{+parent}/tenancyUnits:search | Search tenancy units for a service and consumer |
| POST | /v1/{+name}:addProject | Add a tenant project to a tenancy unit |
| POST | /v1/{+name}:attachProject | Attach an existing project as a tenant project |
| POST | /v1/{+name}:applyProjectConfig | Apply baseline configuration to a tenant project |
| POST | /v1/{+name}:removeProject | Remove a tenant project from a tenancy unit |

## Key resources

- **tenancyUnits** — Create, search, and delete tenancy units that group tenant projects per consumer
- **tenantProjects** — Add, attach, apply config, remove, and undelete tenant projects within a tenancy unit
- **operations** — Track and cancel long-running tenancy operations

## Why Jentic

- **Setup:** Wiring Google Service Consumer Management by hand means provisioning a producer service account, minting OAuth access tokens against serviceconsumermanagement.googleapis.com, and refreshing them yourself. Through Jentic you install once, import the Service Consumer Management API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Service Consumer Management puts the tenancy unit in the URL path (/v1/{name}:addProject, /v1/{name}:removeProject), so a rule can pin your agent to one tenancy unit: it can search and add projects there and nothing else. You choose the operations it may call, so removeProject is not included unless you add it.
- **Credential handling:** Your Service Consumer Management OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'add a tenant project to a tenancy unit' or 'search tenancy units', and Jentic returns the matching Service Consumer Management operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Service Management API** — Producers register and manage their service definitions with Service Management; Service Consumer Management handles the per-consumer tenancy on top.
- **Google Cloud Resource Manager API** — Manages GCP organizations, folders, and projects - the underlying primitives that tenant projects sit on.
- **Google Service Usage API** — Enables and disables Google services on a project, including tenant projects under management.
- **Google Cloud IAM API** — Manages service accounts and roles directly, an alternative to letting applyProjectConfig handle IAM bindings.

## FAQ

### What authentication does the Service Consumer Management API use?

It uses OAuth 2.0 with the cloud-platform scope and producer-side IAM permissions like roles/servicemanagement.serviceController on the producer service. Through Jentic the OAuth credentials are stored encrypted in your Jentic One instance and a scoped token is provided at execution.

### Who is this API for - service producers or consumers?

It is the producer-side control plane. If you are publishing a managed service on GCP, you use this API to create and manage tenant projects per customer. End consumers do not call it directly.

### What are the rate limits for the Service Consumer Management API?

Google enforces a default per-project quota of 60 write operations per minute and 600 read operations per minute. Many tenant operations are long-running, so the practical throughput is bounded by GCP project provisioning latency rather than the API quota.

### How do I attach an existing customer project through Jentic?

Run the Jentic search query 'attach a tenant project in service consumer management', load POST /v1/{+name}:attachProject, and execute it with the externalResource pointing at the customer's project number. Jentic injects the producer service account token.

### Can I undo a tenant project removal?

Yes, within the GCP undelete window. Call POST /v1/{+name}:undeleteProject on the tenant project resource. After the window expires the project is permanently deleted and cannot be restored via the API.

### Why are most write operations long-running?

Tenant project creation, attachment, and config apply involve provisioning Resource Manager projects, billing links, and IAM bindings. The API returns an Operation; callers poll GET /v1/{+name} on the operations resource until done=true.

### Can I limit what my agent is allowed to do with the Service Consumer Management API?

Yes. Jentic One is self-hosted, so your own rules decide which Service Consumer Management operations and credentials your agent can use. Because the API puts the tenancy unit in the URL path, you can pin the agent to a single tenancy unit and let it call only the operations you allow, such as searching tenancy units and running addProject or applyProjectConfig. Destructive calls like removeProject or deleteProject stay out of reach unless you explicitly add them, and the OAuth credential is injected at execution rather than exposed to the agent.
