Shippo API を使ってお届け先住所を確認・整理・統一する このスキルは、配送サービス向け API(Shippo)を通じて、お客様から入力されたお届け先住所の情報を確認し、正しい形式に整理して、統一された形で処理します。 住所の誤記や不完全な入力を自動的に検出・修正し、配送手続きをスムーズに進めるのに役立ちます。
Validate, parse, and standardize shipping addresses via the Shippo API
Shippo APIは、ほとんどのエンドポイント(CreateShipmentを含む)で住所情報にv1フィールド名を使用します。以下の形式を常に使用してください:
| フィールド | 説明 | 例 |
|---|---|---|
name |
フルネーム | Jane Smith |
street1 |
住所第1行 | 731 Market St |
street2 |
住所第2行(オプション) | Suite 200 |
city |
市区町村 | San Francisco |
state |
都道府県 | CA |
zip |
郵便番号 | 94103 |
country |
ISO 3166-1 alpha-2国コード | US |
email |
メールアドレス(国際送信者は必須) | jane@example.com |
phone |
電話番号(国際送信者は必須) | +1-555-123-4567 |
注記:CreateAddressとValidateAddressはv2フィールド名(address_line_1、city_locality、state_province、postal_code)を使用しますが、CreateShipmentに住所をインラインで渡す場合は、上記のv1名を使用する必要があります。
street1、city、state、zip、country(ISO 3166-1 alpha-2)を集めます。CreateAddressを住所フィールドで呼び出します。これによって住所が保存され、オブジェクトIDが返されます。ValidateAddressを住所フィールドで呼び出して検証結果を取得します。注記:このエンドポイントはオブジェクトIDではなく、住所フィールドをクエリパラメータとして受け取ります。analysis.validation_result.valueを確認します。値は"valid"(有効)、"invalid"(無効)、または"partially_valid"(修正を適用した住所が見つかった)です。詳細はanalysis.validation_result.reasonsを確認してください。changed_attributesに列挙)を強調表示してください。analysis.address_type("residential"「住宅用」、"commercial"「商業用」、または"unknown")に注目します。住宅用分類は運送業者の追加料金に影響します。recommended_addressを返す場合は、それをユーザーに提示してください。partially_validの場合:修正内容を表示し、その修正が許可可能かどうかをユーザーに確認してください。ParseAddressを生のテキスト(例:「123 Main St, Springfield IL 62704」)で呼び出します。address_line_1、city_locality、state_province、postal_code。countryが含まれません。ユーザーに国を尋ねるか推定し、次に進む前に追加する必要があります。CreateAddress次にValidateAddressに渡します(上記のステップ2から構造化住所のワークフローに従ってください)。countryフィールドを必須にしてください。推測しないでください。一括検証エンドポイントはありません。住所ごとにCreateAddressを呼び出します。結果(行番号、有効/無効、修正内容、エラー、住宅用分類)を追跡し、完了時に概要を報告してください。50件以上のアドレスの場合は、処理時間について事前に説明し、進捗の更新を提供してください。
ValidateAddressを住所フィールドで呼び出します。このエンドポイントはオブジェクトIDではなく、住所フィールドで検証します。
CreateAddressが「住所が重複しています」というエラーを返す場合、その住所はアカウント内に既に存在します。ListAddressesで取得するか、検証に直接進んでください。
住所を検証する:
CreateAddress(住所を保存)+ ValidateAddress(同じフィールドで検証)
解析してから検証:
ParseAddress → 国を追加 → CreateAddress + ValidateAddress
<!-- ⚠️ DO NOT EDIT. Auto-generated from skills/address-validation/SKILL.md by scripts/sync.js Edits here will be overwritten on the next sync. To change this content, edit the canonical source and re-run the sync script. -->
The Shippo API uses v1 field names for address components in most endpoints (including CreateShipment). Always use:
| Field | Description | Example |
|---|---|---|
name |
Full name | Jane Smith |
street1 |
Street address line 1 | 731 Market St |
street2 |
Street address line 2 (optional) | Suite 200 |
city |
City | San Francisco |
state |
State or province | CA |
zip |
Postal code | 94103 |
country |
ISO 3166-1 alpha-2 country code | US |
email |
Email (required for international senders) | jane@example.com |
phone |
Phone (required for international senders) | +1-555-123-4567 |
Note: CreateAddress and ValidateAddress take the v2 field names (address_line_1, city_locality, state_province, postal_code), but when passing addresses inline to CreateShipment, you must use the v1 names above.
street1, city, state, zip, country (ISO 3166-1 alpha-2).CreateAddress with the address fields. This creates the address and returns an object ID.ValidateAddress with the address fields to get validation results. Note: this endpoint takes address fields as query parameters, not an object ID.analysis.validation_result.value in the response. Values: "valid", "invalid", or "partially_valid" (address found with corrections applied). Check analysis.validation_result.reasons for details.changed_attributes). Note analysis.address_type ("residential", "commercial", or "unknown") -- residential classification affects carrier surcharges.recommended_address, present it to the user.partially_valid: show what was corrected and ask the user to confirm the corrections are acceptable.ParseAddress with the raw string (e.g., "123 Main St, Springfield IL 62704").address_line_1, city_locality, state_province, postal_code.country. You must ask the user for the country or infer it, then add it before proceeding.CreateAddress then ValidateAddress (follow the structured address workflow above from step 2).country field. Do not guess.There is no batch validation endpoint. Call CreateAddress per address. Track results (row number, valid/invalid, corrections, errors, residential classification) and report a summary when done. For 50+ addresses, set expectations about processing time and provide progress updates.
Call ValidateAddress with the address fields. This endpoint validates by address fields, not by object ID.
If CreateAddress returns a "Duplicate address" error, the address already exists in the account. Retrieve it via ListAddresses or proceed directly to validation.
Validate an address:
CreateAddress (saves address) + ValidateAddress (validates with same fields)
Parse then validate:
ParseAddress -> add country -> CreateAddress + ValidateAddress
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。