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

# 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) to change or add custom metadata for the connected account. This property accepts up to 50 JSON key:value pairs.

**Request:**

<CodeGroup>
  ```javascript 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)
  ```

  ```bash cURL 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"
    }
  }'
  ```

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

  pprint(device_update)
  ```

  ```ruby 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
  ```

  ```php 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);
  ```

  ```csharp C# 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);
  ```
</CodeGroup>

**Response:**

<CodeGroup>
  ```json JavaScript theme={null}
  { "ok": true }
  ```

  ```json cURL theme={null}
  {
    "ok": true
  }
  ```

  ```json Python theme={null}
  True
  ```

  ```json Ruby theme={null}
  {"ok"=>true}
  ```

  ```json PHP theme={null}
  true
  ```

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