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

# Update an Access Code

> Updates a specified active or upcoming [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).

See also [Modifying Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes).



## OpenAPI

````yaml /openapi.json post /access_codes/update
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/update:
    post:
      tags:
        - /access_codes
      summary: Update an Access Code
      description: >-
        Updates a specified active or upcoming [access
        code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).


        See also [Modifying Access
        Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes).
      operationId: accessCodesUpdatePost
      requestBody:
        content:
          application/json:
            schema:
              properties:
                access_code_id:
                  description: ID of the access code that you want to update.
                  format: uuid
                  type: string
                allow_external_modification:
                  description: >-
                    Indicates whether [external
                    modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification)
                    of the code is allowed. Default: `false`.
                  type: boolean
                attempt_for_offline_device:
                  default: true
                  type: boolean
                code:
                  description: Code to be used for access.
                  maxLength: 12
                  minLength: 4
                  pattern: ^\d+$
                  type: string
                device_id:
                  description: >-
                    ID of the device containing the access code that you want to
                    update.
                  format: uuid
                  type: string
                ends_at:
                  description: >-
                    Date and time at which the validity of the new access code
                    ends, in [ISO
                    8601](https://www.iso.org/iso-8601-date-and-time-format.html)
                    format. Must be a time in the future and after `starts_at`.
                  type: string
                is_external_modification_allowed:
                  description: >-
                    Indicates whether [external
                    modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification)
                    of the code is allowed. Default: `false`.
                  type: boolean
                is_managed:
                  description: >-
                    Indicates whether the access code is managed through Seam.
                    Note that to convert an unmanaged access code into a managed
                    access code, use
                    `/access_codes/unmanaged/convert_to_managed`.
                  type: boolean
                is_offline_access_code:
                  description: >-
                    Indicates whether the access code is an [offline access
                    code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
                  type: boolean
                is_one_time_use:
                  description: >-
                    Indicates whether the [offline access
                    code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes)
                    is a single-use access code.
                  type: boolean
                max_time_rounding:
                  default: 1hour
                  description: >-
                    Maximum rounding adjustment. To create a daily-bound
                    [offline access
                    code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes)
                    for devices that support this feature, set this parameter to
                    `1d`.
                  enum:
                    - 1hour
                    - 1day
                    - 1h
                    - 1d
                  type: string
                name:
                  description: >-
                    Name of the new 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).
                  type: string
                prefer_native_scheduling:
                  description: >-
                    Indicates whether [native
                    scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling)
                    should be used for time-bound codes when supported by the
                    provider. Default: `true`.
                  type: boolean
                preferred_code_length:
                  description: >-
                    Preferred code length. Only applicable if you do not specify
                    a `code`. If the affected device does not support the
                    preferred code length, Seam reverts to using the shortest
                    supported code length.
                  format: float
                  type: number
                starts_at:
                  description: >-
                    Date and time at which the validity of the new access code
                    starts, in [ISO
                    8601](https://www.iso.org/iso-8601-date-and-time-format.html)
                    format.
                  type: string
                sync:
                  default: false
                  type: boolean
                  x-undocumented: Only used internally.
                type:
                  description: >-
                    Type to which you want to convert the access code. To
                    convert a time-bound access code to an ongoing access code,
                    set `type` to `ongoing`. See also [Changing a time-bound
                    access code to permanent
                    access](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes#special-case-2-changing-a-time-bound-access-code-to-permanent-access).
                  enum:
                    - ongoing
                    - time_bound
                  type: string
                use_backup_access_code_pool:
                  description: >-
                    Indicates whether to use a [backup access code
                    pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes#backup-access-codes)
                    provided by Seam. If `true`, you can use
                    [`/access_codes/pull_backup_access_code`](https://docs.seam.co/api/access_codes/pull_backup_access_code).
                  type: boolean
                use_offline_access_code:
                  deprecated: true
                  type: boolean
                  x-deprecated: Use `is_offline_access_code` instead.
              required:
                - access_code_id
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  action_attempt:
                    type: object
                    description: >-
                      Tracks the progress of this operation. Poll using the
                      action_attempt_id.
                    properties:
                      action_attempt_id:
                        type: string
                        format: uuid
                        description: ID of the action attempt.
                      action_type:
                        type: string
                        enum:
                          - UPDATE_ACCESS_CODE
                        description: Type of action being tracked.
                      status:
                        type: string
                        enum:
                          - pending
                          - success
                          - error
                        description: Current status of the action.
                      result:
                        type: object
                        nullable: true
                        description: Result payload on success.
                      error:
                        type: object
                        nullable: true
                        description: Error details on failure.
                        properties:
                          type:
                            type: string
                          message:
                            type: string
                    required:
                      - action_attempt_id
                      - action_type
                      - status
                  ok:
                    type: boolean
                required:
                  - action_attempt
                  - ok
                type: object
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
      security:
        - client_session: []
        - client_session_with_customer: []
        - pat_with_workspace: []
        - console_session_with_workspace: []
        - api_key: []
      x-codeSamples:
        - lang: javascript
          label: Seam SDK
          source: |-
            await seam.accessCodes.update({
              access_code_id: "b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5",
              name: "My Updated Access Code",
              starts_at: "2025-06-19T08:26:41.000Z",
              ends_at: "2025-06-21T17:38:07.000Z",
              code: "4444",
            });

            /*
            // void
            */
        - lang: bash
          label: cURL
          source: >-
            curl --include --request POST
            "https://connect.getseam.com/access_codes/update" \
              --header "Authorization: Bearer $SEAM_API_KEY" \
              --json @- <<EOF
            {
              "access_code_id": "b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5",
              "name": "My Updated Access Code",
              "starts_at": "2025-06-19T08:26:41.000Z",
              "ends_at": "2025-06-21T17:38:07.000Z",
              "code": "4444"
            }

            EOF


            # Response:

            # {}
        - lang: python
          label: Seam SDK
          source: |-
            seam.access_codes.update(
                access_code_id="b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5",
                name="My Updated Access Code",
                starts_at="2025-06-19T08:26:41.000Z",
                ends_at="2025-06-21T17:38:07.000Z",
                code="4444",
            )

            # None
        - lang: ruby
          label: Seam SDK
          source: |-
            seam.access_codes.update(
              access_code_id: "b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5",
              name: "My Updated Access Code",
              starts_at: "2025-06-19T08:26:41.000Z",
              ends_at: "2025-06-21T17:38:07.000Z",
              code: "4444",
            )

            # => nil
        - lang: php
          label: Seam SDK
          source: |-
            $seam->access_codes->update(
                access_code_id: "b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5",
                name: "My Updated Access Code",
                starts_at: "2025-06-19T08:26:41.000Z",
                ends_at: "2025-06-21T17:38:07.000Z",
                code: "4444",
            );
        - lang: bash
          label: Seam CLI
          source: >-
            seam access-codes update --access_code_id
            "b854d7c9-d0d8-40a7-8a7c-cd3d167a6ce5" --name "My Updated Access
            Code" --starts_at "2025-06-19T08:26:41.000Z" --ends_at
            "2025-06-21T17:38:07.000Z" --code "4444"


            # {}
components:
  securitySchemes:
    client_session:
      bearerFormat: Client Session Token
      scheme: bearer
      type: http
    client_session_with_customer:
      bearerFormat: Customer 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

````