# Filtering Connect Webviews by Custom Metadata

When you use [List Connect Webviews](https://docs.seam.co/latest/api/connect_webviews/list), you can filter the list by one or more [custom metadata](https://docs.seam.co/latest/core-concepts/connect-webviews/attaching-custom-data-to-the-connect-webview) pairs. Include the `custom_metadata_has` parameter with a JSON string that specifies the desired key:value pairs.

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

```javascript
const connect_webviews = await seam.connectWebviews.list({
  custom_metadata_has: {
    "internal_account_id": "user-1"
  }
});

console.log(connect_webviews);
```

**Response:**

```json
[
  {
    connect_webview_id: '3c3f4c15-e7db-47c6-bc5a-1bf206ff269c',
    url: 'https://connect.getseam.com/connect_webviews/view?connect_webview_id=3c3f4c15-e7db-47c6-bc5a-1bf206ff269c&auth_token=LrpMC4MVHAY8YJRcNFeX1nQcb7tGNwpot',
    status: 'pending',
    workspace_id: '398d80b7-3f96-47c2-b85a-6f8ba21d07be',
    custom_metadata: { internal_account_id: 'user-1' },
    ...
  },
  ...
]
```

{% endtab %}

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

```bash
curl -X 'POST' \
  'https://connect.getseam.com/connect_webviews/list' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer ${API_KEY}' \
  -H 'Content-Type: application/json' \
  -d '{
  "custom_metadata_has": {
    "internal_account_id": "user-1"
  },
}'
```

**Response:**

```json
{
  "connect_webviews": [
    {
      "connect_webview_id": "3c3f4c15-e7db-47c6-bc5a-1bf206ff269c",
      "url": "https://connect.getseam.com/connect_webviews/view?connect_webview_id=3c3f4c15-e7db-47c6-bc5a-1bf206ff269c&auth_token=LrpMC4MVHAY8YJRcNFeX1nQcb7tGNwpot",
      "status": "pending",
      "workspace_id": "398d80b7-3f96-47c2-b85a-6f8ba21d07be",
      "custom_metadata": {
        "id": "internal_id_1"
      },
      ...
    },
    ...
  ],
  "ok": true
}
```

{% endtab %}

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

```python
connect_webviews = seam.connect_webviews.list(
  custom_metadata_has = {
    "internal_account_id": "user-1"
  }
)

pprint(connect_webviews)
```

**Response:**

```
[
  ConnectWebview(
    workspace_id='398d80b7-3f96-47c2-b85a-6f8ba21d07be',
    connect_webview_id='3c3f4c15-e7db-47c6-bc5a-1bf206ff269c',
    status='pending',
    url='https://connect.getseam.com/connect_webviews/view?connect_webview_id=xxxx&auth_token=yyyy',
    custom_metadata={"internal_account_id": "user-1"},
    ...
  ),
  ...
]
```

{% endtab %}

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

```ruby
connect_webviews = client.connect_webviews.list(
  custom_metadata_has: {
    "internal_account_id": "user-1"
  }
)

puts connect_webviews.inspect
```

**Response:**

```
[
  &#x3C;Seam::ConnectWebview:0x00438
    connect_webview_id="3c3f4c15-e7db-47c6-bc5a-1bf206ff269c"
    url="https://connect.getseam.com/connect_webviews/view?connect_webview_id=3c3f4c15-e7db-47c6-bc5a-1bf206ff269c&#x26;auth_token=LrpMC4MVHAY8YJRcNFeX1nQcb7tGNwpot"
    status="pending"
    workspace_id="398d80b7-3f96-47c2-b85a-6f8ba21d07be"
    custom_metadata={"internal_account_id"=>"user-1"}
    ...
  >,
  ...
]
```

{% endtab %}

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

```php
$webviews = $seam->connect_webviews->list(
  custom_metadata_has: array('internal_account_id' => 'user-1')
);

echo json_encode($webviews);
```

**Response:**

```json
[
  {
    "connect_webview_id": "3c3f4c15-e7db-47c6-bc5a-1bf206ff269c",
    "url": "https://connect.getseam.com/connect_webviews/view?connect_webview_id=xxxx&auth_token=yyyy",
    "status": "pending",
    "workspace_id": "398d80b7-3f96-47c2-b85a-6f8ba21d07be",
    "custom_metadata": {"internal_account_id": "user-1"},
    ...
  },
  ...
]
```

{% endtab %}

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

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

seam.ConnectWebviews.List(
  customMetadataHas: customMetadata
);
```

**Response:**

```json
{
  "connect_webview_id": "3874d8b4-4bb5-470a-9fc7-a54931a4b933",
  "url": "https://connect.getseam.com/connect_webviews/view?connect_webview_id=3c3f4c15-e7db-47c6-bc5a-1bf206ff269c&auth_token=LrpMC4MVHAY8YJRcNFeX1nQcb7tGNwpot",
  "workspace_id": "398d80b7-3f96-47c2-b85a-6f8ba21d07be",
  "custom_metadata": {
    "internal_account_id": "user-1"
  },
  ...
}...
```

{% 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/connect-webviews/filtering-connect-webviews-by-custom-metadata.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.
