Transactions can be created explicitly with calls to Datastore.BeginTransaction or implicitly by setting ReadOptions.new_transaction in read requests.
JSON representation
{// Union field mode can be only one of the following:"readWrite": {object (ReadWrite)},"readOnly": {object (ReadOnly)}// End of list of possible types for union field mode.}
Fields
Union field mode. The mode of the transaction, indicating whether write operations are supported. mode can be only one of the following:
This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days.
Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted.Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-30 UTC."],[[["\u003cp\u003eThis page documents the process of beginning a new transaction in the Datastore API using an HTTP POST request to the specified URL, \u003ccode\u003ehttps://datastore.googleapis.com/v1beta3/projects/{projectId}:beginTransaction\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires a \u003ccode\u003eprojectId\u003c/code\u003e path parameter and a request body containing \u003ccode\u003etransactionOptions\u003c/code\u003e that specify the type of transaction, either \u003ccode\u003ereadWrite\u003c/code\u003e or \u003ccode\u003ereadOnly\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe response body returns a \u003ccode\u003etransaction\u003c/code\u003e field which is a base64-encoded string representing the transaction identifier, necessary for subsequent operations.\u003c/p\u003e\n"],["\u003cp\u003eTransactions can be read-write, allowing both reads and writes, or read-only, which only allows reads, and the read-only transaction allows for a specific \u003ccode\u003ereadTime\u003c/code\u003e which can be specified for temporal queries.\u003c/p\u003e\n"],["\u003cp\u003eTo successfully begin a transaction, one of the following authorization scopes is required: \u003ccode\u003ehttps://www.googleapis.com/auth/datastore\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Method: projects.beginTransaction\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.BeginTransactionResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [TransactionOptions](#TransactionOptions)\n - [JSON representation](#TransactionOptions.SCHEMA_REPRESENTATION)\n- [ReadWrite](#ReadWrite)\n - [JSON representation](#ReadWrite.SCHEMA_REPRESENTATION)\n- [ReadOnly](#ReadOnly)\n - [JSON representation](#ReadOnly.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nBegins a new transaction.\n\n### HTTP request\n\n`POST https://datastore.googleapis.com/v1beta3/projects/{projectId}:beginTransaction`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Request body\n\nThe request body contains data with the following structure:\n\n### Response body\n\nThe response for [Datastore.BeginTransaction](/datastore/docs/reference/data/rest/v1beta3/projects/beginTransaction#google.datastore.v1beta3.Datastore.BeginTransaction).\n\nIf successful, the response body contains data with the following structure:\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/datastore`\n- `https://www.googleapis.com/auth/cloud-platform`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp).\n\nTransactionOptions\n------------------\n\nOptions for beginning a new transaction.\n\nTransactions can be created explicitly with calls to [Datastore.BeginTransaction](/datastore/docs/reference/data/rest/v1beta3/projects/beginTransaction#google.datastore.v1beta3.Datastore.BeginTransaction) or implicitly by setting `ReadOptions.new_transaction` in read requests.\n\nReadWrite\n---------\n\nOptions specific to read / write transactions.\n\nReadOnly\n--------\n\nOptions specific to read-only transactions."]]