> ## 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 Connected Account

> You can add or change custom metadata for a connected account.

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 [connected account](./). Storing custom metadata in a Seam `connected_account` object enables you to look up an internal resource from directly within your Seam [workspace](/core-concepts/workspaces/index). Then, you can [filter connected accounts by the desired metadata](./filtering-connected-accounts-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>

If the associated [Connect Webview](/core-concepts/connect-webviews/index) contains custom metadata, Seam transfers this custom metadata as the initial value for this property. However, you can use the [Update Connected Account](/api/connected_accounts/update) method with the optional `custom_metadata` property 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 connectedAccountUpdate = await seam.connectedAccounts.update({
    connected_account_id: '6e1cad57-b244-40ca-b4f3-30a46c8000d4',
    custom_metadata: {
      internal_account_id: 'user-1',
    },
  })

  console.log(connectedAccountUpdate)
  ```

  ```bash cURL theme={null}
  curl -X 'POST' \
    'https://connect.getseam.com/connected_accounts/update' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer ${API_KEY}' \
    -H 'Content-Type: application/json' \
    -d '{
    "connected_account_id": "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
    "custom_metadata": {
      "internal_account_id": "user-1"
    }
  }'
  ```

  ```python Python theme={null}
  connected_account_update = seam.connected_accounts.update(
      connected_account_id = "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
      custom_metadata = {
          "internal_account_id": "user-1"
      }
  )

  pprint(connected_account_update)
  ```

  ```ruby Ruby theme={null}
  connected_account_update = client.connected_accounts.update(
    connected_account_id: "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
    custom_metadata: {
      "internal_account_id": "user-1"
    }
  )

  puts connected_account_update.inspect
  ```

  ```php PHP theme={null}
  $connected_account_update = $seam->connected_accounts->update(
    connected_account_id: "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
    custom_metadata: array('internal_account_id' => 'user-1')
  )
  echo json_encode($connected_account_update, JSON_PRETTY_PRINT);
  ```

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

  var connectedAccountUpdate = seam.ConnectedAccounts.Update(
    connectedAccountId: "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
    customMetadata: customMetadata
  );

  Console.WriteLine(connectedAccountUpdate);
  ```
</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}
  {
    "connected_account_id": "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
    "created_at": "2023-12-15T08:03:23.432Z",
    "user_identifier": {
      "email": "jane@example.com"
    },
    ...
    "custom_metadata": {"internal_account_id"=>"user-1"},
    "automatically_manage_new_devices": true
  }
  ```
</CodeGroup>
