> ## Documentation Index
> Fetch the complete documentation index at: https://seam-feat-mintlify-migration-iteration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Custom Metadata to a Device

> You can add or change custom metadata for a device.

You can use custom metadata to store a custom payload or object, tailored to the specific needs of your app. For example, this feature is useful for tracking customer information, internal user IDs, or other internal resources for a [device](./). Storing custom metadata in a Seam `device` object enables you to look up an internal resource from directly within your Seam [workspace](/core-concepts/workspaces/index). Then, you can [filter devices by the desired metadata](/core-concepts/devices/filtering-devices-by-custom-metadata).

<Info>
  You can also use unique resource keys as an easy way to link your resources to
  Seam resources. For details, see [Mapping Your Resources to Seam
  Resources](../mapping-your-resources-to-seam-resources).
</Info>

Use the [Update Device](/api/devices/update) method with the optional [`custom_metadata` property](/core-concepts/devices#properties) to change or add custom metadata for the connected account. This property accepts up to 50 JSON key:value pairs.

<Tabs>
  <Tab title="JavaScript">
    **Request:**

    ```javascript theme={null}
    const deviceUpdate = await seam.devices.update({
      device_id: '30fd243b-3054-4384-a713-5487076a3826',
      custom_metadata: {
        internal_account_id: 'user-1',
      },
    })

    console.log(deviceUpdate)
    ```

    **Response:**

    ```json theme={null}
    { "ok": true }
    ```
  </Tab>

  <Tab title="cURL">
    **Request:**

    ```bash theme={null}
    curl -X 'POST' \
      'https://connect.getseam.com/devices/update' \
      -H 'accept: application/json' \
      -H 'Authorization: Bearer ${API_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
      "device_id": "30fd243b-3054-4384-a713-5487076a3826",
      "custom_metadata": {
        "id": "internal_id_1"
      }
    }'
    ```

    **Response:**

    ```json theme={null}
    {
      "ok": true
    }
    ```
  </Tab>

  <Tab title="Python">
    **Request:**

    ```python theme={null}
    device_update = seam.devices.update(
        device = "30fd243b-3054-4384-a713-5487076a3826",
        custom_metadata = {
            "internal_account_id": "user-1"
        }
    )

    pprint(device_update)
    ```

    **Response:**

    ```
    True
    ```
  </Tab>

  <Tab title="Ruby">
    **Request:**

    ```ruby theme={null}
    device_update = client.devices.update(
      device_id: "30fd243b-3054-4384-a713-5487076a3826",
      custom_metadata: {
        "internal_account_id": "user-1"
      }
    )

    puts device_update.inspect
    ```

    **Response:**

    ```
    {"ok"=>true}
    ```
  </Tab>

  <Tab title="PHP">
    **Request:**

    ```php theme={null}
    $device_update = $seam->devices->update(
      device_id: "30fd243b-3054-4384-a713-5487076a3826",
      custom_metadata: array('internal_account_id' => 'user-1')
    )
    echo json_encode($device_update, JSON_PRETTY_PRINT);
    ```

    **Response:**

    ```json theme={null}
    true
    ```
  </Tab>

  <Tab title="C#">
    **Request:**

    ```csharp theme={null}
    var customMetadata = new Dictionary<string, string>()
    {
      {"internal_account_id", "user-1"}
    };

    var deviceUpdate = seam.Devices.Update(
      deviceId: "30fd243b-3054-4384-a713-5487076a3826",
      customMetadata: customMetadata
    );

    Console.WriteLine(deviceUpdate);
    ```

    **Response:**

    ```json theme={null}
    {
      "device_id": "30fd243b-3054-4384-a713-5487076a3826",
      "device_type": "schlage_lock",
      ...
      "is_managed": true,
      "custom_metadata": {"internal_account_id"=>"user-1"}
    }
    ```
  </Tab>
</Tabs>
