---
title: "Point-in-polygon containment test"
method: POST
path: "/v1/geofences/contains"
tags: ["Geofences"]
---

# Point-in-polygon containment test

`POST /v1/geofences/contains`

## Request

- Base URL: `https://geo.thinair.co`
- URL: `https://geo.thinair.co/v1/geofences/contains`
- Auth: HTTP bearer

Test one or more points for containment inside a caller-supplied GeoJSON polygon (or MultiPolygon / Feature / FeatureCollection). Pure geometry — no upstream call, costs 0 quota units. Boundary points count as contained. Returns 400 when the polygon is structurally invalid.

## Request body

- GeofenceContainsRequest
  - `polygon` union, required: A GeoJSON Polygon / MultiPolygon geometry, a Feature wrapping one, or a FeatureCollection of them. Ring geometry is validated server-side (closure, winding, self-intersection, complexity limits).
    - object
      - `type` 'Polygon', required
      - `coordinates` array[], required
        - array[]
          - number[]
    - object
      - `type` 'MultiPolygon', required
      - `coordinates` array[], required
        - array[]
          - array[]
            - number[]
    - object
      - `type` 'Feature', required
      - `geometry` object, required
        - `type` string, required
      - `properties` object, nullable
    - object
      - `type` 'FeatureCollection', required
      - `features` object[], required
        - `type` 'Feature', required
        - `geometry` object, required
          - `type` string, required
        - `properties` object, nullable
  - `points` GeofencePoint[], required: Points to test for containment (up to 1000). { lat, lon } each.
    - `lat` number, required
    - `lon` number, required

## Response `200`

Containment results — one boolean per input point.

- GeofenceContainsResponse
  - `results` boolean[], required: results[i] = true when points[i] is inside the polygon (boundary counts as inside).
  - `contained_count` integer, required
  - `point_count` integer, required
  - `warnings` string[]

## Other responses

- `400`: Invalid request body or structurally-invalid polygon.
- `429`: Quota exceeded for this tenant.

---

[API](https://skmtc.dev/thinair/apis/thinair-geo-api.md) · [All operations](https://skmtc.dev/thinair/apis/thinair-geo-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thinair/apis/thinair-geo-api/revisions/8fac2d5e4b34?raw)
