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

# Google Cloud Datastore API

Cloud Datastore is Google's schemaless NoSQL document database for fully managed, scalable application storage. The API exposes 18 endpoints covering entity lookup, queries (GQL and structured), allocateIds for ID generation, and atomic transactions via beginTransaction, commit, and rollback. It also exposes import and export operations to and from Cloud Storage, plus index management for query optimisation.

## For AI agents

Read, write, query, and transact over entities in Cloud Datastore's NoSQL document database. Lets agents persist application state with strong consistency and ACID transactions.

## Scope

Does not run analytical SQL, manage relational schema, or stream change events - use for entity reads, writes, queries, and transactions in Datastore-mode databases only.

## Capabilities

- Look up entities by key in single calls or batched lookups
- Run GQL and structured queries against entity kinds with filters and ordering
- Commit groups of inserts, updates, upserts, and deletes in atomic transactions
- Reserve entity IDs ahead of insert with allocateIds and reserveIds
- Export and import entire entity kinds to and from Cloud Storage
- Manage composite indexes that back complex query patterns

## Use cases

### Schemaless Application State Storage

Persist user profiles, sessions, and operational state in a NoSQL document store with strong consistency on lookups by key. The API's commit operation supports atomic upserts of multiple entities, and lookup batches reads to minimise round-trips. Most applications can replace a small relational store with Datastore in under a day if access patterns are key-based.

Example prompt: POST /v1/projects/{projectId}:lookup with a list of entity keys for users; POST /v1/projects/{projectId}:commit with mutations to upsert their session state

### Atomic Multi-Entity Transactions

Begin a Datastore transaction, perform reads and writes, then commit or roll back atomically. POST /v1/projects/{projectId}:beginTransaction returns a transaction id that scopes subsequent lookups and the final commit. This supports use cases such as inventory decrement plus order creation in a single ACID step. Rollback on conflict is exposed as a first-class operation.

Example prompt: Begin a transaction, lookup the inventory entity, decrement its count, upsert an order entity, and commit; rollback on conflict

### Backup and Restore via Cloud Storage

Export a Datastore kind to Cloud Storage as a managed backup, then re-import the same files into a different project for disaster recovery or environment refresh. POST /v1/projects/{projectId}:export and :import accept a Cloud Storage URI prefix and entity-filter for kinds and namespaces. Long-running operations let agents poll for completion.

Example prompt: POST /v1/projects/{projectId}:export with outputUrlPrefix gs://acme-backup/datastore/2026-06-10/ and entityFilter for kinds [User, Order]; poll the operation until done

### AI Agent State Persistence

An AI agent that needs persistent state across runs can use Datastore through Jentic without operator-written client code. Jentic search returns the matching lookup, query, commit, or transaction operation, the agent loads the schema, and Jentic executes against datastore.googleapis.com using vault-stored credentials. This makes durable agent memory a single intent-search away.

Example prompt: Use Jentic to search 'commit a datastore mutation', load the commit schema, and execute it with an upsert mutation for the agent's state entity

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/projects/{projectId}:lookup | Look up entities by key |
| POST | /v1/projects/{projectId}:runQuery | Run a GQL or structured query |
| POST | /v1/projects/{projectId}:commit | Commit mutations atomically |
| POST | /v1/projects/{projectId}:beginTransaction | Begin a transaction |
| POST | /v1/projects/{projectId}:allocateIds | Allocate new entity IDs |
| POST | /v1/projects/{projectId}:export | Export entities to Cloud Storage |

## Key resources

- **Entities** — Lookup, mutate, and query individual entities by key or kind
- **Transactions** — Begin, commit, and rollback atomic transactions across entities
- **Queries** — Run GQL and structured queries against entity kinds
- **Indexes** — Composite indexes for multi-field queries
- **Operations** — Long-running operations for export and import jobs

## Why Jentic

- **Setup:** Wiring the Cloud Datastore API by hand means setting up Google OAuth, refreshing short-lived scoped tokens rather than embedding client secrets, and addressing project-level operations on datastore.googleapis.com. Through Jentic you install once, import the Cloud Datastore API from the API Directory, store the Google credential once, and your agent calls it.
- **Permission scoping:** The API carries the project id in the URL path (/v1/projects/{projectId}:runQuery and :commit), so a rule can pin your agent to one project. You choose the operations it may call, so it can look up entities and run queries while commit and export are not included unless you add them.
- **Credential handling:** Your Google 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 'run a Datastore query' or 'commit a mutation', and Jentic returns the matching Cloud Datastore operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Cloud Firestore API** — Firestore is the successor to Datastore with realtime listeners and richer querying.
- **Cloud Bigtable Admin API** — Bigtable is a wide-column key-value store for high-throughput workloads; Datastore is document-oriented.
- **Cloud Storage API** — Cloud Storage holds Datastore export and import files.

## FAQ

### What authentication does the Cloud Datastore API use?

The Cloud Datastore API uses OAuth 2.0 with the datastore or cloud-platform scope. Through Jentic the OAuth client and refresh tokens are stored in your Jentic One instance and the agent receives short-lived scoped access tokens, so raw Google credentials never enter the agent context.

### Can I run transactions with the Cloud Datastore API?

Yes. Call POST /v1/projects/{projectId}:beginTransaction to obtain a transaction id, perform lookups and queries with that id, then commit the mutations atomically with POST /v1/projects/{projectId}:commit, or roll back via :rollback. Conflicts on serializable transactions are surfaced and require client retry.

### What are the rate limits for the Cloud Datastore API?

Google enforces standard Cloud quotas on datastore.googleapis.com: per-project read/write entity-operation quotas, transaction quotas, and admin operation limits for export and import. Quotas are visible in the Cloud Console under IAM and admin, quotas, filtered to datastore.googleapis.com.

### How do I run a GQL query through Jentic?

Search Jentic for 'run a datastore gql query', load the schema for POST /v1/projects/{projectId}:runQuery, and execute it with gqlQuery.queryString set. Jentic returns the batch of entities and the cursor for paginated continuation.

### Is the Cloud Datastore API free?

Datastore has a daily free tier (entity reads, writes, deletes, and a stored-data allowance). Beyond the free tier you pay per million entity operations and per GiB of stored data; see the official pricing page for current rates.

### How do I export a Datastore kind to Cloud Storage?

Call POST /v1/projects/{projectId}:export with outputUrlPrefix as a gs:// URI and entityFilter listing kinds and namespaces. The response is a long-running operation; poll its name endpoint until done is true and metadata.outputUrlPrefix is set.

### Can I limit what my agent is allowed to do with the Cloud Datastore API?

Yes. Jentic One is self-hosted, so your own rules decide which Cloud Datastore operations and credentials the agent may use. Because every call carries the project id in its path, such as POST /v1/projects/{projectId}:runQuery and :commit, you can pin the agent to a single project. You also choose the operations it may call, so it can look up entities and run GQL queries while commit, export, and rollback stay out of reach unless you grant them.
