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

# POST /compute/v0/contains

> Check if a geometry is inside another geometry

<Warning>
  **Research Preview** — This API is under development.
</Warning>

# Contains

Check if a geometry is inside a container geometry.

```
POST /compute/v0/contains
```

## Request body

<ParamField body="chainId" type="number" required>
  Target chain ID (e.g., `84532` for Base Sepolia).
</ParamField>

<ParamField body="container" type="Input" required>
  The containing geometry (typically a polygon). See [Input types](/api-reference/types#input) for accepted formats.
</ParamField>

<ParamField body="containee" type="Input" required>
  The geometry to check — is this inside the container?
</ParamField>

<ParamField body="schema" type="string">
  EAS schema UID. The server uses a default schema if not provided.
</ParamField>

<ParamField body="recipient" type="string">
  Ethereum address to receive the attestation. Defaults to the zero address.
</ParamField>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://staging-api.astral.global/compute/v0/contains \
    -H "Content-Type: application/json" \
    -H "X-API-Key: your-api-key" \
    -d '{
      "chainId": 84532,
      "container": "0xpolygon...",
      "containee": "0xpoint...",
      "recipient": "0xdef456..."
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch('https://staging-api.astral.global/compute/v0/contains', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'your-api-key'
    },
    body: JSON.stringify({
      chainId: 84532,
      container: '0xpolygon...',
      containee: '0xpoint...',
      recipient: '0xdef456...'
    })
  });

  const result = await response.json();
  ```
</CodeGroup>

## Response

Returns a [BooleanComputeResponse](/api-reference/types#booleancomputeresponse).

<ResponseField name="result" type="boolean" required>
  `true` if the containee is inside the container, `false` otherwise.
</ResponseField>

<ResponseField name="operation" type="string" required>
  Always `"contains"`.
</ResponseField>

<ResponseField name="timestamp" type="number" required>
  Unix timestamp of computation.
</ResponseField>

<ResponseField name="inputRefs" type="string[]" required>
  Array containing `[containerRef, containeeRef]`.
</ResponseField>

<ResponseField name="attestation" type="AttestationData" required>
  Signed EAS attestation. See [AttestationData](/api-reference/types#attestationdata).
</ResponseField>

<ResponseField name="delegatedAttestation" type="DelegatedAttestationData" required>
  Signature for delegated onchain submission. See [DelegatedAttestationData](/api-reference/types#delegatedattestationdata).
</ResponseField>

## Example response

```json theme={null}
{
  "result": true,
  "operation": "contains",
  "timestamp": 1706400000,
  "inputRefs": [
    "0xpolygon...",
    "0xpoint..."
  ],
  "attestation": {
    "schema": "0x...",
    "attester": "0x590fdb53ed3f0B52694876d42367192a5336700F",
    "recipient": "0xdef456...",
    "data": "0x...",
    "revocable": true,
    "refUID": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "signature": "0x..."
  },
  "delegatedAttestation": {
    "signature": "0x...",
    "attester": "0x590fdb53ed3f0B52694876d42367192a5336700F",
    "deadline": 1706403600,
    "nonce": 0
  }
}
```

## Notes

* Uses PostGIS `ST_Contains` function
* The container must completely contain the geometry for `true`
* Points on the boundary may return `false` — use [intersects](/api-reference/compute/intersects) for boundary cases

<Note>
  The field for the inner geometry is `containee`, not `geometry`. This naming distinguishes the two inputs unambiguously.
</Note>

<Card title="SDK Method" icon="code" href="/sdk/compute#contains">
  See `astral.compute.contains()`
</Card>
