---
title: "PUT /{userId}/sessions/{sessionId}"
method: PUT
path: "/{userId}/sessions/{sessionId}"
tags: ["users"]
---

# PUT /{userId}/sessions/{sessionId}

`PUT /{userId}/sessions/{sessionId}`

Updates or insert a given session.

## Path parameters

- `userId` string, required
- `sessionId` string, required

## Request body

- Session — Sessions contain metadata, such as a user-friendly name and time interval information.
  - `id` string — A client-generated identifier that is unique across all sessions owned by this particular user.
  - `application` Application
    - `packageName` string — Package name for this application. This is used as a unique identifier when created by Android applications, but cannot be specified by REST clients. REST clients will have their developer project number reflected into the Data Source data stream IDs, instead of the packageName.
    - `detailsUrl` string — An optional URI that can be used to link back to the application.
    - `name` string — The name of this application. This is required for REST clients, but we do not enforce uniqueness of this name. It is provided as a matter of convenience for other developers who would like to identify which REST created an Application or Data Source.
    - `version` string — Version of the application. You should update this field whenever the application changes in a way that affects the computation of the data.
  - `name` string — A human readable name of the session.
  - `description` string — A description for this session.
  - `modifiedTimeMillis` string, int64 — A timestamp that indicates when the session was last modified.
  - `endTimeMillis` string, int64 — An end time, in milliseconds since epoch, inclusive.
  - `activeTimeMillis` string, int64 — Session active time. While start_time_millis and end_time_millis define the full session time, the active time can be shorter and specified by active_time_millis. If the inactive time during the session is known, it should also be inserted via a com.google.activity.segment data point with a STILL activity value
  - `startTimeMillis` string, int64 — A start time, in milliseconds since epoch, inclusive.
  - `activityType` integer — The type of activity this session represents.

## Response `200`

Successful response

---

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