Method: projects.instances.databases.sessions.batchCreate

Creates multiple new sessions.

This API can be used to initialize a session cache on the clients. See for best practices on session cache management.

HTTP request


The URL uses gRPC Transcoding syntax.

Path parameters



Required. The database in which the new sessions are created.

Authorization requires the following Google IAM permission on the specified resource database:

  • spanner.sessions.create

Request body

The request body contains data with the following structure:

JSON representation
  "sessionTemplate": {
    object (Session)
  "sessionCount": number

object (Session)

Parameters to be applied to each created session.



Required. The number of sessions to be created in this batch call. The API may return fewer than the requested number of sessions. If a specific number of sessions are desired, the client can make additional calls to sessions.batchCreate (adjusting sessionCount as necessary).

Response body

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

The response for sessions.batchCreate.

JSON representation
  "session": [
      object (Session)

object (Session)

The freshly created sessions.

Authorization Scopes

Requires one of the following OAuth scopes:


For more information, see the Authentication Overview.

Try it!

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Spanner
Need help? Visit our support page.