Geocode Address
Last updated 3 weeks ago
The Geocode Address action converts a street address into GPS coordinates (latitude and longitude) and returns standardized address components. Add it to any contact, company, deal, or ticket workflow to automatically enrich records with location data.
How It Works
Add the Geocode Address action to a HubSpot workflow. When a record reaches this step, the app takes the address fields you've configured, looks up the location, and returns precise coordinates along with a cleaned-up version of the address. Your workflow can then branch based on the result and use the output values in subsequent steps.
Action Inputs
When you add the Geocode Address action to your workflow, you'll configure the following fields:
| Field | Required | Description |
|---|---|---|
| Address Line 1 | No | Street address (e.g. 1600 Amphitheatre Parkway) |
| Address Line 2 | No | Apartment, suite, unit, floor, etc. (optional) |
| City | Yes | City or locality name |
| State / Region | No | State, province, or administrative region |
| ZIP / Postal Code | No | ZIP or postal code |
| Country | Yes | Country name or ISO code (e.g. United States, US, DE) |
Action Outputs
After the action runs, the following output values are available for use in subsequent workflow steps:
| Output | Type | Description |
|---|---|---|
| Latitude | Number | The north/south coordinate (e.g. 37.4224764) |
| Longitude | Number | The east/west coordinate (e.g. -122.0842499) |
| Formatted Address | Text | The complete, properly formatted address as recognized by the geocoding service |
| Street Number | Text | The building number extracted from the address |
| Street Name | Text | The street name extracted from the address |
| City | Text | The recognized city name |
| State | Text | The state or region abbreviation |
| Postal Code | Text | The recognized postal code |
| Country | Text | The full country name |
| Country Code | Text | The two-letter ISO country code (e.g. "US", "DE", "GB") |
| Success | Yes/No | Whether the geocoding completed successfully. Use this to branch your workflow. |
| Error Message | Text | If geocoding failed, a description of what went wrong |
Tip: To learn how to use these output values in later workflow actions (e.g., copy to a property, use in branching logic), see Using workflow action outputs in the HubSpot Knowledge Base.
Usage Examples
Enrich Contacts with Coordinates
Add the Geocode Address action to a contact workflow that triggers when a contact's address is updated. Map the contact's address, city, state, zip, and country properties to the action inputs. Then use the "Copy property" action to save the latitude and longitude to custom number properties on the contact record. These coordinates can then power a radius search or map visualization.
Territory Assignment
Create a workflow that geocodes new leads and branches based on coordinates. For example, branch on the returned state to route leads to the correct regional sales team. Or use latitude and longitude ranges to assign territories that don't follow state boundaries.
Address Standardization
Even if you don't need coordinates, the action is useful for cleaning up messy address data. Run records through the geocoder, then copy the standardized address components (formatted address, city, state, postal code, country code) back to the record's properties.
Flag Invalid Addresses
Add the action to a workflow and branch on the success result. Records that fail geocoding likely have invalid or incomplete addresses. Route them to a list or task queue for manual review.
Tips
- Provide as much address detail as possible for the most precise coordinates. A full street address is more accurate than just a city and country.
- You don't need every field - the action works with partial addresses. Even a postal code on its own will return an approximate location.
- Use the country field when geocoding addresses outside the United States. Without a country, the geocoder may return results from the wrong country for common city names.
- Branch on the success result to handle errors gracefully. Some addresses (especially incomplete or misspelled ones) may not return results.
- Check the formatted address returned by the action. If it doesn't match what you expected, the geocoder may have interpreted the address differently than intended.
- Be mindful of volume - each geocoding request uses your Google Maps API quota. If you're processing large batches of records, monitor your usage in the Google Cloud Console.
Thank you for your feedback!
Your input helps us improve our documentation.