SmartyStreets Go SDK

If you want to access our US Street Address API or US ZIP Code API from an application written in the Go programming language, the SmartyStreets Go SDK can make it a lot easier. Our Go SDK includes ready-made data structures and takes care of all the gritty, low-level HTTP intricacies for you.


  1. Requirements
  2. How to Get It
    1. The 'go' Command
    2. Download the Source Code
  3. How to Use It
    1. Demo
    2. Documentation
    3. Examples
  4. API Reference Material


  1. Decide to build a software project using the Go programming language.
  2. Download and install Go version 1.7+.
  3. Setup a Go workspace.
  4. Build enough of the project to realize that you now need an address verification component.
  5. Wisely conclude that you don't want to build your own address verification component.
  6. Realize that SmartyStreets has already created an address verification component.
  7. Congratulations! You are now ready to use the SmartyStreets Go SDK.

How to Get It

The 'go' Command

The easiest way to get your giddy hands on this goodness is by using the go command at the terminal.

go get -t -u

You can then import the SDK packages in your Go project. (See the examples below.)

Download the Source Code

You can download the source code from the SmartyStreets Go SDK repository on Github.

Use the source, Luke!

How to Use It



If you're new to the Go community, do yourself a favor and learn about godoc and The Go SDK makes use of godoc conventions for documenting source code, which you can read by downloading the source code or perusing the auto-generated documentation for each package in the SDK:


Here's an example of how to use the Go SDK:

Verifying US Street Addresses

package main

import (


func main() {

	var (
		authID     = "YOUR_AUTH_ID_HERE"    // or use an environment variable: os.Getenv("SMARTY_AUTH_ID")
		authToken  = "YOUR_AUTH_TOKEN_HERE" // or use an environment variable: os.Getenv("SMARTY_AUTH_TOKEN")
		client     = wireup.BuildUSStreetAPIClient(wireup.SecretKeyCredential(authID, authToken))

	lookup1 := &street.Lookup{
		Street:        "1 Rosedale",
		City:          "Baltimore",
		State:         "MD",
		MaxCandidates: 10, // This input produces more than one candidate!
	lookup2 := &street.Lookup{
		Street: "1600 Pennsylvania Avenue",
		City:   "Washington",
		State:  "DC",
	lookup3 := &street.Lookup{
		Street: "1600 Amphitheatre Parkway Mountain View, CA 94043",

	batch := street.NewBatch()

	if err := client.SendBatch(batch); err != nil {
		log.Fatal("Error sending batch:", err)

	for i, input := range batch.Records() {
		fmt.Println("Results for input:", i)
		for j, candidate := range input.Results {
			fmt.Println("\t Candidate:", j)
			fmt.Println("\t", candidate.DeliveryLine1)
			fmt.Println("\t", candidate.LastLine)

Here's the output from a successful run of the above example code:

Results for input: 0

  Candidate: 0
  1 N Rosedale St
  Baltimore MD 21229-3737

  Candidate: 1
  1 S Rosedale St
  Baltimore MD 21229-3739

Results for input: 1

  Candidate: 0
  1600 Pennsylvania Ave SE
  Washington DC 20003-3228

Results for input: 2

  Candidate: 0
  1600 Amphitheatre Pkwy
  Mountain View CA 94043-1351
This site uses cookies for analytics, personalized content, and ads. By continuing to browse this site, you agree to this use.