The response is a 200 OK status code. The response body contains JSON representations of all
existing sessions that match the start and end times provided in the query parameters.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[[["\u003cp\u003eThe Fitness REST API allows you to create and retrieve fitness sessions, which represent periods of user activity.\u003c/p\u003e\n"],["\u003cp\u003eSessions are managed using the \u003ccode\u003eUsers.session\u003c/code\u003e resource and contain data like start/end times, activity type, and optional metadata.\u003c/p\u003e\n"],["\u003cp\u003eYou can insert new sessions using a PUT request to the API with session details in the request body.\u003c/p\u003e\n"],["\u003cp\u003eExisting sessions can be listed by sending a GET request with optional start and end time parameters to filter results.\u003c/p\u003e\n"],["\u003cp\u003eFor best practices on handling user data, refer to the Responsible use of Google Fit guidelines.\u003c/p\u003e\n"]]],[],null,["# Working with Sessions\n\nThe Fitness REST API lets you create and obtain sessions. Sessions represent a time interval\nduring which users perform a fitness activity.\n\nSessions are represented by the [`Users.session`](/fit/rest/v1/reference/users/sessions) resource.\n\nActivities are stored in an ['ActivityType'](/fit/rest/v1/reference/activity-types)\ninteger.\n| **Important:** For best practices when managing user data, see [Responsible use of Google Fit](/fit/overview#responsible_use_of_google_fit).\n\nInsert a session\n----------------\n\nThis example demonstrates how to insert a session.\n\nHTTP method\n: PUT\n\nRequest URL\n: `https://www.googleapis.com/fitness/v1/users/me/sessions/`**someSessionId**\n\nRequest body\n:\n\n {\n \"id\": \"someSessionId\",\n \"name\": \"My example workout\",\n \"description\": \"A very intense workout\",\n \"startTimeMillis\": 1396710000000,\n \"endTimeMillis\": 1396713600000,\n \"version\": 1,\n \"lastModifiedToken\": \"exampleToken\",\n \"application\": {\n \"detailsUrl\": \"http://example.com\",\n \"name\": \"Foo Example App\",\n \"version\": \"1.0\"\n },\n \"activityType\": 1\n }\n\nResponse\n\n: The response is a `200 OK` status code. The response body contains a JSON representation of the\n session.\n\nCurl command\n:\n\n ```\n $ curl --header \"Authorization: Bearer ya29.1.yourtokenvalue\" -X PUT \\\n --header \"Content-Type: application/json;encoding=utf-8\" -d @createsession.json \\\n \"https://www.googleapis.com/fitness/v1/users/me/sessions/someSessionId\"\n ```\n\nList existing sessions\n----------------------\n\nThis example demonstrates how to list existing sessions from April 2014.\n\nHTTP method\n: GET\n\nRequest URL\n: `https://www.googleapis.com/fitness/v1/users/me/sessions`**?startTime=2014-04-01T00:00:00.000Z&endTime=2014-04-30T23:59:59.999Z**\n\nRequest body\n: None.\n\nResponse\n: The response is a `200 OK` status code. The response body contains JSON representations of all\n existing sessions that match the start and end times provided in the query parameters.\n\nCurl command\n:\n\n ```\n $ curl --header \"Authorization: Bearer ya29.1.yourtokenvalue\" -X GET \\\n --header \"Content-Type: application/json;encoding=utf-8\" \\\n \"https://www.googleapis.com/fitness/v1/users/me/sessions?startTime=2014-04-01T00:00:00.000Z&endTime=2014-04-30T23:59:59.999Z\"\n ```"]]