درخواست شما همچنین باید یک بدنه درخواست JSON را به درخواستی ارسال کند که آدرسی را برای تأیید اعتبار تعریف می کند. بدنه درخواست زیر شامل یک فیلد و سه زیر فیلد است:
address - فیلدی از نوع PostalAddress ، که باید حداقل یک ورودی در addressLines داشته باشد.
هنگام ارسال فیلد address به Address Validation API، فقط باید یک فیلد ارائه دهید: addressLines . با این حال، ساده ترین درخواست آدرس باید شامل زیرفیلدهای زیر باشد:
regionCode - توصیه می شود. این یک فیلد اختیاری است، اما اگر حذف شود، Address Validation API منطقه را از آدرس استنتاج می کند. با این حال، برای بهترین نتیجه، اگر می دانید regionCode وارد کنید. برای لیست مناطق پشتیبانی شده، به مناطق پشتیبانی شده مراجعه کنید.
addressLines - لازم است. آرایه ای با آدرس هایی که ساختار پایین آدرس را توصیف می کند.
فقط برای مناطق ایالات متحده و روابط عمومی، می توانید پردازش CASS را با تنظیم enableUspsCass روی true در بدنه درخواست فعال کنید. برای بهترین نتایج هنگام استفاده از CASS، آدرسی ارائه کنید که شامل شماره خیابان و خیابان به همراه شهر، ایالت و کد پستی باشد:
APIs Explorer به شما امکان می دهد درخواست های نمونه بسازید تا بتوانید با API و گزینه های API آشنا شوید.
آیکون API را در سمت راست صفحه انتخاب کنید.
به صورت اختیاری پارامترهای درخواست را ویرایش کنید.
دکمه Execute را انتخاب کنید. در گفتگو، حسابی را که میخواهید برای ارسال درخواست استفاده کنید، انتخاب کنید.
در پانل APIs Explorer، نماد تمام صفحه تمام صفحه را انتخاب کنید تا پنجره APIs Explorer گسترش یابد.
Google Maps Platform یک دارنده مجوز غیر انحصاری از US Postal Service® است. علامت(های) تجاری زیر متعلق به US Postal Service® است و با مجوز استفاده می شود: US Postal Service®، CASS™، CASS Certified™. ↩
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Address Validation API validates addresses using a POST request to a specified endpoint with a JSON request body containing the address details.\u003c/p\u003e\n"],["\u003cp\u003eThe request body minimally requires the \u003ccode\u003eaddressLines\u003c/code\u003e field, while \u003ccode\u003eregionCode\u003c/code\u003e is recommended for improved accuracy.\u003c/p\u003e\n"],["\u003cp\u003eFor US and PR addresses, enabling the \u003ccode\u003eenableUspsCass\u003c/code\u003e option leverages the CASS™ system for enhanced validation and standardization.\u003c/p\u003e\n"],["\u003cp\u003eUsers can experiment with the API using the API Explorer, which allows for composing requests, customizing parameters, and executing them.\u003c/p\u003e\n"]]],["To validate an address, send a POST request to the provided REST or gRPC endpoint, including a JSON request body that defines the address. The request body must contain the `address` field, a `PostalAddress` type with at least one entry in `addressLines`. Recommended subfields are `regionCode` and `addressLines`; the simplest request should have both. For US and PR regions, enabling `enableUspsCass` will use USPS CASS processing. Use the APIs Explorer to make sample requests.\n"],null,["**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\nSend an address validation request by issuing a POST request to one of the\nfollowing endpoints:\n\n- [validateAddress](/maps/documentation/address-validation/reference/rest/v1/TopLevel/validateAddress) (REST)\n- [ValidateAddress](/maps/documentation/address-validation/reference/rpc/google.maps.addressvalidation.v1#google.maps.addressvalidation.v1.AddressValidation.ValidateAddress) (gRPC)\n\n| **Note:** This documentation uses REST for its examples, but the approach is similar with [gRPC](https://www.grpc.io/).\n\nYour request should also pass a [JSON request body](/maps/documentation/address-validation/reference/rest/v1/TopLevel/validateAddress#request-body) to the request that\ndefines the address to validate. The following request body contains one field\nand three subfields: \n\n```json\ncurl -X POST -d '{\n \"address\": {\n \"regionCode\": \"US\",\n \"locality\": \"Mountain View\",\n \"addressLines\": [\"1600 Amphitheatre Pkwy\"]\n }\n}' \\\n-H 'Content-Type: application/json' \\\n\"https://addressvalidation.googleapis.com/v1:validateAddress?key=\u003cvar translate=\"no\"\u003eAPI_KEY\u003c/var\u003e\"\n```\n\nYou can also omit `locality` and specify it as an element in\nthe `addressLines` array: \n\n {\n \"address\": {\n \"regionCode\": \"US\",\n \"addressLines\": [\"1600 Amphitheatre Pkwy\", \"Mountain View, CA, 94043\"]\n },\n }\n\nThe APIs Explorer lets you make live requests so that you can get familiar with\nthe API and the API options: \n[Try it!](#try_it)\n\nAddress request fields\n\nThe request body consists of a single field:\n\n- `address` --- a field of type [`PostalAddress`](/maps/documentation/address-validation/reference/rest/v1/TopLevel/validateAddress#postaladdress), which must contain at least one entry in `addressLines`.\n\nWhen sending the `address` field to the Address Validation API, you need only\nsupply one field: `addressLines`. However, the simplest address request\nshould contain the following subfields:\n\n- `regionCode` --- Recommended. This is an optional field, but if omitted, the Address Validation API infers the region from the address. However, for best results, include the `regionCode` if you know it. For the list of supported regions, see [supported regions](/maps/documentation/address-validation/coverage).\n- `addressLines` --- Required. An array with addresses describing the lower structure of the address.\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| See [PostalAddress](/maps/documentation/address-validation/reference/rest/v1/TopLevel/validateAddress#postaladdress) in the reference guide. |\n\nUSPS CASS™ option\n\nThe United States Postal Service® (USPS®)^[1](#fn1)^ maintains the\n[Coding Accuracy Support System (CASS™)](https://postalpro.usps.com/certifications/cass) to support and certify\naddress validation providers.\n| **Note:** The Address Validation API is confirmed as a CASS-Certified™ service. This means the service is confirmed for its ability to fill in missing address information, standardize it, and update it to the most current and accurate address.\n\nFor US and PR regions only, you can enable CASS processing by setting\n`enableUspsCass` to `true` in the request body. For best results when using\nCASS, provide an address that includes the street and street number along with\nthe city, state, and ZIP code: \n\n {\n \"address\": {\n \"regionCode\": \"US\",\n \"locality\": \"Mountain View\",\n \"administrativeArea\": \"CA\",\n \"postalCode\": \"94043\",\n \"addressLines\": [\"1600 Amphitheatre Pkwy\"]\n },\n \"enableUspsCass\": true\n }\n\n| **Note:** If you don't require CASS processing, or if you are validating addresses outside of the US and PR regions, Google does not recommend enabling this feature.\n\nTry it!\n\nThe APIs Explorer lets you make sample requests so\nthat you can get familiar with the API and the API options.\n\n1. Select the API icon api\n on the right side of the page.\n\n2. Optionally edit the request parameters.\n\n3. Select the **Execute** button. In the dialog, choose the account\n that you want to use to make the request.\n\n4. In the APIs Explorer panel, select the fullscreen icon\n fullscreen to expand the APIs Explorer window.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n1. Google Maps Platform is a non-exclusive Licensee of the United States\n Postal Service®. The following trademark(s) are owned by the United States\n Postal Service® and used with permission: United States Postal Service®,\n CASS™, CASS Certified™. [↩](#fnref1)"]]