> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seam.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Client Session

> Creates a new [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).



## OpenAPI

````yaml /openapi.json post /client_sessions/create
openapi: 3.0.0
info:
  title: Seam Connect
  version: 1.0.0
servers:
  - url: https://connect.getseam.com
security: []
tags:
  - description: access_codes
    name: /access_codes
  - description: acs
    name: /acs
  - description: action_attempts
    name: /action_attempts
  - description: client_sessions
    name: /client_sessions
  - description: connected_accounts
    name: /connected_accounts
  - description: connect_webviews
    name: /connect_webviews
  - description: devices
    name: /devices
  - description: events
    name: /events
  - description: health
    name: /health
  - description: locks
    name: /locks
  - description: networks
    name: /networks
  - description: noise_sensors
    name: /noise_sensors
  - description: phones
    name: /phones
  - description: thermostats
    name: /thermostats
  - description: user_identities
    name: /user_identities
  - description: webhooks
    name: /webhooks
  - description: workspaces
    name: /workspaces
paths:
  /client_sessions/create:
    post:
      tags:
        - /client_sessions
      summary: Create a Client Session
      description: >-
        Creates a new [client
        session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
      operationId: clientSessionsCreatePost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                connect_webview_ids:
                  description: >-
                    IDs of the [Connect
                    Webviews](https://docs.seam.co/core-concepts/connect-webviews)
                    for which you want to create a client session.
                  items:
                    type: string
                  type: array
                connected_account_ids:
                  description: >-
                    IDs of the [connected
                    accounts](https://docs.seam.co/core-concepts/connected-accounts)
                    for which you want to create a client session.
                  items:
                    type: string
                  type: array
                customer_id:
                  description: >-
                    Customer ID that you want to associate with the new client
                    session.
                  type: string
                customer_key:
                  description: >-
                    Customer key that you want to associate with the new client
                    session.
                  minLength: 1
                  type: string
                expires_at:
                  description: >-
                    Date and time at which the client session should expire, in
                    [ISO
                    8601](https://www.iso.org/iso-8601-date-and-time-format.html)
                    format.
                  format: date-time
                  type: string
                user_identifier_key:
                  description: >-
                    Your user ID for the user for whom you want to create a
                    client session.
                  minLength: 1
                  type: string
                user_identity_id:
                  description: >-
                    ID of the [user
                    identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity)
                    for which you want to create a client session.
                  format: uuid
                  type: string
                user_identity_ids:
                  deprecated: true
                  description: >-
                    IDs of the [user
                    identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity)
                    that you want to associate with the client session.
                  items:
                    format: uuid
                    type: string
                  maxItems: 1
                  minItems: 1
                  type: array
                  x-deprecated: Use `user_identity_id` instead.
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  client_session:
                    $ref: '#/components/schemas/client_session'
                  ok:
                    type: boolean
                required:
                  - client_session
                  - ok
                type: object
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
      security:
        - publishable_key: []
        - api_key: []
        - pat_with_workspace: []
        - console_session_with_workspace: []
      x-codeSamples:
        - lang: javascript
          label: Seam SDK
          source: |-
            await seam.clientSessions.create({
              customer_id: "e387e15f-be27-47ad-881f-4a6fc5460c57",
              customer_key: "My Company",
              user_identifier_key: "jane_doe",
              connect_webview_ids: ["dafe6400-7484-4fd1-8c17-1c901b444250"],
              connected_account_ids: ["8062d457-e28e-481f-aecc-509905627511"],
              user_identity_id: "89765fd3-6193-4d63-8605-e77f75356555",
              expires_at: "2025-06-19T15:22:40.000Z",
            });

            /*
            {
              "client_session_id": "c2cbd177-1ace-414b-bb1e-9f129e4a05c1",
              "connect_webview_ids": [
                "dafe6400-7484-4fd1-8c17-1c901b444250"
              ],
              "connected_account_ids": [
                "8062d457-e28e-481f-aecc-509905627511"
              ],
              "created_at": "2025-06-15T16:54:17.946309Z",
              "customer_id": "e387e15f-be27-47ad-881f-4a6fc5460c57",
              "device_count": 1,
              "expires_at": "2025-06-19T15:22:40.000Z",
              "token": "seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",
              "user_identifier_key": "jane_doe",
              "user_identity_id": "89765fd3-6193-4d63-8605-e77f75356555",
              "workspace_id": "b887bf84-9849-4454-a562-cf84293d9781"
            }
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/client_sessions/create" \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "customer_id": "e387e15f-be27-47ad-881f-4a6fc5460c57",
              "customer_key": "My Company",
              "user_identifier_key": "jane_doe",
              "connect_webview_ids": [
                "dafe6400-7484-4fd1-8c17-1c901b444250"
              ],
              "connected_account_ids": [
                "8062d457-e28e-481f-aecc-509905627511"
              ],
              "user_identity_id": "89765fd3-6193-4d63-8605-e77f75356555",
              "expires_at": "2025-06-19T15:22:40.000Z"
            }

            EOF


            # Response:

            # {

            #   "client_session": {

            #     "client_session_id": "c2cbd177-1ace-414b-bb1e-9f129e4a05c1",

            #     "connect_webview_ids": [

            #       "dafe6400-7484-4fd1-8c17-1c901b444250"

            #     ],

            #     "connected_account_ids": [

            #       "8062d457-e28e-481f-aecc-509905627511"

            #     ],

            #     "created_at": "2025-06-15T16:54:17.946309Z",

            #     "customer_id": "e387e15f-be27-47ad-881f-4a6fc5460c57",

            #     "device_count": 1,

            #     "expires_at": "2025-06-19T15:22:40.000Z",

            #     "token": "seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",

            #     "user_identifier_key": "jane_doe",

            #     "user_identity_id": "89765fd3-6193-4d63-8605-e77f75356555",

            #     "workspace_id": "b887bf84-9849-4454-a562-cf84293d9781"

            #   }

            # }
        - lang: python
          label: Seam SDK
          source: |-
            seam.client_sessions.create(
                customer_id="e387e15f-be27-47ad-881f-4a6fc5460c57",
                customer_key="My Company",
                user_identifier_key="jane_doe",
                connect_webview_ids=["dafe6400-7484-4fd1-8c17-1c901b444250"],
                connected_account_ids=["8062d457-e28e-481f-aecc-509905627511"],
                user_identity_id="89765fd3-6193-4d63-8605-e77f75356555",
                expires_at="2025-06-19T15:22:40.000Z",
            )

            # ClientSession(
                client_session_id="c2cbd177-1ace-414b-bb1e-9f129e4a05c1",
                connect_webview_ids=["dafe6400-7484-4fd1-8c17-1c901b444250"],
                connected_account_ids=["8062d457-e28e-481f-aecc-509905627511"],
                created_at="2025-06-15T16:54:17.946309Z",
                customer_id="e387e15f-be27-47ad-881f-4a6fc5460c57",
                device_count=1,
                expires_at="2025-06-19T15:22:40.000Z",
                token="seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",
                user_identifier_key="jane_doe",
                user_identity_id="89765fd3-6193-4d63-8605-e77f75356555",
                workspace_id="b887bf84-9849-4454-a562-cf84293d9781",
            )
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.client_sessions.create(
              customer_id: "e387e15f-be27-47ad-881f-4a6fc5460c57",
              customer_key: "My Company",
              user_identifier_key: "jane_doe",
              connect_webview_ids: ["dafe6400-7484-4fd1-8c17-1c901b444250"],
              connected_account_ids: ["8062d457-e28e-481f-aecc-509905627511"],
              user_identity_id: "89765fd3-6193-4d63-8605-e77f75356555",
              expires_at: "2025-06-19T15:22:40.000Z",
            )

            # => {
              "client_session_id" => "c2cbd177-1ace-414b-bb1e-9f129e4a05c1",
              "connect_webview_ids" => ["dafe6400-7484-4fd1-8c17-1c901b444250"],
              "connected_account_ids" => ["8062d457-e28e-481f-aecc-509905627511"],
              "created_at" => "2025-06-15T16:54:17.946309Z",
              "customer_id" => "e387e15f-be27-47ad-881f-4a6fc5460c57",
              "device_count" => 1,
              "expires_at" => "2025-06-19T15:22:40.000Z",
              "token" => "seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",
              "user_identifier_key" => "jane_doe",
              "user_identity_id" => "89765fd3-6193-4d63-8605-e77f75356555",
              "workspace_id" => "b887bf84-9849-4454-a562-cf84293d9781",
            }
        - lang: php
          label: Seam SDK
          source: |-
            $seam->client_sessions->create(
                customer_id: "e387e15f-be27-47ad-881f-4a6fc5460c57",
                customer_key: "My Company",
                user_identifier_key: "jane_doe",
                connect_webview_ids: ["dafe6400-7484-4fd1-8c17-1c901b444250"],
                connected_account_ids: ["8062d457-e28e-481f-aecc-509905627511"],
                user_identity_id: "89765fd3-6193-4d63-8605-e77f75356555",
                expires_at: "2025-06-19T15:22:40.000Z",
            );

            // [
                "client_session_id" => "c2cbd177-1ace-414b-bb1e-9f129e4a05c1",
                "connect_webview_ids" => ["dafe6400-7484-4fd1-8c17-1c901b444250"],
                "connected_account_ids" => ["8062d457-e28e-481f-aecc-509905627511"],
                "created_at" => "2025-06-15T16:54:17.946309Z",
                "customer_id" => "e387e15f-be27-47ad-881f-4a6fc5460c57",
                "device_count" => 1,
                "expires_at" => "2025-06-19T15:22:40.000Z",
                "token" => "seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",
                "user_identifier_key" => "jane_doe",
                "user_identity_id" => "89765fd3-6193-4d63-8605-e77f75356555",
                "workspace_id" => "b887bf84-9849-4454-a562-cf84293d9781",
            ];
        - lang: bash
          label: Seam CLI
          source: >-
            seam client-sessions create --customer_id
            "e387e15f-be27-47ad-881f-4a6fc5460c57" --customer_key "My Company"
            --user_identifier_key "jane_doe" --connect_webview_ids
            ["dafe6400-7484-4fd1-8c17-1c901b444250"] --connected_account_ids
            ["8062d457-e28e-481f-aecc-509905627511"] --user_identity_id
            "89765fd3-6193-4d63-8605-e77f75356555" --expires_at
            "2025-06-19T15:22:40.000Z"


            # {

            #   "client_session_id": "c2cbd177-1ace-414b-bb1e-9f129e4a05c1",

            #   "connect_webview_ids": [

            #     "dafe6400-7484-4fd1-8c17-1c901b444250"

            #   ],

            #   "connected_account_ids": [

            #     "8062d457-e28e-481f-aecc-509905627511"

            #   ],

            #   "created_at": "2025-06-15T16:54:17.946309Z",

            #   "customer_id": "e387e15f-be27-47ad-881f-4a6fc5460c57",

            #   "device_count": 1,

            #   "expires_at": "2025-06-19T15:22:40.000Z",

            #   "token": "seam_cst1891oqCmD_6dBwV8PJ2Fsoe9dWYVyMfVHq",

            #   "user_identifier_key": "jane_doe",

            #   "user_identity_id": "89765fd3-6193-4d63-8605-e77f75356555",

            #   "workspace_id": "b887bf84-9849-4454-a562-cf84293d9781"

            # }
components:
  schemas:
    client_session:
      description: >-
        Represents a [client
        session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
        If you want to restrict your users' access to their own devices, use
        client sessions.
      properties:
        client_session_id:
          description: >-
            ID of the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          format: uuid
          type: string
        connect_webview_ids:
          description: >-
            IDs of the [Connect
            Webviews](https://docs.seam.co/core-concepts/connect-webviews)
            associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          items:
            format: uuid
            type: string
          type: array
        connected_account_ids:
          description: >-
            IDs of the [connected
            accounts](https://docs.seam.co/core-concepts/connected-accounts)
            associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          items:
            format: uuid
            type: string
          type: array
        created_at:
          description: >-
            Date and time at which the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens)
            was created.
          format: date-time
          type: string
        customer_key:
          description: >-
            Customer key associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          type: string
        device_count:
          description: >-
            Number of devices associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          format: float
          type: number
        expires_at:
          description: >-
            Date and time at which the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens)
            expires.
          format: date-time
          type: string
        token:
          description: >-
            Client session token associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          type: string
        user_identifier_key:
          description: >-
            Your user ID for the user associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          nullable: true
          type: string
        user_identity_id:
          description: >-
            ID of the [user
            identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity)
            associated with the client session.
          format: uuid
          type: string
        user_identity_ids:
          deprecated: true
          description: >-
            IDs of the [user
            identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity)
            associated with the client session.
          items:
            format: uuid
            type: string
          type: array
          x-deprecated: Use `user_identity_id` instead.
        workspace_id:
          description: >-
            ID of the [workspace](https://docs.seam.co/core-concepts/workspaces)
            associated with the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens).
          format: uuid
          type: string
      required:
        - client_session_id
        - workspace_id
        - created_at
        - expires_at
        - token
        - user_identifier_key
        - device_count
        - connected_account_ids
        - connect_webview_ids
        - user_identity_ids
      type: object
      x-route-path: /client_sessions
  securitySchemes:
    publishable_key:
      in: header
      name: seam-publishable-key
      type: apiKey
    api_key:
      bearerFormat: API Key
      scheme: bearer
      type: http
    pat_with_workspace:
      bearerFormat: API Token
      scheme: bearer
      type: http
    console_session_with_workspace:
      bearerFormat: Console Session Token
      scheme: bearer
      type: http

````