> For the complete documentation index, see [llms.txt](/llms.txt).

- Snap

# snap_getInterfaceContext

Get the context of an [interface](https://metamask-docs-f8nytczy3-consensys-ddffed67.vercel.app/snaps/features/custom-ui/interactive-ui/)created by [snap_createInterface](https://metamask-docs-f8nytczy3-consensys-ddffed67.vercel.app/snaps/reference/snaps-api/snap%5Fcreateinterface).

## Parameters[​](#parameters "Direct link to Parameters")

object

required

An object containing the parameters for the `snap_getInterfaceContext`method.

### id

string

required

The interface ID.

## Returns[​](#returns "Direct link to Returns")

Record<string, JSON> | null

The context for the given interface. May be `null` if no context was provided when the interface was created.

## Example

```
import { Box, Heading, Text } from '@metamask/snaps-sdk/jsx'

const interfaceId = await snap.request({
  method: 'snap_createInterface',
  params: {
    ui: (
      <Box>
        <Heading>Hello, world!</Heading>
        <Text>Welcome to my Snap homepage!</Text>
      </Box>
    ),
    context: {
      key: 'value',
    },
  },
})

const context = await snap.request({
  method: 'snap_getInterfaceContext',
  params: {
    id: interfaceId,
  },
})

console.log(context)
// {
//   key: 'value'
// }

```
