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

{% hint style="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](/latest/core-concepts/mapping-your-resources-to-seam-resources.md).
{% endhint %}

If the associated [Connect Webview](/latest/core-concepts/connect-webviews.md) contains custom metadata, Seam transfers this custom metadata as the initial value for this property. However, you can use the [Update Connected Account](https://docs.seam.co/latest/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.

{% tabs %}
{% tab title="JavaScript" %}
**Request:**

```javascript
const connectedAccountUpdate = await seam.connectedAccounts.update({
  connected_account_id: "6e1cad57-b244-40ca-b4f3-30a46c8000d4",
  custom_metadata: {
    "internal_account_id": "user-1"
  }
})

console.log(connectedAccountUpdate)
```

**Response:**

```json
{ ok: true }
```

{% endtab %}

{% tab title="cURL" %}
**Request:**

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

**Response:**

```json
{
  "ok": true
}
```

{% endtab %}

{% tab title="Python" %}
**Request:**

```python
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)
```

**Response:**

```
True
```

{% endtab %}

{% tab title="Ruby" %}
**Request:**

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

**Response:**

```
{"ok"=>true}
```

{% endtab %}

{% tab title="PHP" %}
**Request:**

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

**Response:**

{% code overflow="wrap" %}

```json
true
```

{% endcode %}
{% endtab %}

{% tab title="C#" %}
**Request:**

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

**Response:**

```json
{
  "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
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seam.co/latest/core-concepts/connected-accounts/adding-custom-metadata-to-a-connected-account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
