--- title: "Get Zip By City" slug: "get-zip-by-city" tags: ["City", "zip", "USPS", "module"] updated: 2025-08-21T14:49:26Z published: 2025-08-21T14:49:26Z canonical: "documentation.decisions.com/get-zip-by-city" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt > Use this file to discover all available pages before exploring further. # Get Zip By City | ## Step Details | | --- | | **Introduced in Version** | 4.0.0 | | **Last Modified in Version** | 7.1.0 | | **Location** | Integration > USPS | The **Get Zip By City** step returns the zip code of the specified city. ### Prerequisites This step requires the [USPS module](https://documentation.decisions.com/docs/usps) to be [installed](https://documentation.decisions.com/docs/installing-modules-decisions) before it will be available in the toolbox. --- ## Properties #### Inputs | Property | Description | Data Type | | --- | --- | --- | | Address1 | Defines the first line of the desired address. | String | | Address2 | Defines the second line of the desired address. | String | | City | Defines the city of the address. | String | | State | The 2 letter abbreviation of the state. (ie. VA for Virginia) | String | #### Outputs | Property | Description | Data Type | | --- | --- | --- | | Output | Outputs the zip code of the specified address. | String | ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2025-08-21_10h12_38.png) --- ## Example Inputs and Outputs | Address1 | Address2 | City | State | Output | | --- | --- | --- | --- | --- | | 650 Providence Road | Null | Chesapeake | VA | 23325 | | 4850 West Road | Suite 112 | Norfolk | CA | EXCEPTION MESSAGE | | Null | Apartment 102 | El Paso | TX | EXCEPTION MESSAGE | | Empty | Ignore | Richmond | VA | EXCEPTION MESSAGE | --- ## Common Errors ### Address Not Valid If the Address1 field has a null or empty value, the step will cause an error. To correct this, ensure the value entered or mapped to the field is valid. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Get Zip By City 1[GetZipByCity] in flow [Flow 1]: Exception invoking method GetZipByCity on class USPSSteps ---> DecisionsFramework.LoggedException: Exception invoking method GetZipByCity on class USPSSteps ---> Decisions.USPS.USPSException: Address Not Found. at Decisions.USPS.USPSSteps.GetZipByCity(String address1, String address2, String city, String state) --- End of inner exception stack trace --- at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) --- End of inner exception stack trace --- ``` --- ### Invalid City If the City or State values are null, empty, or invalid, the step will cause an error. To correct this, ensure that the values for the fields are mapped or entered correctly. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Get Zip By City 1[GetZipByCity] in flow [Flow 1]: Exception invoking method GetZipByCity on class USPSSteps ---> DecisionsFramework.LoggedException: Exception invoking method GetZipByCity on class USPSSteps ---> Decisions.USPS.USPSException: Invalid City. at Decisions.USPS.USPSSteps.GetZipByCity(String address1, String address2, String city, String state) --- End of inner exception stack trace --- at DecisionsFramework.Design.Flow.StepImplementations.InvokeMethodStep.Run(StepStartData data at DecisionsFramework.Design.Flow.FlowStep.RunStepInternal(String flowTrackingID, String stepTrackingID, KeyValuePairDataStructure[] stepRunDataValues, AbstractFlowTrackingData trackingData at DecisionsFramework.Design.Flow.FlowStep.Start(String flowTrackingID, String stepTrackingID, FlowStateData data, AbstractFlowTrackingData trackingData, RunningStepData currentStepData) --- End of inner exception stack trace --- ``` --- Related Information Forum Posts: [USPS Module Example: Get City & State By Zip](https://support.decisions.com/forum/topic29233-usps-module-example-get-city--state-by-zip.aspx) [USPS Address Verification Service](https://support.decisions.com/forum/topic1802-usps-address-verification-service.aspx) [Get State From Zip](https://support.decisions.com/forum/topic3107-usps-integration-get-state-from-zip.aspx) ## Related - [Get Cities By Zips](/get-cities-by-zips.md) - [Get City By Zip](/get-city-by-zip.md) - [Is Zip Valid For City](/is-zip-valid-for-city.md) - [Get Information By Zip](/get-information-by-zip.md)