Feature Collection

Estimated reading time: 2 minutes

The Feature Collection API lets you store and query GeoJSON features organized into collections. Collections are buckets that hold features.

  • Collections — create and manage feature collections.
  • Features — add, retrieve, and list GeoJSON features.

Access Token

Before accessing the Feature Collection API, you need a valid access token. You can get your access tokens in your Jawg App account.

All requests must include the access-token query parameter:

https://api.jawg.io/collections?access-token={your-access-token}

Collection object

A collection is a named container for GeoJSON features. Each collection has a unique identifier, is owned by an account, and records when it was last modified.

Collection object

{
  "id": "my-bus-stops",
  "ownerId": "258728f5-cb37-491f-b345-eb2d6868cdd3",
  "lastUpdate": "2024-01-15T10:30:00Z"
}
Field Type Description
id string Unique identifier of the collection.
ownerId UUID UUID of the account that owns the collection.
lastUpdate datetime ISO 8601 timestamp of the last modification.

Collection ID rules

  • Maximum 50 characters.
  • Cannot contain + or ..
  • If no id is provided at creation time, a UUID is generated automatically.

Create a collection

Creates a new collection. The request body is optional — if omitted a UUID is generated as the collection id.

POST https://api.jawg.io/collections?access-token={your-access-token}

Request body

The request body is optional. If provided, it must be a JSON object:

{
  "id": "my-bus-stops",    // optional — generated if absent
  "ownerId": "258728f5-cb37-491f-b345-eb2d6868cdd3"  // optional
}
Field Type Required Description
id string No Desired collection identifier. Must follow ID rules. A UUID is generated if absent.
ownerId UUID No Owner of the collection. Defaults to the authenticated user's account.

Response

// HTTP 201 Created
// Location: /collections/my-bus-stops

{
  "id": "my-bus-stops",
  "ownerId": "258728f5-cb37-491f-b345-eb2d6868cdd3",
  "lastUpdate": "2024-01-15T10:30:00Z"
}

Error codes

HTTP Description
409 A collection with the given id already exists.
403 The authenticated identity does not have the required permission.

Retrieve a collection

Returns the collection with the given id.

GET https://api.jawg.io/collections/{id}?access-token={your-access-token}

Path parameters

  • id required: The identifier of the collection.

Response

// HTTP 200 OK

{
  "id": "my-bus-stops",
  "ownerId": "258728f5-cb37-491f-b345-eb2d6868cdd3",
  "lastUpdate": "2024-01-15T10:30:00Z"
}

Error codes

HTTP Description
404 No collection found with the given id.
403 The authenticated identity does not have the required permission.

List collections

Returns all collections of a specific owner as a line-delimited JSON stream (application/x-ndjson).

GET https://api.jawg.io/collections?access-token={your-access-token}&ownerId={ownerId}

Query parameters

  • ownerId required (UUID): Filter collections to those owned by this account.

Request headers

Accept: application/x-ndjson

Response

Each line of the response body is a JSON-encoded Collection object:

// HTTP 200 OK
// Content-Type: application/x-ndjson

{"id":"my-bus-stops","ownerId":"258728f5-cb37-491f-b345-eb2d6868cdd3","lastUpdate":"2024-01-15T10:30:00Z"}
{"id":"my-poi","ownerId":"258728f5-cb37-491f-b345-eb2d6868cdd3","lastUpdate":"2024-01-16T08:00:00Z"}

Delete a collection

Deletes the collection and all of its features.

DELETE https://api.jawg.io/collections/{id}?access-token={your-access-token}

Path parameters

  • id required: The identifier of the collection to delete.

Response

HTTP 204 No Content

Error codes

HTTP Description
403 The authenticated identity does not have the required permission.