> ## Documentation Index
> Fetch the complete documentation index at: https://novita.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# サンドボックスメタデータ

サンドボックスメタデータを使用すると、カスタムのキーと値の情報をサンドボックスに付与できます。

一般的な用途は次のとおりです。

* サンドボックスをユーザーセッションに接続する。
* API キーなど、サンドボックス用のカスタムユーザー関連データを保存する。
* 後で再接続できるように、サンドボックスをユーザー ID にリンクする。

メタデータは、サンドボックスの作成時に指定します。後で、`Sandbox.list()` を使用してアクティブなサンドボックスを一覧表示する際に読み取ることができます。

<CodeGroup>
  ```js JavaScript & TypeScript icon="js" theme={"system"}
  import { Sandbox } from 'novita-sandbox'

  // Start a sandbox and attach custom metadata.
  const sbx = await Sandbox.create({
    metadata: {
      userId: '123',
    },
  })

  // Retrieve active sandboxes and inspect their metadata.
  const page = await Sandbox.list()
  const active = await page.nextItems()

  console.log(active[0].metadata)
  // Example output:
  // { userId: '123' }
  ```

  ```python Python icon="python" theme={"system"}
  from novita_sandbox.core import Sandbox

  # Start a sandbox and attach custom metadata.
  sbx = Sandbox.create(
      metadata={
          "userId": "123",
      },
  )

  # Retrieve active sandboxes and inspect their metadata.
  page = Sandbox.list()
  active = page.next_items()

  print(active[0].metadata)
  # Example output:
  # {"userId": "123"}
  ```
</CodeGroup>

## メタデータに基づくフィルタリング

一覧表示時に、メタデータを使用してサンドボックスをフィルタリングすることもできます。
