API overview

The JMAD REST API sits at https://dnk.co/japan/api/v1. Every path below is relative to that base. There is no API key. Read Authentication for what that means in practice.

The API returns the same data the building pages render. A request for DNK-JP-13-000010 on the API and a click on https://dnk.co/japan/tokyo/chiyoda/marunouchi-2-chome/DNK-JP-13-000010 get you the same fields, the same provenance, the same conflicts. The API just gets you there as JSON instead of HTML.

OpenAPI document

GET /japan/api/v1/openapi.json returns the full OpenAPI document. It's generated straight from the same Effect HttpApi definition that serves the endpoints, so the document can't drift from what the server actually does. Add a field to a response schema and it shows up in both places from one change.

curl https://dnk.co/japan/api/v1/openapi.json

The endpoint pages in this section (assets, areas) are generated from that document, so each one shows the exact request parameters and response schema the server enforces, with a runnable request form. The document uploaded here is regenerated from the code whenever the API changes.

Endpoints

MethodPathReturns
GET/assets/{id}A building's full record: fields, provenance, conflicts
GET/assets/{id}/sourcesThe list of sources cited on that record
GET/assetsSearch results, filtered by query and area
GET/owners/{name}/assetsEvery building attributed to one owner
GET/areas/{prefecture}A prefecture's summary, wards, and field coverage
GET/areas/{prefecture}/{ward}A ward's summary, machi-aza (町字, a Japanese neighborhood-level address unit), and field coverage
GET/areas/{prefecture}/{ward}/{machiAza}A machi-aza's summary and field coverage

{id} is a DNK asset ID such as DNK-JP-13-000010. Details on each group of endpoints live on their own pages: search and pagination covers the query parameters on /assets, and rate limits and errors covers what you get back when a request fails.

📘

Note

Markdown twins apply to the building and hub pages on the pretty URL tree (/japan/...), not to these JSON endpoints. See markdown twins and negotiation for how that Accept header negotiation works on those pages.

Versioning

The version lives in the path: v1. JMAD adds fields and endpoints without bumping it. A field added to a response won't break code that only reads the fields it expects. A breaking change, one that removes a field or changes what an existing field means, gets a new path segment (v2) rather than changing v1 under you.