# BNPB API

> Returns datasets of the Indonesian disaster agency's open-data catalogue (disaster statistics, hazard and risk maps, shelters), their files and the agencies that publish them.

Category: Government & Open Data. Region: ID. 4 endpoints at `https://api.hoshime.com/v1/bnpb/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/bnpb
## GET /v1/bnpb/datasets

Search the BNPB open-data catalogue for datasets (disaster statistics, hazard and risk maps, shelters) by keyword, paged.

Scope: `social:read` · Units: 1 · Cached: 30 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | no | Keyword to find in the dataset titles and descriptions, such as bencana or gempa. (e.g. bencana) |
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `limit` | integer | no | Items per page, 1 to 100. (default 20; e.g. 5) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `createdAt` (string), `description` (string), `id` (string), `license` (string), `modifiedAt` (string), `name` (string), `organization` (string), `resourceCount` (integer (int64)), `tags` (string[]), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bnpb/datasets?query=bencana&limit=5" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bnpb/dataset

One BNPB open-data dataset with its description and downloadable resources (CSV, XLSX, SHP and other files).

Scope: `social:read` · Units: 1 · Cached: 60 min

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | Dataset name (the slug in its /dataset/ URL) or id. (e.g. bencana) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `createdAt` (string), `description` (string), `id` (string), `license` (string), `modifiedAt` (string), `name` (string), `organization` (string), `resourceCount` (integer (int64)), `resources` (Resource[]), `resources[].description` (string), `resources[].format` (string), `resources[].id` (string), `resources[].modifiedAt` (string), `resources[].name` (string), `resources[].url` (string), `tags` (string[]), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bnpb/dataset?id=bencana" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bnpb/datasetNames

The names and catalogue pages of every BNPB open-data dataset, in the catalogue's order, paged.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `limit` | integer | no | Items per page, 1 to 1000. (default 100) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `name` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bnpb/datasetNames" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/bnpb/organizations

The agencies and offices that publish datasets on the BNPB open-data catalogue, with their dataset counts, paged.

Scope: `social:read` · Units: 1 · Cached: 60 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `cursor` | string | no | meta.pagination.nextCursor of the previous page. Omit it for the first page. |
| `limit` | integer | no | Items per page, 1 to 100. (default 50) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `createdAt` (string), `datasetCount` (integer (int64)), `description` (string), `id` (string), `name` (string), `title` (string), `url` (string)

```bash
curl "https://api.hoshime.com/v1/bnpb/organizations" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
