> ## Documentation Index
> Fetch the complete documentation index at: https://www.seam.co/docs/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](/low-level-apis/smart-locks/access-codes).

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



## OpenAPI

````yaml /openapi.json patch /access_codes/update
openapi: 3.0.0
info:
  description: >-
    Programmable API to control locks, thermostats, noise sensors, cameras,
    access control systems, and other IoT devices.


    Prefer the official Seam SDKs over hand-written HTTP calls: they handle

    authentication, request serialization, pagination, and error handling for

    you. The official SDKs are listed in this document under

    `info.x-seam-sdks`.


    If you call the HTTP API directly, your query parameters must be

    serialized compatibly with the Seam API. There is no universal convention

    for serializing arrays, booleans, or nested objects in a query string, so

    use @seamapi/url-search-params-serializer, the language specific serializer
    module provided by each Seam SDK, or follow its specification:

    https://github.com/seamapi/url-search-params-serializer
  title: Seam Connect
  version: 1.0.0
  x-seam-query-serializer:
    description: >-
      Reference implementation and specification for query parameter
      serialization compatible with the Seam API.
    url: https://github.com/seamapi/url-search-params-serializer
  x-seam-sdks:
    - language: javascript
      url: https://github.com/seamapi/javascript
    - language: python
      url: https://github.com/seamapi/python
    - language: ruby
      url: https://github.com/seamapi/ruby
    - language: php
      url: https://github.com/seamapi/php
    - language: csharp
      url: https://github.com/seamapi/csharp
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:
    patch:
      tags:
        - /access_codes
      summary: Update an Access Code
      description: >-
        Updates a specified active or upcoming [access
        code](/low-level-apis/smart-locks/access-codes).


        See also [Modifying Access
        Codes](/low-level-apis/smart-locks/access-codes/modifying-access-codes).
      operationId: accessCodesUpdatePatch
      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](/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](/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
                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
                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
                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](/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
              required:
                - access_code_id
              type: object
      responses:
        '200':
          content:
            application/json:
              schema:
                properties: {}
                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

````