> ## 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 a User Identity Access to a Device

> Grants a specified [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) access to a specified [device](https://docs.seam.co/core-concepts/devices).



## OpenAPI

````yaml /openapi.json post /user_identities/grant_access_to_device
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:
  /user_identities/grant_access_to_device:
    post:
      tags:
        - /user_identities
      summary: Grant a User Identity Access to a Device
      description: >-
        Grants a specified [user
        identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity)
        access to a specified
        [device](https://docs.seam.co/core-concepts/devices).
      operationId: userIdentitiesGrantAccessToDevicePost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                device_id:
                  description: >-
                    ID of the managed device to which you want to grant access
                    to the user identity.
                  format: uuid
                  type: string
                user_identity_id:
                  description: >-
                    ID of the user identity that you want to grant access to a
                    device.
                  format: uuid
                  type: string
              required:
                - user_identity_id
                - device_id
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  ok:
                    type: boolean
                required:
                  - 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.userIdentities.grantAccessToDevice({
              user_identity_id: "4e9b7099-bcad-4af6-bb78-88b96cc347bd",
              device_id: "6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8",
            });

            /*
            // void
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/user_identities/grant_access_to_device"
            \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "user_identity_id": "4e9b7099-bcad-4af6-bb78-88b96cc347bd",
              "device_id": "6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8"
            }

            EOF


            # Response:

            # {}
        - lang: python
          label: Seam SDK
          source: |-
            seam.user_identities.grant_access_to_device(
                user_identity_id="4e9b7099-bcad-4af6-bb78-88b96cc347bd",
                device_id="6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8",
            )

            # None
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.user_identities.grant_access_to_device(
              user_identity_id: "4e9b7099-bcad-4af6-bb78-88b96cc347bd",
              device_id: "6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8",
            )

            # => nil
        - lang: php
          label: Seam SDK
          source: |-
            $seam->user_identities->grant_access_to_device(
                user_identity_id: "4e9b7099-bcad-4af6-bb78-88b96cc347bd",
                device_id: "6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8",
            );
        - lang: bash
          label: Seam CLI
          source: >-
            seam user-identities grant-access-to-device --user_identity_id
            "4e9b7099-bcad-4af6-bb78-88b96cc347bd" --device_id
            "6de31c5d-c8a3-4b25-a86b-a9c5075a5eb8"


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

````