Geopin (1.0.0)

Download OpenAPI specification:Download

Geopin Labs Support: support@geopin.io URL: https://geopin.io

Geopin HTTP API

Authentication

BearerAPIKey

Authenticate with the Geopin API using an account-level API Key

Security Scheme Type HTTP
HTTP Authorization Scheme bearer

DelegateAPIKey

Authenticate with the Geopin API using a Delegate Token

Security Scheme Type API Key
Header parameter name: X-API-Key

Metadata Definitions

Metadata Definitions are required for assigning a schema for the metadata included in Features ingested into a specific Feature Collection.

List Metadata Definitions

Authorizations:
query Parameters
offset
number

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "total_count": 0,
  • "current_count": 0,
  • "links": {
    }
}

Create a Metadata Definition

Metadata Definitions support creating an arbitrary number of metadata properties to associate with Features, and support the following property types:

  • primitive: A string, number, or boolean
  • date: A date time in one of the following formats: epoch_millis, epoch_seconds, or iso8601
  • array: An array of one of the primitive types listed above

When a Metadata Definition is associated with a Feature Collection, a JSON schema is generated from the Metadata Definition properties and is applied to validate the metadata object included in Feature ingest requests. Additionally, all metadata properties can be used as query criteria, with the following functionality:

  • primitive
    • string
      • equals
      • like
      • does_not_equal
    • number
      • equals
      • greater_than
      • greater_than_or_equal_to
      • less_than
      • less_than_or_equal_to
      • does_not_equal
    • boolean
      • equals
      • does_not_equal
  • date
    • equals
    • greater_than
    • greater_than_or_equal_to
    • less_than
    • less_than_or_equal_to
    • does_not_equal
  • array
    • contains
    • does_not_contain
Authorizations:
Request Body schema: application/json
name
required
string [ 1 .. 255 ] characters
required
Array of Root Type for MetadataDefinitionPropertyPrimative (object) or Root Type for MetadataDefinitionPropertyPrimative (object) or Root Type for MetadataDefinitionPropertyPrimative (object) (V1MetadataDefinitionProperty) non-empty
tags
Array of strings

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "properties": [
    ],
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "name": "string",
  • "properties": [
    ],
  • "tags": [
    ],
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "sequential_id": 0
}

Fetch a Metadata Definition

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -

Responses

Response samples

Content type
application/json
{
  • "name": "string",
  • "properties": [
    ],
  • "tags": [
    ],
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "sequential_id": 0
}

Fetch a Metadata Definition json schema

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -

Responses

Response samples

Content type
application/json
{ }

Feature Collections

Feature Collections act as "databases" of Features. Every Feature ingested must belong to a Feature Collection.

List Feature Collections

Authorizations:
query Parameters
offset
number

Responses

Response samples

Content type
application/json
{
  • "items": [
    ],
  • "total_count": 0,
  • "current_count": 0,
  • "links": {
    }
}

Create a Feature Collection

Feature Collections can support one of the following two geography types: polygon or point.

Feature Collections can also (optionally) be associated with a Metadata Definition.

Feature Collections also support "masked mode", which when enabled prevents query results or fetch responses from including the geography of features. Masked mode effectively prevents you from ever seeing the location data of any Feature in the Feature Collection.

Authorizations:
Request Body schema: application/json
geography_type
required
string
Enum: "polygon" "point"
name
required
string [ 1 .. 255 ] characters
metadata_definition_uuid
string
masked
boolean
Default: true
tags
Array of strings

Responses

Request samples

Content type
application/json
{
  • "geography_type": "polygon",
  • "name": "string",
  • "metadata_definition_uuid": "string",
  • "masked": true,
  • "tags": [
    ]
}

Response samples

Content type
application/json
{
  • "active": true,
  • "geography_type": "polygon",
  • "name": "string",
  • "metadata_definition_uuid": "string",
  • "masked": true,
  • "tags": [
    ],
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "sequential_id": 0
}

Fetch a Feature Collection

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -

Responses

Response samples

Content type
application/json
{
  • "active": true,
  • "geography_type": "polygon",
  • "name": "string",
  • "metadata_definition_uuid": "string",
  • "masked": true,
  • "tags": [
    ],
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "sequential_id": 0
}

Update a Feature Collection

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -
Request Body schema: application/json
active
required
boolean

Responses

Request samples

