๋ฌธ์„œ

Japan Data API ํ†ตํ•ฉ ๋ฐฉ๋ฒ• ์•Œ์•„๋ณด๊ธฐ

Quick Start

Get started with Japan Data API in minutes.

1
Create an Account

Sign up for a free account to get your API key. No credit card required.

Sign up free โ†’
2
Get Your API Key

Generate an API key from your dashboard. Keep it secret and secure.

3
Make Your First Request

Use your API key to authenticate requests and start fetching data.

Base URL

https://api.nihonbase.com/api/v1

Authentication

All API requests require authentication via an API key. Include your key in the X-API-Key header:

X-API-Key: YOUR_API_KEY

Alternatively, you can use Authorization: Bearer YOUR_API_KEY (where YOUR_API_KEY is your jda_โ€ฆ key, not a session token).

API Endpoints

Explore all available endpoints.

Regions
GET
/regions

List all regions

Prefectures
GET
/prefectures

List all prefectures

GET
/prefectures?region_id={id}

List prefectures in a region

Cities
GET
/cities

List all cities (paginated)

GET
/cities?prefecture_id={id}

List cities in a prefecture

Holidays
GET
/holidays

List holidays (current year)

GET
/holidays?year=2024

List holidays for a specific year

Era
GET
/era

List all Japanese eras

GET
/era/{year}

Get era for a specific year

Code Examples

Examples in popular programming languages.

curl -X GET "https://api.nihonbase.com/api/v1/prefectures" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Accept: application/json"

Response Format

All responses follow a consistent JSON structure:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Hokkaido",
      "name_ja": "ๅŒ—ๆตท้“",
      "name_en": "Hokkaido",
      "slug": "hokkaido",
      "iso_code": "JP-01",
      "region_id": 1,
      "capital": "Sapporo",
      "area_km2": 83424,
      "population": 5224614
    },
    {
      "id": 2,
      "name": "Aomori",
      "name_ja": "้’ๆฃฎ็œŒ",
      "name_en": "Aomori",
      "slug": "aomori",
      "iso_code": "JP-02",
      "region_id": 2,
      "capital": "Aomori",
      "area_km2": 9645,
      "population": 1237984
    }
  ],
  "meta": {
    "page": 1,
    "limit": 50,
    "total": 47
  },
  "error": null
}

Error Handling

When an error occurs, the API returns a structured error response:

{
  "success": false,
  "data": null,
  "meta": {},
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "Unauthenticated."
  }
}

Common Error Codes

CodeHTTP StatusDescription
UNAUTHENTICATED401Missing or invalid API key
NOT_FOUND404Resource not found
RATE_LIMIT_EXCEEDED429Too many requests
INTERNAL_SERVER_ERROR500Internal server error