---
title: "Polygon Search"
method: POST
path: "/skynet/search/polygon"
tags: ["Tracking_Search"]
---

# Polygon Search

`POST /skynet/search/polygon`

## Query parameters

- `key` string, 32 character alphanumeric string, required

## Request body

- object
  - `polygon` PolygonGeojsonSkynet, required — An object to collect geoJSON details of a custom polygon. Please ensure that: - the polygon provided is enclosed. This can be achieved by making the last location coordinate in the list equal to the first location coordinate of the list. - the 'polygon' provided does not contain multiple rings. The contents of this object follow the [geoJSON standard](https://datatracker.ietf.org/doc/html/rfc7946). Please note that the maximum area of the search polygon allowed is 3000 km<sup>2</sup>.
    - `type` string, required — Type of the geoJSON geometry. Should always be polygon.
    - `coordinates` number[], required — An array of coordinates in the [longitude, latitude] format, representing the polygon boundary.
  - `filter` string — **tags parameter will be deprecated soon! Please use the include_any_of_attributes or include_all_of_attributes parameters to match assets based on their labels or markers.** Use this parameter to filter the assets found inside the specified area by their tag. Multiple tag can be separated using comma (,). Please note the tags are case sensitive.
  - `match_filter` object — An object to define the attributes which will be used to filter the assets found within the polygon.
    - `include_all_of_attributes` string — Use this parameter to filter the assets found inside the specified area by their attributes. Only the assets having all the attributes that are added to this parameter, will be returned in the search results. Multiple attributes can be separated using commas (,). Please note the attributes are case sensitive. Also, this parameter can not be used in conjunction with include_any_of_attributes parameter.
    - `include_any_of_attributes` string — Use this parameter to filter the assets found inside the specified area by their attributes. Assets having at least one of the attributes added to this parameter, will be returned in the search results. Multiple attributes can be separated using commas (,). Please note the attributes are case sensitive. Also, this parameter can not be used in conjunction with include_all_of_attributes parameter.
  - `pn` integer — Denotes page number. Use this along with the ps parameter to implement pagination for your searched results. This parameter does not have a maximum limit but would return an empty response in case a higher value is provided when the result-set itself is smaller.
  - `ps` integer — Denotes number of search results per page. Use this along with the pn parameter to implement pagination for your searched results. Please note that ps has a default value of 20 and accepts integers only in the range of [1, 100].
  - `max_search_limit` boolean — if ture, can get 16x bigger limitation in search.
  - `sort` SearchSortRequest
    - `sort_by` 'distance' | 'duration' | 'straight_distance' — Specify the metric to sort the assets returned in the search result. The valid values are: * **distance** : Sorts the assets by driving distance to the given sort_destination . * **duration** : Sorts the assets by travel time to the given sort_destination . * **straight\_distance** : Sort the assets by straight-line distance to the given sort-destination .
    - `sort_destination` object — Specifies the location coordinates of the point which acts as destination for sorting the assets in the search results. The service will sort each asset based on the driving distance or travel time to this destination, from its current location. Use the sort_by parameter to configure the metric that should be used for sorting the assets. Please note that sort_destination is required when sort_by is provided.
      - `lat` number, required — Latitude of the destination location
      - `lon` number, required — Longitude of the destination location
    - `sort_driving_mode` 'car' | 'truck' — Specifies the driving mode to be used for determining travel duration or driving distance for sorting the assets in search result.

## Response `200`

- SearchResponse
  - `status` string — A string indicating the state of the response. On successful responses, the value will be Ok. Indicative error messages are returned for different errors. See the [API Error Codes](#api-error-codes) section below for more information.
  - `message` string — Displays the error message in case of a failed request. If the request is successful, this field is not present in the response.
  - `data` object — A data object containing the search result.
    - `assets` AssetSearchResult[] — An array of objects with details of the asset(s) returned in the search result. Each object represents one asset
      - `id` string — ID of asset which was last located inside the specified area in the input request. This is the same ID that was generated/provided at the time of creating the asset.
      - `name` string — Name of asset. The value would be the same as that provided for the name parameter at the time of creating or updating the asset.
      - `description` string — Description of the asset. The value would be the same as that provided for the description parameter at the time of creating or updating the asset.
      - `latest_location` DtoTrackLocation — An object with details of the tracked location. Please note that if there are no tracking records for an asset, no location data will be returned.
        - `accuracy` number — If available, this property returns the accuracy of the GPS information received at the tracked location. It is represented as an estimated horizontal accuracy radius, in meters, at the 68th percentile confidence level.
        - `altitude` number — If available in the GPS information, this property returns the altitude of the asset at the tracked location. It is represented as height, in meters, above the WGS84 reference ellipsoid.
        - `bearing` number — If available in the GPS information, this property returns the heading of the asset calculated from true north in clockwise direction at the tracked location. Please note that the bearing is not affected by the device orientation. The bearing will always be in the range of [0, 360).
        - `location` object — An object with the coordinates of the last tracked location.
          - `lat` number — Latitude of the tracked location of the asset.
          - `lon` number — Longitude of the tracked location of the asset.
        - `meta_data` TrackMetaDataSkynet — Specifies the custom data about the location that was added when the location was uploaded.
        - `speed` number — If available in the GPS information, this property returns the speed of the asset, in meters per second, at the tracked location.
        - `timestamp` integer — A UNIX epoch timestamp in milliseconds, representing the time at which the location was tracked.
        - `battery_level` integer — Returns the battery level of the GPS device, as a percentage, when the location was tracked. It has a minimum value of 0 and a maximum value of 100.
        - `tracking_mode` string — Internal parameter for tracking mode.
      - `meta_data` MetaData — Any valid json object data. Can be used to save customized data. Max size is 65kb.
      - `created_at` integer — A UNIX timestamp in seconds representing the time at which the asset was created.
      - `updated_at` integer — A UNIX timestamp in seconds representing the time at which the asset was last updated.
      - `tracked_at` integer — A UNIX epoch timestamp in seconds representing the last time when the asset was tracked.
      - `ranking_info` RankingInfo — An object returning the sorting details of the asset as per the configuration specified in the input.
        - `index` integer — Index of the ranked asset. The index value starts from 0.
        - `distance` number — Driving distance between the asset and the sort_destination.
        - `duration` number — Driving duration between the asset and the sort_destination. Please note this field in not returned in the response when sort_by = straight_distance .
      - `tags` string[] — **This parameter will be deprecated soon! Please move existing tags to attributes parameter.** Tags associated with the asset.
    - `page` DtoPagination — An object with pagination details of the search results. Use this object to implement pagination in your application.
      - `total` integer — An integer value indicating the total number of items available in the data set. This parameter can be used to calculate the total number of pages available.
      - `page` integer — An integer value indicating the current page number (starting at 0).
      - `size` integer — An integer value indicating the maximum number of items retrieved per page.
      - `hasmore` boolean — A boolean value indicating whether there are more items available beyond the current page.

---

[API](https://skmtc.net/nextbillion-ai/apis/one-spec-service.md) · [All operations](https://skmtc.net/nextbillion-ai/apis/one-spec-service/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nextbillion-ai/one-spec-service/versions/b647f1808dda/schema)
