--- title: "Is Zip Valid For City" slug: "is-zip-valid-for-city" tags: ["City", "zip", "USPS", "module"] updated: 2025-08-21T14:49:32Z published: 2025-08-21T14:49:32Z canonical: "documentation.decisions.com/is-zip-valid-for-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. # Is Zip Valid For City | ## Step Details | | --- | | **Introduced in Version** | 4.0.0 | | **Last Modified in Version** | 7.1.0 | | **Location** | Integration > USPS | The **Is Zip Valid For City** step determines whether the input zip is correct for 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 | | --- | --- | --- | | City | The desired city to evaluate. | String | | Zip | The desired zip code to evaluate. | String | ![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2025-08-21_10h22_03.png) --- ## Common Errors ### ZIPCode must be 5 characters If the zip code value is fewer than 5 characters, the step will cause an error. To correct this, ensure that the value length is 5 characters. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Substring 1[Substring] in flow [Display Steps]: Exception invoking method Substring on class StringSteps ---> DecisionsFramework.LoggedException: Exception invoking method Substring on class StringSteps ---> System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length') at System.String.Substring(Int32 startIndex, Int32 length) --- 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 --- ``` ### Object reference not set to an instance of an object If the City value is null or empty, the step will cause an error. To correct this, ensure that the value is configured correctly. #### Exception Message: ```csharp Exception Stack Trace: DecisionsFramework.Design.Flow.ErrorRunningFlowStep: Error running step Is Zip Valid For City 1[IsZipValidForCity] in flow [Flow 1]: Exception invoking method IsZipValidForCity on class USPSSteps ---> DecisionsFramework.LoggedException: Exception invoking method IsZipValidForCity on class USPSSteps ---> System.NullReferenceException: Object reference not set to an instance of an object. at Decisions.USPS.USPSSteps.IsZipValidForCity(String zip, String city) --- 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 Address Verification Service Integration](https://support.decisions.com/forum/topic1802-usps-address-verification-service.aspx) [USPS Integration: Get State From Zip](https://support.decisions.com/forum/topic3107-usps-integration-get-state-from-zip.aspx) [USPS Module Example: Get City & State By Zip](https://support.decisions.com/forum/topic29233-usps-module-example-get-city--state-by-zip.aspx) ## Related - [Get Cities By Zips](/get-cities-by-zips.md) - [Get City By Zip](/get-city-by-zip.md) - [Get Zip By City](/get-zip-by-city.md) - [Get Information By Zip](/get-information-by-zip.md)