Content type
application/json
{
  • "active": true
}

Response samples

Content type
application/json
{
  • "active": true,
  • "geography_type": "polygon",
  • "name": "string",
  • "metadata_definition_uuid": "string",
  • "masked": true,
  • "tags": [
    ],
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "sequential_id": 0
}

Features

Features are the core data ingested into Geopin, and may be Polygons or Points. Both geography types support metadata that can be defined by Metadata Definitions.

Fetch the latest Feature for a specific external identifier in a collection

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -
external_identifier
required
string
query Parameters
include_geography
boolean
Default: false

Responses

Response samples

Content type
application/json
Example
{
  • "type": "polygon",
  • "metadata": { },
  • "external_identifier": "string",
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z"
}

Fetch the latest timestamp for a specific external identifier in a collection

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -
external_identifier
required
string

Responses

Delegate Tokens

Delegate Tokens are short-lived authentication tokens that allow for ingesting Features into Geopin with constraints on metadata, Feature Collection, and (optionally) external identifiers. A common use case for Delegate Tokens is to bypass your application for Feature ingest, for example, a ride-sharing platform could issue a Delegate Token to it's driver apps to send driver location updates directly to Geopin.

Check if a delegate token is valid

Authorizations:

Responses

Create a delegate token

Authorizations:
Request Body schema: application/json
feature_collection_uuid
required
string (V1UUID)
external_identifier
string [ 5 .. 255 ] characters
expires_at
string <date-time>

ISO-8601 the delegate token should expire, defaults to 30 days from now. Delegate tokens must expire at least 5 minutes from now and less than 90 days from now.

object

Responses

Request samples

Content type
application/json
{
  • "feature_collection_uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "external_identifier": "string",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "metadata": { }
}

Response samples

Content type
application/json
{
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "feature_collection_uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "external_identifier": "string",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "metadata": { },
  • "token": "string"
}

Revoke a delegate token

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -

Responses

Ingest

The ingest endpoints support two modes of ingest: direct, using a Geopin account API Key, and delegate, using a Delegate Token.

Ingest a new Feature

Authorizations:
path Parameters
uuid
required
string
Examples:
  • 41699e18-4f02-48c1-b207-3b9003de1acf -
Request Body schema: application/json
One of
geography
required
Array of numbers (V1Coordinates) >= 2 items

Points in longitude, latitude order

type
required
string
Value: "point"
object
external_identifier
required
string [ 5 .. 255 ] characters

Responses

Request samples

Content type
application/json
Example
{
  • "geography": [
    ],
  • "type": "point",
  • "metadata": { },
  • "external_identifier": "string"
}

Create a geo point via delegate token

Authorizations:
query Parameters
deferred
boolean
Default: false

Ingests the Feature asynchronously

Request Body schema: application/json
geography
required
Array of numbers (V1Coordinates) >= 2 items

Points in longitude, latitude order

metadata
object
external_identifier
string [ 5 .. 255 ] characters

Responses

Request samples

Content type
application/json
{
  • "geography": [
    ],
  • "metadata": { },
  • "external_identifier": "string"
}

Query

Geopin supports complex queries over Feature location and metadata. Additionally, it is possible to scroll through all results returned by a query.

Execute a query

Authorizations:
query Parameters
include_geography
boolean
Default: false

Include the result Feature coordinates in the query results, only valid for geopoint features

Request Body schema: application/json
One of
type
required
string
Value: "polygon_contains"
target_feature_collection
required
string (V1UUID)
Array of V1QueryAnd (object) or V1QueryPropertyComparison (object) or V1QueryOr (object) (V1QueryElement)
required
object (V1FeatureReference)
object

Responses

Request samples

Content type
application/json
Example
{
  • "type": "polygon_contains",
  • "target_feature_collection": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "metadata_filters": [
    ],
  • "source_feature": {
    },
  • "sort": {
    }
}

Response samples

Content type
application/json
{
  • "links": {
    },
  • "items": [
    ]
}

Fetch the next set of results from a query

Authorizations:
query Parameters
scroll_key
required
string

Responses

Response samples

Content type
application/json
{
  • "links": {
    },
  • "items": [
    ]
}

Geofence

Geofences can be used to receive near-realtime webhooks on various Feature events.

Create a Geofence

