> ## Documentation Index
> Fetch the complete documentation index at: https://astral-6ef288be-claude-ascii-globe-mouse-interaction-bupya.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /within

> Check if a geometry is within a radius of another

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

# Within

Check if a geometry is within a specified radius of a target geometry.

```
POST /compute/v0/within
```

## Request Body

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

<ParamField body="geometry" type="Input" required>
  The geometry to check (typically a point).
</ParamField>

<ParamField body="target" type="Input" required>
  The target geometry to measure distance from.
</ParamField>

<ParamField body="radius" type="number" required>
  Maximum distance in **meters**.
</ParamField>

<ParamField body="schema" type="string" required>
  EAS schema UID to issue the attestation against.
</ParamField>

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

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.astral.global/compute/v0/within \
    -H "Content-Type: application/json" \
    -d '{
      "chainId": 84532,
      "geometry": "0xpoint...",
      "target": "0xlandmark...",
      "radius": 500,
      "schema": "0xschema...",
      "recipient": "0xdef456..."
    }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch('https://api.astral.global/compute/v0/within', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      chainId: 84532,
      geometry: '0xpoint...',
      target: '0xlandmark...',
      radius: 500,
      schema: '0xschema...',
      recipient: '0xdef456...'
    })
  });
  ```
</CodeGroup>

## Example Response

```json theme={null}
{
  "result": true,
  "operation": "within:50000",
  "timestamp": 1706400000,
  "inputRefs": [
    "0xpoint...",
    "0xlandmark..."
  ],
  "attestation": {
    "schema": "0x...",
    "attester": "0x...",
    "recipient": "0xdef456...",
    "data": "0x...",
    "signature": "0x..."
  },
  "delegatedAttestation": {
    "signature": "0x...",
    "attester": "0x...",
    "deadline": 1706403600
  }
}
```

## Notes

* Uses PostGIS `ST_DWithin` function
* Radius is always in **meters** (no unit conversion)
* Returns `true` if the distance between geometries is less than or equal to the radius
* The `operation` field includes the radius in **centimeters**: `within:RADIUS_CM` (e.g., `within:50000` for a 500m radius). Resolver contracts should use prefix matching, not exact string comparison

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