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

# Simulate Creating an Unmanaged Access Code

> Simulates the creation of an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) in a [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces).



## OpenAPI

````yaml /openapi.json post /access_codes/simulate/create_unmanaged_access_code
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:
  /access_codes/simulate/create_unmanaged_access_code:
    post:
      tags:
        - /access_codes
      summary: Simulate Creating an Unmanaged Access Code
      description: >-
        Simulates the creation of an [unmanaged access
        code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes)
        in a [sandbox
        workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces).
      operationId: accessCodesSimulateCreateUnmanagedAccessCodePost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                code:
                  description: Code of the simulated unmanaged access code.
                  maxLength: 8
                  minLength: 4
                  pattern: ^\d+$
                  type: string
                device_id:
                  description: >-
                    ID of the device for which you want to simulate the creation
                    of an unmanaged access code.
                  format: uuid
                  type: string
                name:
                  description: Name of the simulated unmanaged access code.
                  type: string
              required:
                - device_id
                - name
                - code
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  access_code:
                    $ref: '#/components/schemas/unmanaged_access_code'
                  ok:
                    type: boolean
                required:
                  - access_code
                  - ok
                type: object
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
      security:
        - client_session: []
        - pat_with_workspace: []
        - console_session_with_workspace: []
        - api_key: []
      x-codeSamples:
        - lang: javascript
          label: Seam SDK
          source: |-
            await seam.accessCodes.simulate.createUnmanagedAccessCode({
              device_id: "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
              name: "My Access Code",
              code: "1234",
            });

            /*
            {
              "access_code_id": "88fa1812-bef8-4108-9fb4-4855376c3edf",
              "code": "1234",
              "created_at": "2025-06-16T16:54:17.946283Z",
              "device_id": "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
              "ends_at": "2025-06-23T16:54:17.946261Z",
              "errors": [],
              "is_managed": false,
              "name": "My Access Code",
              "starts_at": "2025-06-21T16:54:17.946261Z",
              "status": "set",
              "type": "time_bound",
              "warnings": [],
              "workspace_id": "750fc0bc-4450-4356-8d9f-18c6a3a6b2c7"
            }
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/access_codes/simulate/create_unmanaged_access_code"
            \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "device_id": "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
              "name": "My Access Code",
              "code": "1234"
            }

            EOF


            # Response:

            # {

            #   "access_code": {

            #     "access_code_id": "88fa1812-bef8-4108-9fb4-4855376c3edf",

            #     "code": "1234",

            #     "created_at": "2025-06-16T16:54:17.946283Z",

            #     "device_id": "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",

            #     "ends_at": "2025-06-23T16:54:17.946261Z",

            #     "errors": [],

            #     "is_managed": false,

            #     "name": "My Access Code",

            #     "starts_at": "2025-06-21T16:54:17.946261Z",

            #     "status": "set",

            #     "type": "time_bound",

            #     "warnings": [],

            #     "workspace_id": "750fc0bc-4450-4356-8d9f-18c6a3a6b2c7"

            #   }

            # }
        - lang: python
          label: Seam SDK
          source: |-
            seam.access_codes.simulate.create_unmanaged_access_code(
                device_id="5db6ef75-2e0d-4491-bf7e-c3eb01d5c963", name="My Access Code", code="1234"
            )

            # UnmanagedAccessCode(
                access_code_id="88fa1812-bef8-4108-9fb4-4855376c3edf",
                code="1234",
                created_at="2025-06-16T16:54:17.946283Z",
                device_id="5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
                ends_at="2025-06-23T16:54:17.946261Z",
                errors=[],
                is_managed=false,
                name="My Access Code",
                starts_at="2025-06-21T16:54:17.946261Z",
                status="set",
                type="time_bound",
                warnings=[],
                workspace_id="750fc0bc-4450-4356-8d9f-18c6a3a6b2c7",
            )
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.access_codes.simulate.create_unmanaged_access_code(
              device_id: "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
              name: "My Access Code",
              code: "1234",
            )

            # => {
              "access_code_id" => "88fa1812-bef8-4108-9fb4-4855376c3edf",
              "code" => "1234",
              "created_at" => "2025-06-16T16:54:17.946283Z",
              "device_id" => "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
              "ends_at" => "2025-06-23T16:54:17.946261Z",
              "errors" => [],
              "is_managed" => false,
              "name" => "My Access Code",
              "starts_at" => "2025-06-21T16:54:17.946261Z",
              "status" => "set",
              "type" => "time_bound",
              "warnings" => [],
              "workspace_id" => "750fc0bc-4450-4356-8d9f-18c6a3a6b2c7",
            }
        - lang: php
          label: Seam SDK
          source: |-
            $seam->access_codes->simulate->create_unmanaged_access_code(
                device_id: "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
                name: "My Access Code",
                code: "1234",
            );

            // [
                "access_code_id" => "88fa1812-bef8-4108-9fb4-4855376c3edf",
                "code" => "1234",
                "created_at" => "2025-06-16T16:54:17.946283Z",
                "device_id" => "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",
                "ends_at" => "2025-06-23T16:54:17.946261Z",
                "errors" => [],
                "is_managed" => false,
                "name" => "My Access Code",
                "starts_at" => "2025-06-21T16:54:17.946261Z",
                "status" => "set",
                "type" => "time_bound",
                "warnings" => [],
                "workspace_id" => "750fc0bc-4450-4356-8d9f-18c6a3a6b2c7",
            ];
        - lang: bash
          label: Seam CLI
          source: >-
            seam access-codes simulate create-unmanaged-access-code --device_id
            "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963" --name "My Access Code"
            --code "1234"


            # {

            #   "access_code_id": "88fa1812-bef8-4108-9fb4-4855376c3edf",

            #   "code": "1234",

            #   "created_at": "2025-06-16T16:54:17.946283Z",

            #   "device_id": "5db6ef75-2e0d-4491-bf7e-c3eb01d5c963",

            #   "ends_at": "2025-06-23T16:54:17.946261Z",

            #   "errors": [],

            #   "is_managed": false,

            #   "name": "My Access Code",

            #   "starts_at": "2025-06-21T16:54:17.946261Z",

            #   "status": "set",

            #   "type": "time_bound",

            #   "warnings": [],

            #   "workspace_id": "750fc0bc-4450-4356-8d9f-18c6a3a6b2c7"

            # }
components:
  schemas:
    unmanaged_access_code:
      description: >-
        Represents an [unmanaged smart lock access
        code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
      properties:
        access_code_id:
          description: Unique identifier for the access code.
          format: uuid
          type: string
        cannot_be_managed:
          description: >-
            Indicates that Seam cannot convert this unmanaged access code to a
            managed access code. Some providers do not support management of
            unmanaged access codes through API integrations.
          enum:
            - true
          type: boolean
        cannot_delete_unmanaged_access_code:
          description: >-
            Indicates that Seam cannot delete this unmanaged access code through
            the provider. If this access code needs to be deleted, it will only
            be possible from the manufacturer app.
          enum:
            - true
          type: boolean
        code:
          description: Code used for access. Typically, a numeric or alphanumeric string.
          nullable: true
          type: string
        created_at:
          description: Date and time at which the access code was created.
          format: date-time
          type: string
        device_id:
          description: Unique identifier for the device associated with the access code.
          format: uuid
          type: string
        dormakaba_oracode_metadata:
          description: >-
            Metadata for a dormakaba Oracode unmanaged access code. Only present
            for unmanaged access codes from dormakaba Oracode devices.
          nullable: true
          properties:
            is_cancellable:
              description: >-
                Indicates whether the stay can be cancelled via the Dormakaba
                Oracode API.
              type: boolean
            is_early_checkin_able:
              description: Indicates whether early check-in is available for this stay.
              type: boolean
            is_extendable:
              description: >-
                Indicates whether the stay can be extended via the Dormakaba
                Oracode API.
              type: boolean
            is_overridable:
              description: >-
                Indicates whether the access code can be overridden. When false,
                the maximum number of overrides has been reached.
              type: boolean
            site_name:
              description: Dormakaba Oracode site name associated with this access code.
              type: string
            stay_id:
              description: Dormakaba Oracode stay ID associated with this access code.
              format: float
              type: number
            user_level_id:
              description: >-
                Dormakaba Oracode user level ID associated with this access
                code.
              type: string
            user_level_name:
              description: >-
                Dormakaba Oracode user level name associated with this access
                code.
              nullable: true
              type: string
          required:
            - stay_id
            - user_level_name
          type: object
        ends_at:
          description: >-
            Date and time after which the time-bound access code becomes
            inactive.
          format: date-time
          nullable: true
          type: string
        errors:
          type: array
          description: >-
            Errors associated with the [access
            code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
          items:
            type: object
            properties:
              error_code:
                type: string
                description: Error or warning code.
              message:
                type: string
                description: Human-readable description.
              created_at:
                type: string
                format: date-time
                description: When this error or warning was generated.
        is_managed:
          description: Indicates that Seam does not manage the access code.
          enum:
            - false
          type: boolean
        name:
          description: >-
            Name of the access code. Enables administrators and users to
            identify the access code easily, especially when there are numerous
            access codes. Note that the name provided on Seam is used to
            identify the code on Seam and is not necessarily the name that will
            appear in the lock provider's app or on the device. This is because
            lock providers may have constraints on names, such as length,
            uniqueness, or characters that can be used. In addition, some lock
            providers may break down names into components such as `first_name`
            and `last_name`. To provide a consistent experience, Seam identifies
            the code on Seam by its name but may modify the name that appears on
            the lock provider's app or on the device. For example, Seam may add
            additional characters or truncate the name to meet provider
            constraints. To help your users identify codes set by Seam, Seam
            provides the name exactly as it appears on the lock provider's app
            or on the device as a separate property called `appearance`. This is
            an object with a `name` property and, optionally, `first_name` and
            `last_name` properties (for providers that break down a name into
            components).
          nullable: true
          type: string
        starts_at:
          description: Date and time at which the time-bound access code becomes active.
          format: date-time
          nullable: true
          type: string
        status:
          description: >-
            Current status of the access code within the operational lifecycle.
            `set` indicates that the code is active and operational. `unset`
            indicates that the code exists on the provider but is not usable on
            the device.
          enum:
            - set
            - unset
          type: string
        type:
          description: >-
            Type of the access code. `ongoing` access codes are active
            continuously until deactivated manually. `time_bound` access codes
            have a specific duration.
          enum:
            - time_bound
            - ongoing
          type: string
        warnings:
          type: array
          description: >-
            Warnings associated with the [access
            code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
          items:
            type: object
            properties:
              error_code:
                type: string
                description: Error or warning code.
              message:
                type: string
                description: Human-readable description.
              created_at:
                type: string
                format: date-time
                description: When this error or warning was generated.
        workspace_id:
          description: >-
            Unique identifier for the Seam workspace associated with the access
            code.
          format: uuid
          type: string
      required:
        - workspace_id
        - type
        - access_code_id
        - device_id
        - name
        - code
        - created_at
        - errors
        - warnings
        - is_managed
        - status
      type: object
      x-route-path: /access_codes/unmanaged
  securitySchemes:
    client_session:
      bearerFormat: Client Session Token
      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
    api_key:
      bearerFormat: API Key
      scheme: bearer
      type: http

````