# Method: projects.databases.documents.beginTransaction

Starts a new transaction.

### HTTP request

`POST https://firestore.googleapis.com/v1/{database=projects/*/databases/*}/documents:beginTransaction`

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters  |  
| ---  |  
| `database`  | `string`  <br>Required. The database name. In the format: `projects/{projectId}/databases/{databaseId}`.  |

### Request body

The request body contains data with the following structure:

| JSON representation  |
| ---  |
| ```  <br>{  <br>  "options": {  <br>    object (TransactionOptions)  <br>  }  <br>}  <br>```  |

| Fields  |
| ---  |
| `options`  | `object (TransactionOptions)`  <br>The options for the transaction. Defaults to a read-write transaction.  |

### Response body

The response for `Firestore.BeginTransaction`.

If successful, the response body contains data with the following structure:

| JSON representation  |
| ---  |
| ```  <br>{  <br>  "transaction": string  <br>}  <br>```  |

| Fields  |
| ---  |
| `transaction`  | `string (bytes format)`  <br>The transaction that was started.<br>A base64-encoded string.  |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/datastore`
- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).

---
