Skip to content
GuidesBlogPlaygroundDashboard

Create a new dataset (admin only)

client.datasets.create(DatasetCreateParams { name, slug, attribution, 3 more } body, RequestOptionsoptions?): Dataset { id, inserted_at, name, 6 more }
POST/api/v1/datasets

Create a new dataset (admin only)

ParametersExpand Collapse
body: DatasetCreateParams { name, slug, attribution, 3 more }
name: string

Human-readable dataset name

slug: string

URL-friendly identifier (lowercase, hyphens, no spaces)

attribution?: string | null

Required attribution text

description?: string | null

Dataset description

license?: string | null

License identifier (e.g. CC-BY-4.0)

source_url?: string | null

Source data URL

formaturi
ReturnsExpand Collapse
Dataset { id, inserted_at, name, 6 more }

Metadata for a custom dataset. Datasets contain user-uploaded geospatial features separate from the OSM data.

id: string

Dataset UUID

formatuuid
inserted_at: string

Creation timestamp (UTC)

formatdate-time
name: string

Human-readable dataset name

slug: string

URL-friendly identifier

updated_at: string

Last update timestamp (UTC)

formatdate-time
attribution?: string | null

Required attribution text

description?: string | null

Dataset description

license?: string | null

License identifier (e.g. CC-BY-4.0)

source_url?: string | null

URL of the original data source

formaturi

Create a new dataset (admin only)

import Plaza from '@plazafyi/sdk';

const client = new Plaza({
  apiKey: process.env['PLAZA_API_KEY'], // This is the default and can be omitted
});

const dataset = await client.datasets.create({ name: 'NYC Bike Lanes', slug: 'nyc-bike-lanes' });

console.log(dataset.id);
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "inserted_at": "2019-12-27T18:11:19.117Z",
  "name": "NYC Bike Lanes",
  "slug": "nyc-bike-lanes",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "attribution": "attribution",
  "description": "description",
  "license": "license",
  "source_url": "https://example.com"
}
Returns Examples
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "inserted_at": "2019-12-27T18:11:19.117Z",
  "name": "NYC Bike Lanes",
  "slug": "nyc-bike-lanes",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "attribution": "attribution",
  "description": "description",
  "license": "license",
  "source_url": "https://example.com"
}