Geofences allow for near-realtime webhooks when a point is ingested that matches specific criteria. The supported criteria modes are Point-to-Point distance and Point-in-Polygon. The supported events are documented as follows:

  • enter: A Point has entered a specific Polygon or is within the specified distance of another Point, when it was previously outside
  • exit: A Point has exited a specific Polygon or is outside of the specified distance of another Point, when it was previously inside
  • inside: A Point is inside a specific Polygon or is within the specified distance of another Point, and there is no previous state for the Point
Authorizations:
Request Body schema: application/json
One of
type
required
string
Value: "point_in_polygon"
required
object (V1FeatureReference)
required
object (V1FeatureReference)
event
required
string
Enum: "inside" "outside" "enter" "exit"

Responses

Request samples

Content type
application/json
Example
{
  • "type": "point_in_polygon",
  • "point": {
    },
  • "polygon": {
    },
  • "event": "inside"
}

Response samples

Content type
application/json
Example
{
  • "type": "point_in_polygon",
  • "point": {
    },
  • "polygon": {
    },
  • "event": "inside",
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z"
}

Fetch a Geofence

Authorizations:
path Parameters
uuid
required
string

Responses

Response samples

Content type
application/json
Example
{
  • "type": "point_in_polygon",
  • "point": {
    },
  • "polygon": {
    },
  • "event": "inside",
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z"
}

Delete a Geofence

Authorizations:
path Parameters
uuid
required
string

Responses

Add a new webhook to a Geofence

Webhooks will be sent on any of the following events: enter, exit, and inside via an HTTP POST request with a application/json request body. For example, if a Feature with the external_identifier vehicle_0001 entered a Geofence with the UUID 4d1695e5-85d2-4d81-8428-4dddc93b5d23, the following request body would be sent:

{
  "webhook_uuid": "2b946253-eccf-4015-a411-b9d806008147",
  "geofence_uuid": "4d1695e5-85d2-4d81-8428-4dddc93b5d23",
  "point_feature_collection": "0d9b7659-084c-4fc9-9be8-b66b01ada3a9",
  "point_external_identifier": "vehicle_0001",
  "event": "enter",
  "ingested": "2021-07-12T05:40:50+00:00"
}
Authorizations:
path Parameters
uuid
required
string
Request Body schema: application/json
url
required
string

Responses

Request samples

Content type
application/json
{
  • "url": "string"
}

Response samples

Content type
application/json
{
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "url": "string"
}

Fetch a specific Geofence webhook

Authorizations:
path Parameters
uuid
required
string
webhook_uuid
required
string

Responses

Response samples

Content type
application/json
{
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "url": "string"
}

Delete a Geofence webhook

Authorizations:
path Parameters
uuid
required
string
webhook_uuid
required
string

Responses

User

Get details about the currently requesting user

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "user": {
    },
  • "token": {
    }
}

GeoIP

Get the lat/lon for a given IP address

Authorizations:
Request Body schema: application/json
type
required
string
Value: "ip_address"
ip_address
required
string
ip_address_type
required
string
Value: "ipv4"

Responses

Request samples

Content type
application/json
{
  • "type": "ip_address",
  • "ip_address": "string",
  • "ip_address_type": "ipv4"
}

Response samples

Content type
application/json
{
  • "type": "raw_point",
  • "geography": [
    ]
}

Events

Search all account events

Search all events for your account. Geofence matches, entity changes, and more are logged as events. This endpoint will return at max 100 items, use the before/after filters to scroll through the events.

query Parameters
before
string <date-time>
after
string <date-time>
primary_entity_uuid
string (V1UUID)
Example: primary_entity_uuid=41699e18-4f02-48c1-b207-3b9003de1acf
primary_entity_type
string
event
string
order
string
Default: "desc"
Enum: "desc" "asc"

Responses

Response samples

Content type
application/json
{
  • "total_count": 0,
  • "current_count": 0,
  • "filtered_count": 0,
  • "items": [
    ]
}

Fetch a specific event

Fetch a specific event

path Parameters
uuid
required
string (V1UUID)
Example: 41699e18-4f02-48c1-b207-3b9003de1acf

Responses

Response samples

Content type
application/json
{
  • "uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "timestamp": "2019-08-24T14:15:22Z",
  • "event": "string",
  • "primary_entity": {
    },
  • "request_uuid": "41699e18-4f02-48c1-b207-3b9003de1acf",
  • "referenced_entities": [
    ],
  • "properties": { }
}