For Agents
Run SQL queries and DML against globally distributed Cloud Spanner databases, manage schemas and instances, and orchestrate backups and restores. Sessions and transactions are first-class.
Get started with Cloud Spanner API in minutes using your preferred integration method.
# Add to your MCP client config (Claude Desktop, Cursor, Windsurf)
{
"jentic": {
"url": "https://api.jentic.com/mcp",
"auth": "oauth"
}
}
# Then ask your agent:
"run a SQL query against a Spanner database"
# → Jentic returns the GET /events tool with parameter schema, agent executes.What an agent can do with Cloud Spanner API API.
Provision Spanner instances and databases with chosen node counts and configurations
Apply DDL changes to evolve a database schema online
Open sessions, run SQL or partitioned reads, and commit or rollback transactions
Execute batched DML statements for high-throughput writes within a transaction
GET STARTED
Use for: I want to run a SQL query against a Cloud Spanner database, Create a new Spanner instance with 3 nodes, List all databases in a Spanner instance, Take a backup of a Spanner database
Not supported: Does not handle ETL pipelines, BI dashboards, or Postgres-compatible drivers — use for Spanner instance, database, session, and backup management only.
The Cloud Spanner API exposes Google's globally distributed, strongly consistent relational database as REST operations. It covers instance and database lifecycle (create, list, update, drop), schema management via DDL, session-based read and write transactions, partitioned reads for parallel scans, and backup, restore, and point-in-time database operations. Long-running operations for backups, restores, and database moves are tracked through standard operations endpoints.
Take, list, and restore from backups, including copying backups across instances
Move a database between instance configurations or change quorum for regional failover
Patterns agents use Cloud Spanner API API for, with concrete tasks.
★ Provision Spanner for a New Service
When a team launches a new globally distributed service, automation creates a Spanner instance, then a database with an initial DDL script defining tables and indexes. The Cloud Spanner API exposes instance creation as a long-running operation and database creation with extraStatements for first-pass schema, so a service can be storage-ready in minutes.
POST /v1/{+parent}/instances with config 'regional-us-central1' and nodeCount=3, then POST /v1/{+parent}/databases with createStatement and the initial DDL extraStatements.
Read-Only Analytics Query
Issue a read-only SQL query against a Spanner database from a reporting agent. The flow opens a session, executes the SQL with single-use bounded staleness for cheaper reads, and returns rows. Cloud Spanner's strong consistency makes this safe for cross-region analytics.
POST /v1/{+database}/sessions to open a session, POST sessions/{session}:executeSql with sql='SELECT name, count FROM Metrics WHERE day=@d' and a 60-second staleness.
Scheduled Backup and Restore Drill
Run a nightly backup of a production Spanner database and periodically test the restore path into a staging instance. The API supports POST /v1/{+parent}/backups for take, GET listing, and POST /v1/{+parent}/databases:restore for the restore path. Each is a long-running operation trackable via the operations endpoint.
Create a backup of database prod-db with expireTime=now+30d, then poll the returned operation until done; in staging, POST databases:restore with the backup name.
AI Agent Schema Evolution
An AI agent reviewing a feature request decides a new column is needed on a Spanner table. The agent searches Jentic for the DDL update operation, loads the schema, and submits an updateDdl request. Jentic returns a long-running operation handle so the agent can poll for completion before proceeding.
Search Jentic for 'apply DDL to a Spanner database', execute PATCH /v1/{+database}/ddl with statements=['ALTER TABLE Orders ADD COLUMN region STRING(2)'].
50 endpoints — the cloud spanner api exposes google's globally distributed, strongly consistent relational database as rest operations.
METHOD
PATH
DESCRIPTION
/v1/{+database}/sessions
Create a session for executing reads and transactions
/v1/{+database}/sessions:batchCreate
Create multiple sessions in one call
/v1/{+database}/ddl
Apply DDL statements to evolve a database schema
/v1/{+name}
Get an instance, database, backup, or operation by resource name
/v1/{+name}:cancel
Cancel a long-running operation
/v1/{+name}:move
Move a database between instance configurations
/v1/{+name}:changequorum
Change the quorum configuration of a database
/v1/{+database}/sessions
Create a session for executing reads and transactions
/v1/{+database}/sessions:batchCreate
Create multiple sessions in one call
/v1/{+database}/ddl
Apply DDL statements to evolve a database schema
/v1/{+name}
Get an instance, database, backup, or operation by resource name
/v1/{+name}:cancel
Cancel a long-running operation
Three things that make agents converge on Jentic-routed access.
Credential isolation
Spanner service-account credentials are stored in the Jentic vault (MAXsystem) and exchanged for scoped, short-lived access tokens on each call. Long-lived JSON keys never enter the agent context.
Intent-based discovery
Agents search Jentic with intents like 'run a SQL query against a Spanner database' or 'back up a Spanner database', and Jentic returns the matching executeSql or backups.create operation with its request schema.
Time to first call
Direct Spanner integration: 2-3 days to wire OAuth, sessions, transaction lifecycle, and long-running operations. Through Jentic: under 1 hour to discover the operation, load the schema, and execute.
Alternatives and complements available in the Jentic catalogue.
BigQuery API
BigQuery is an analytics warehouse; Spanner is an OLTP database with strong consistency.
Choose BigQuery for ad-hoc analytics and large historical scans. Choose Spanner when the workload is transactional, latency-sensitive, and needs global strong consistency.
Cloud Firestore API
Firestore is a document database with simpler scaling; Spanner is relational with horizontal SQL.
Choose Firestore for mobile and web apps with hierarchical document data. Choose Spanner when SQL joins, indexes, and ACID transactions across regions matter.
Google IAM API
IAM controls the roles that grant access to Spanner instances, databases, and backups.
Use IAM to grant or audit roles like roles/spanner.databaseUser before delegating Spanner access to a service account.
AlloyDB API
AlloyDB is PostgreSQL-compatible with regional scaling; Spanner offers global strong consistency.
Choose AlloyDB for PostgreSQL-compatible workloads in a single region. Choose Spanner when global write scalability and strong consistency are required.
Specific to using Cloud Spanner API API through Jentic.
What authentication does the Cloud Spanner API use?
The Cloud Spanner API uses OAuth 2.0 with the cloud-platform or spanner.data scope. Through Jentic, OAuth credentials are stored in the Jentic vault (MAXsystem) and exchanged for short-lived access tokens, so service-account JSON keys never enter the agent context.
Can I run arbitrary SQL against a Spanner database with the API?
Yes. Open a session under POST /v1/{+database}/sessions, then call POST .../sessions/{session}:executeSql with the SQL string and any parameters. For DML, wrap the call in a transaction by including a transaction selector with begin or id fields.
What are the rate limits for the Cloud Spanner API?
Cloud Spanner enforces per-instance throughput limits scaled by node count rather than per-call quotas. There are also admin-API quotas (default ~5 requests per second for instance and database admin calls). Heavy DML or large reads should be chunked across sessions to fit within node throughput.
How do I take a Spanner backup through Jentic?
Search Jentic for 'back up a Cloud Spanner database', load the backups.create schema, then execute POST /v1/{+parent}/backups with the source database name and an expireTime. The response returns a long-running operation that Jentic surfaces so the agent can poll for completion.
Is the Cloud Spanner API free?
Cloud Spanner itself is billed per node hour and per GB of storage, with backup storage charged separately. The API surface has no per-call charge — costs come from the underlying instance running the queries.
Can I run a partitioned read for a large scan?
Yes. Call POST .../sessions/{session}:partitionRead or partitionQuery to get partition tokens, then issue parallel POST .../sessions/{session}:streamingRead calls — one per partition — to scan the table in parallel.
/v1/{+name}:move
Move a database between instance configurations
/v1/{+name}:changequorum
Change the quorum configuration of a database