### Get API Token Response Sample (JSON) Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz This is a sample successful response for an API token request. It returns a Bearer token, its expiration time in seconds, and the associated scope. This token is required for subsequent API calls. ```json { "scope": "J1", "token_type": "Bearer", "expires_in": 123456, "token": "{アクセストークン}" } ``` -------------------------------- ### GET /api/v1/searchcode/{search_code} Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz 郵便番号、事業所個別郵便番号、デジタルアドレスの統一検索エンドポイント。いずれかを指定して検索を行い、住所情報を返します。検索時に、ページ番号や取得件数を指定できます。指定がない場合はデフォルト値が適用されます。 ```APIDOC ## GET /api/v1/searchcode/{search_code} ### Description 郵便番号、事業所個別郵便番号、デジタルアドレスの統一検索エンドポイント。いずれかを指定して検索を行い、住所情報を返します。検索時に、ページ番号や取得件数を指定できます。指定がない場合はデフォルト値が適用されます。 ### Method GET ### Endpoint /api/v1/searchcode/{search_code} ### Parameters #### Path Parameters - **search_code** (string) - Required - 郵便番号 (3桁以上の数値。入力された値が7桁未満であった場合、入力値から始まるデータをパターン検索する。)、事業所個別郵便番号、またはデジタルアドレス。 #### Query Parameters - **page** (number) - Optional - ページ番号 (デフォルト値:1) - **limit** (number) - Optional - 取得する最大レコード数 (デフォルト値:1000、最大値:1000) - **choikitype** (number) - Optional - 返却する町域フィールドを指定 (指定がない場合はchoikitype=1とみなす)。 - `1`: 括弧なし - `2`: 括弧あり - **searchtype** (number) - Optional - 検索対象を指定 (指定がない場合はsearchtype=1とみなす)。 - `1`: 郵便番号、事業所個別郵便番号、デジタルアドレスを検索 - `2`: 郵便番号、デジタルアドレスを検索 ### Request Example ```json { "addresses": [ { "dgacode": null, "zip_code": 100492, "pref_code": "05", "pref_name": "秋田県", "pref_kana": null, "pref_roma": null, "city_code": 5368, "city_name": "南秋田郡大潟村", "city_kana": null, "city_roma": null, "town_name": "字西", "town_kana": null, "town_roma": null, "biz_name": "あきたこまち生産者協会", "biz_kana": "アキタコマチセイサンシヤキヨウカイ", "biz_roma": null, "block_name": "4丁目88", "other_name": null, "address": null, "longitude": null, "latitude": null } ], "searchtype": "bizzipcode", "limit": 10, "count": 1, "page": 1 } ``` ### Response #### Success Response (200) 検索した郵便番号、事業所個別郵便番号、デジタルアドレスの情報を返します。郵便番号、事業所個別郵便番号、デジタルアドレスはテーブル定義に差異があるため、データが無い項目についてはnullをセットして返します。 #### Response Example ```json { "addresses": [ { "dgacode": null, "zip_code": 100492, "pref_code": "05", "pref_name": "秋田県", "pref_kana": null, "pref_roma": null, "city_code": 5368, "city_name": "南秋田郡大潟村", "city_kana": null, "city_roma": null, "town_name": "字西", "town_kana": null, "town_roma": null, "biz_name": "あきたこまち生産者協会", "biz_kana": "アキタコマチセイサンシヤキヨウカイ", "biz_roma": null, "block_name": "4丁目88", "other_name": null, "address": null, "longitude": null, "latitude": null } ], "searchtype": "bizzipcode", "limit": 10, "count": 1, "page": 1 } ``` ``` -------------------------------- ### Get API Token Request Sample (JSON) Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz This is a sample request payload for obtaining an API access token. It requires the grant type, client ID, and secret key. The response includes the access token, token type, expiration time, and scope. ```json { "grant_type": "client_credentials", "client_id": "TEST7t6fj7eqC5v6UDaHlpvvtesttest", "secret_key": "testGzhSdzpZ1muyICtest0123456789" } ``` -------------------------------- ### POST /api/v1/addresszip Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz 住所の一部から該当する郵便番号・住所情報を検索します。リクエストのデータタイプ(コード、名称、カタカナ、ローマ字、フリーワード)を指定して、マッチングレベルに応じたデータを返します。 ```APIDOC ## POST /api/v1/addresszip ### Description 住所の一部から該当する郵便番号・住所情報を検索します。リクエストのデータタイプ(コード、名称、カタカナ、ローマ字、フリーワード)を指定して、マッチングレベルに応じたデータを返します。 ### Method POST ### Endpoint /api/v1/addresszip ### Parameters #### Query Parameters - **ec_uid** (string) - Optional - プロバイダーのユーザーID。 #### Request Body - **pref_code** (string) - Optional - 都道府県コード。 - **pref_name** (string) - Optional - 都道府県名。 - **pref_kana** (string) - Optional - 都道府県名カナ。 - **pref_roma** (string) - Optional - 都道府県名ローマ字。 - **city_code** (string) - Optional - 市区町村コード。 - **city_name** (string) - Optional - 市区町村名。 - **city_kana** (string) - Optional - 市区町村名カナ。 - **city_roma** (string) - Optional - 市区町村名ローマ字。 - **town_name** (string) - Optional - 町域。 - **town_kana** (string) - Optional - 町域カナ。 - **town_roma** (string) - Optional - 町域ローマ字。 - **freeword** (string) - Optional - フリーワード。 - **flg_getcity** (number) - Optional - 市区町村一覧のみ取得フラグ (デフォルト値:0、 0:すべての情報を取得、1:市区町村のみの情報を取得)。 - **flg_getpref** (number) - Optional - 都道府県一覧のみ取得フラグ (デフォルト値:0、0:すべての情報を取得、1:都道府県のみの情報を取得)。 - **page** (integer) - Optional - ページ数 (デフォルト値:1)。 - **limit** (integer) - Optional - 取得最大レコード数 (デフォルト値:1000、最大値:1000)。 ### Request Example ```json { "pref_code": "13", "city_code": "13102", "flg_getcity": 0, "flg_getpref": 0, "page": 1, "limit": 100 } ``` ### Response #### Success Response (200) 検索した住所、マッチングレベル、郵便番号を返します。 - マッチングレベル :1 都道府県レベルで一致 - マッチングレベル :2 市区町村レベルで一致 - マッチングレベル :3 町域レベルで一致 #### Response Example ```json { "addresses": [ { "dgacode": null, "zip_code": 100492, "pref_code": "05", "pref_name": "秋田県", "pref_kana": null, "pref_roma": null, "city_code": 5368, "city_name": "南秋田郡大潟村", "city_kana": null, "city_roma": null, "town_name": "字西", "town_kana": null, "town_roma": null, "biz_name": "あきたこまち生産者協会", "biz_kana": "アキタコマチセイサンシヤキヨウカイ", "biz_roma": null, "block_name": "4丁目88", "other_name": null, "address": null, "longitude": null, "latitude": null } ], "searchtype": "bizzipcode", "limit": 10, "count": 1, "page": 1 } ``` ``` -------------------------------- ### Search Postal Code by Address Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz Searches for postal codes and address information based on partial address inputs. Returns address details and matching levels. Supports pagination and record limiting with default values applied if not specified. Prioritizes specific codes over names when both are provided. ```json { "pref_code": "13", "city_code": "13102", "flg_getcity": 0, "flg_getpref": 0, "page": 1, "limit": 100 } ``` -------------------------------- ### Search Postal Code, Business Postal Code, Digital Address Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz Unified search endpoint for postal codes, business-specific postal codes, and digital addresses. Allows searching by specifying any of these and returns address information. Supports pagination and record limiting. Default values are applied if not specified. ```json { "addresses": [ { "dgacode": null, "zip_code": 100492, "pref_code": "05", "pref_name": "秋田県", "pref_kana": null, "pref_roma": null, "city_code": 5368, "city_name": "南秋田郡大潟村", "city_kana": null, "city_roma": null, "town_name": "字西", "town_kana": null, "town_roma": null, "biz_name": "あきたこまち生産者協会", "biz_kana": "アキタコマチセイサンシヤキヨウカイ", "biz_roma": null, "block_name": "4丁目88", "other_name": null, "address": null, "longitude": null, "latitude": null }, { "dgacode": null, "zip_code": 100492, "pref_code": "05", "pref_name": "秋田県", "pref_kana": null, "pref_roma": null, "city_code": 5368, "city_name": "南秋田郡大潟村", "city_kana": null, "city_roma": null, "town_name": "字西", "town_kana": null, "town_roma": null, "biz_name": "あきたこまち生産者協会", "biz_kana": "アキタコマチセイサンシヤキヨウカイ", "biz_roma": null, "block_name": "4丁目88", "other_name": null, "address": null, "longitude": null, "latitude": null } ], "searchtype": "bizzipcode", "limit": 10, "count": 1, "page": 1 } ``` -------------------------------- ### Address Lookup Response Sample (JSON) Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz This JSON structure represents a successful response from an address lookup API. It contains an array of address objects, pagination details (level, limit, count, page), and the actual address information including zip code, prefecture, and city details. ```json { "addresses": [ [ { "zip_code": "1040044", "pref_code": "13", "pref_name": "東京都", "pref_kana": "トウキョウト", "pref_roma": "TOKYO", "city_code": "13102", "city_name": "中央区", "city_kana": "チュウオウク", "city_roma": "CHUO-KU", "town_name": "明石町", "town_kana": "アカシチョウ", "town_roma": "AKASHICHO" }, { "zip_code": "1040042", "pref_code": "13", "pref_name": "東京都", "pref_kana": "トウキョウト", "pref_roma": "TOKYO", "city_code": "13102", "city_name": "中央区", "city_kana": "チュウオウク", "city_roma": "CHUO-KU", "town_name": "入船一丁目", "town_kana": "イリフネ 1", "town_roma": "IRIFUNE 1" } ], [ { "zip_code": "1040044", "pref_code": "13", "pref_name": "東京都", "pref_kana": "トウキョウト", "pref_roma": "TOKYO", "city_code": "13102", "city_name": "中央区", "city_kana": "チュウオウク", "city_roma": "CHUO-KU", "town_name": "明石町", "town_kana": "アカシチョウ", "town_roma": "AKASHICHO" }, { "zip_code": "1040042", "pref_code": "13", "pref_name": "東京都", "pref_kana": "トウキョウト", "pref_roma": "TOKYO", "city_code": "13102", "city_name": "中央区", "city_kana": "チュウオウク", "city_roma": "CHUO-KU", "town_name": "入船一丁目", "town_kana": "イリフネ 1", "town_roma": "IRIFUNE 1" } ] ], "level": 2, "limit": 100, "count": 2, "page": 1 } ``` -------------------------------- ### POST /api/v1/j/token Source: https://biz.da.pf.japanpost.jp/apireference/digiadd-swagger-biz Obtain an API access token required for utilizing the Japan Post API. This endpoint uses OAuth 2.0 client credentials grant type. ```APIDOC ## POST /api/v1/j/token ### Description Obtain an API access token required for utilizing the Japan Post API. This endpoint uses OAuth 2.0 client credentials grant type. A token is returned in JWT format upon successful validation of the client ID and secret key. ### Method POST ### Endpoint https://api.da.pf.japanpost.jp/api/v1/j/token ### Parameters #### Header Parameters - **x-forwarded-for** (string) - Required - The originating IP address. #### Request Body - **grant_type** (string) - Required - Must be set to "client_credentials". - **client_id** (string) - Required - Your client ID obtained during organization and system registration. - **secret_key** (string) - Required - Your secret key obtained during organization and system registration. ### Request Example ```json { "grant_type": "client_credentials", "client_id": "TEST7t6fj7eqC5v6UDaHlpvvtesttest", "secret_key": "testGzhSdzpZ1muyICtest0123456789" } ``` ### Response #### Success Response (200) - **scope** (string) - The scope of the token. - **token_type** (string) - The type of the token (e.g., "Bearer"). - **expires_in** (integer) - The token's expiration time in seconds. - **token** (string) - The generated access token. #### Response Example ```json { "scope": "J1", "token_type": "Bearer", "expires_in": 123456, "token": "{access_token}" } ``` #### Error Responses - **400** - Bad Request - **401** - Unauthorized - **403** - Forbidden - **500** - Internal Server Error ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.