Skip to content
GuidesBlogPlaygroundDashboard

Create a new dataset (admin only)

$client->datasets->create(string name, string slug, ?string attribution, ?string description, ?string license, ?string sourceURL): Dataset
POST/api/v1/datasets

Create a new dataset (admin only)

ParametersExpand Collapse
name: string

Human-readable dataset name

slug: string

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

attribution?:optional string

Required attribution text

description?:optional string

Dataset description

license?:optional string

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

sourceURL?:optional string

Source data URL

ReturnsExpand Collapse
string id

Dataset UUID

\Datetime insertedAt

Creation timestamp (UTC)

string name

Human-readable dataset name

string slug

URL-friendly identifier

\Datetime updatedAt

Last update timestamp (UTC)

?string attribution

Required attribution text

?string description

Dataset description

?string license

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

?string sourceURL

URL of the original data source

Create a new dataset (admin only)

<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(apiKey: 'My API Key', environment: 'local');

$dataset = $client->datasets->create(
  name: 'NYC Bike Lanes',
  slug: 'nyc-bike-lanes',
  attribution: 'attribution',
  description: 'description',
  license: 'license',
  sourceURL: 'https://example.com',
);

var_dump($dataset);
{
  "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"
}