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

# Generate an Instant Key

> Generates a new [instant key](https://docs.seam.co/capability-guides/instant-keys) for 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).



## OpenAPI

````yaml /openapi.json post /user_identities/generate_instant_key
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/generate_instant_key:
    post:
      tags:
        - /user_identities
      summary: Generate an Instant Key
      description: >-
        Generates a new [instant
        key](https://docs.seam.co/capability-guides/instant-keys) for 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).
      operationId: userIdentitiesGenerateInstantKeyPost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                customization_profile_id:
                  format: uuid
                  type: string
                max_use_count:
                  default: 1
                  description: >-
                    Maximum number of times the instant key can be used.
                    Default: 1.
                  format: float
                  type: number
                user_identity_id:
                  description: >-
                    ID of the user identity for which you want to generate an
                    instant key.
                  format: uuid
                  type: string
              required:
                - user_identity_id
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  instant_key:
                    $ref: '#/components/schemas/instant_key'
                  ok:
                    type: boolean
                required:
                  - instant_key
                  - 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.generateInstantKey({
              user_identity_id: "d92e0c7b-72a1-4063-9ee8-2acefc240358",
              max_use_count: 10,
            });

            /*
            {
              "client_session_id": "bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",
              "created_at": "2025-06-14T16:54:17.946559Z",
              "expires_at": "2025-06-16T16:54:17.946559Z",
              "instant_key_id": "1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",
              "instant_key_url": "https://ik.seam.co/ABCXYZ",
              "user_identity_id": "d92e0c7b-72a1-4063-9ee8-2acefc240358",
              "workspace_id": "4d1c24b2-781e-4d1a-8d77-15249ad57c8a"
            }
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/user_identities/generate_instant_key" \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "user_identity_id": "d92e0c7b-72a1-4063-9ee8-2acefc240358",
              "max_use_count": 10
            }

            EOF


            # Response:

            # {

            #   "instant_key": {

            #     "client_session_id": "bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",

            #     "created_at": "2025-06-14T16:54:17.946559Z",

            #     "expires_at": "2025-06-16T16:54:17.946559Z",

            #     "instant_key_id": "1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",

            #     "instant_key_url": "https://ik.seam.co/ABCXYZ",

            #     "user_identity_id": "d92e0c7b-72a1-4063-9ee8-2acefc240358",

            #     "workspace_id": "4d1c24b2-781e-4d1a-8d77-15249ad57c8a"

            #   }

            # }
        - lang: python
          label: Seam SDK
          source: |-
            seam.user_identities.generate_instant_key(
                user_identity_id="d92e0c7b-72a1-4063-9ee8-2acefc240358", max_use_count=10
            )

            # InstantKey(
                client_session_id="bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",
                created_at="2025-06-14T16:54:17.946559Z",
                expires_at="2025-06-16T16:54:17.946559Z",
                instant_key_id="1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",
                instant_key_url="https://ik.seam.co/ABCXYZ",
                user_identity_id="d92e0c7b-72a1-4063-9ee8-2acefc240358",
                workspace_id="4d1c24b2-781e-4d1a-8d77-15249ad57c8a",
            )
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.user_identities.generate_instant_key(
              user_identity_id: "d92e0c7b-72a1-4063-9ee8-2acefc240358",
              max_use_count: 10,
            )

            # => {
              "client_session_id" => "bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",
              "created_at" => "2025-06-14T16:54:17.946559Z",
              "expires_at" => "2025-06-16T16:54:17.946559Z",
              "instant_key_id" => "1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",
              "instant_key_url" => "https://ik.seam.co/ABCXYZ",
              "user_identity_id" => "d92e0c7b-72a1-4063-9ee8-2acefc240358",
              "workspace_id" => "4d1c24b2-781e-4d1a-8d77-15249ad57c8a",
            }
        - lang: php
          label: Seam SDK
          source: |-
            $seam->user_identities->generate_instant_key(
                user_identity_id: "d92e0c7b-72a1-4063-9ee8-2acefc240358",
                max_use_count: 10,
            );

            // [
                "client_session_id" => "bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",
                "created_at" => "2025-06-14T16:54:17.946559Z",
                "expires_at" => "2025-06-16T16:54:17.946559Z",
                "instant_key_id" => "1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",
                "instant_key_url" => "https://ik.seam.co/ABCXYZ",
                "user_identity_id" => "d92e0c7b-72a1-4063-9ee8-2acefc240358",
                "workspace_id" => "4d1c24b2-781e-4d1a-8d77-15249ad57c8a",
            ];
        - lang: bash
          label: Seam CLI
          source: >-
            seam user-identities generate-instant-key --user_identity_id
            "d92e0c7b-72a1-4063-9ee8-2acefc240358" --max_use_count 10


            # {

            #   "client_session_id": "bfe3b1c6-fb9e-48b1-9b5b-c762b2983af6",

            #   "created_at": "2025-06-14T16:54:17.946559Z",

            #   "expires_at": "2025-06-16T16:54:17.946559Z",

            #   "instant_key_id": "1d05c2f6-5b6f-4a9c-b80d-1eca26be12b9",

            #   "instant_key_url": "https://ik.seam.co/ABCXYZ",

            #   "user_identity_id": "d92e0c7b-72a1-4063-9ee8-2acefc240358",

            #   "workspace_id": "4d1c24b2-781e-4d1a-8d77-15249ad57c8a"

            # }
components:
  schemas:
    instant_key:
      description: >-
        Represents a Seam Instant Key. For issuing Bluetooth mobile keys,
        Instant Keys are the fastest way to share access. With a single API
        call, you can create a mobile key and send it through text or email or
        embed it in your own app.
      properties:
        client_session_id:
          description: >-
            ID of the [client
            session](https://docs.seam.co/core-concepts/authentication/client-session-tokens)
            associated with the Instant Key.
          format: uuid
          type: string
        created_at:
          description: Date and time at which the Instant Key was created.
          format: date-time
          type: string
        customization:
          description: Customization applied to the Instant Key UI.
          properties:
            logo_url:
              description: URL of the logo displayed on the Instant Key.
              format: uri
              type: string
            primary_color:
              description: Primary color used in the Instant Key UI.
              type: string
            secondary_color:
              description: Secondary color used in the Instant Key UI.
              type: string
          type: object
        customization_profile_id:
          description: ID of the customization profile associated with the Instant Key.
          format: uuid
          type: string
        expires_at:
          description: Date and time at which the Instant Key expires.
          format: date-time
          type: string
        instant_key_id:
          description: ID of the Instant Key.
          format: uuid
          type: string
        instant_key_url:
          description: >-
            Shareable URL for the Instant Key. Use the URL to deliver the
            Instant Key to your user through a link in a text message or email
            or by embedding it in your web app.
          format: uri
          type: string
        user_identity_id:
          description: ID of the user identity associated with the Instant Key.
          format: uuid
          type: string
        workspace_id:
          description: >-
            ID of the [workspace](https://docs.seam.co/core-concepts/workspaces)
            that contains the Instant Key.
          format: uuid
          type: string
      required:
        - instant_key_id
        - workspace_id
        - created_at
        - instant_key_url
        - client_session_id
        - user_identity_id
        - expires_at
      type: object
      x-route-path: /instant_keys
  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

````