> ## 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.

# Grant Access to a Client Session

> Grants a [client session](https://docs.seam.co/core-concepts/authentication/client-session-tokens) access to one or more resources, such as [Connect Webviews](https://docs.seam.co/core-concepts/connect-webviews), [user identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity), and so on.



## OpenAPI

````yaml /openapi.json post /client_sessions/grant_access
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/grant_access:
    post:
      tags:
        - /client_sessions
      summary: Grant Access to a Client Session
      description: >-
        Grants a [client
        session](https://docs.seam.co/core-concepts/authentication/client-session-tokens)
        access to one or more resources, such as [Connect
        Webviews](https://docs.seam.co/core-concepts/connect-webviews), [user
        identities](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity),
        and so on.
      operationId: clientSessionsGrantAccessPost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                client_session_id:
                  description: >-
                    ID of the client session to which you want to grant access
                    to resources.
                  type: string
                connect_webview_ids:
                  description: >-
                    IDs of the [Connect
                    Webviews](https://docs.seam.co/core-concepts/connect-webviews)
                    that you want to associate with the client session.
                  items:
                    type: string
                  type: array
                connected_account_ids:
                  description: >-
                    IDs of the [connected
                    accounts](https://docs.seam.co/core-concepts/connected-accounts)
                    that you want to associate with the client session.
                  items:
                    type: string
                  type: array
                user_identifier_key:
                  description: >-
                    Your user ID for the user that you want to associate with
                    the client session.
                  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)
                    that you want to associate with the client session.
                  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:
                    type: string
                  maxItems: 1
                  minItems: 1
                  type: array
                  x-deprecated: Use `user_identity_id`.
              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:
        - api_key: []
        - pat_with_workspace: []
        - console_session_with_workspace: []
      x-codeSamples:
        - lang: javascript
          label: Seam SDK
          source: |-
            await seam.clientSessions.grantAccess({
              client_session_id: "3ada79d3-2848-4320-b2ef-a82e1e6dafac",
              user_identifier_key: "jane_doe",
              connected_account_ids: ["c35ecf64-474a-466a-95a6-7b35cb4c8bb4"],
              connect_webview_ids: ["dad03fb2-f801-449c-ab88-0529728c7c38"],
              user_identity_id: "bde98963-3615-4e92-943e-17de3017232b",
            });

            /*
            // void
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/client_sessions/grant_access" \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "client_session_id": "3ada79d3-2848-4320-b2ef-a82e1e6dafac",
              "user_identifier_key": "jane_doe",
              "connected_account_ids": [
                "c35ecf64-474a-466a-95a6-7b35cb4c8bb4"
              ],
              "connect_webview_ids": [
                "dad03fb2-f801-449c-ab88-0529728c7c38"
              ],
              "user_identity_id": "bde98963-3615-4e92-943e-17de3017232b"
            }

            EOF


            # Response:

            # {}
        - lang: python
          label: Seam SDK
          source: |-
            seam.client_sessions.grant_access(
                client_session_id="3ada79d3-2848-4320-b2ef-a82e1e6dafac",
                user_identifier_key="jane_doe",
                connected_account_ids=["c35ecf64-474a-466a-95a6-7b35cb4c8bb4"],
                connect_webview_ids=["dad03fb2-f801-449c-ab88-0529728c7c38"],
                user_identity_id="bde98963-3615-4e92-943e-17de3017232b",
            )

            # None
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.client_sessions.grant_access(
              client_session_id: "3ada79d3-2848-4320-b2ef-a82e1e6dafac",
              user_identifier_key: "jane_doe",
              connected_account_ids: ["c35ecf64-474a-466a-95a6-7b35cb4c8bb4"],
              connect_webview_ids: ["dad03fb2-f801-449c-ab88-0529728c7c38"],
              user_identity_id: "bde98963-3615-4e92-943e-17de3017232b",
            )

            # => nil
        - lang: php
          label: Seam SDK
          source: |-
            $seam->client_sessions->grant_access(
                client_session_id: "3ada79d3-2848-4320-b2ef-a82e1e6dafac",
                user_identifier_key: "jane_doe",
                connected_account_ids: ["c35ecf64-474a-466a-95a6-7b35cb4c8bb4"],
                connect_webview_ids: ["dad03fb2-f801-449c-ab88-0529728c7c38"],
                user_identity_id: "bde98963-3615-4e92-943e-17de3017232b",
            );
        - lang: bash
          label: Seam CLI
          source: >-
            seam client-sessions grant-access --client_session_id
            "3ada79d3-2848-4320-b2ef-a82e1e6dafac" --user_identifier_key
            "jane_doe" --connected_account_ids
            ["c35ecf64-474a-466a-95a6-7b35cb4c8bb4"] --connect_webview_ids
            ["dad03fb2-f801-449c-ab88-0529728c7c38"] --user_identity_id
            "bde98963-3615-4e92-943e-17de3017232b"


            # {}
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:
    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

````