---
title: "POST /v1/{+database}/sessions:batchCreate"
method: POST
path: "/v1/{+database}/sessions:batchCreate"
tags: ["projects"]
---

# POST /v1/{+database}/sessions:batchCreate

`POST /v1/{+database}/sessions:batchCreate`

Creates multiple new sessions. This API can be used to initialize a session cache on the clients. See https://goo.gl/TgSFN2 for best practices on session cache management.

## Path parameters

- `database` string, required

## Request body

- BatchCreateSessionsRequest — The request for BatchCreateSessions.
  - `sessionTemplate` Session — A session in the Cloud Spanner API.
    - `name` string — Output only. The name of the session. This is always system-assigned.
    - `labels` object — The labels for the session. * Label keys must be between 1 and 63 characters long and must conform to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`. * Label values must be between 0 and 63 characters long and must conform to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`. * No more than 64 labels can be associated with a given session. See https://goo.gl/xmQnxf for more information on and examples of labels.
    - `createTime` string, google-datetime — Output only. The timestamp when the session is created.
    - `approximateLastUseTime` string, google-datetime — Output only. The approximate timestamp when the session is last used. It's typically earlier than the actual last use time.
    - `creatorRole` string — The database role which created this session.
    - `multiplexed` boolean — Optional. If `true`, specifies a multiplexed session. Use a multiplexed session for multiple, concurrent operations including any combination of read-only and read-write transactions. Use `sessions.create` to create multiplexed sessions. Don't use BatchCreateSessions to create a multiplexed session. You can't delete or list multiplexed sessions.
  - `sessionCount` integer — Required. The number of sessions to be created in this batch call. At least one session is created. The API can return fewer than the requested number of sessions. If a specific number of sessions are desired, the client can make additional calls to `BatchCreateSessions` (adjusting session_count as necessary).

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/spanner.md) · [All operations](https://skmtc.net/google/apis/spanner/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/spanner/versions/4b66067d2622/schema)
