Road Closed

This information is outdated and is no longer maintained. Get the latest!

 

401? 402? What does that mean?

Question

Last Updated: Aug 12, 2013

I'm getting an HTTP status code when I try to use the API. What does it mean?

Answer

Whether you're using LiveAddress API, or the ZIP Code API, there are a few standard response messages that you might see. Here's a quick chart to explain:

Response CodeDefinition
200Success. See response body for result payload. Now what?
400Bad input. Required fields missing from input or are malformed. Now what?
401Unauthorized. Authentication failure; invalid credentials. Now what?
402Payment required. No active subscription found. Now what?
500Internal server error. General service failure; retry request. Now what?

What do I do now?

200
Most API requests will return a 200 response. This means that everything went through just fine, and you should see your results as expected. Nothing here to worry about. Hooray!

400
Make sure your request has all the information we need to process it and is formatted correctly. For example, if you submit this request with the field "street" misspelled: https://us-street.api.smartystreets.com/street-address?auth-id=[your_auth_id]&auth-token=[your_auth_token]&street=1600-Amphitheatre-Parkway&stret2=&city=Mountain%20View&state=CA&zipcode=&candidates=10 you would get a 400 response because our system doesn't know how to process a field called "stret."

401
A 401 response is most often caused by a domain mismatch. Make sure that the domain you're sending the request from matches exactly the host you have registered with us on your account. Go to the API Keys page on your account to manage your hosts and keys.

Add and manage hosts on your account

Remember that target.com is different than checkout.target.com as well as www.target.com. You can add multiple domains to each auth token by clicking the blue "add host" link for that token. Notice in the picture above that both target.com and checkout.target.com are linked to the same auth token.

402
If your subscription has expired, or if you've used up all the lookups on your account, you'll get a 402 response. Go to your account page to purchase more lookups, then try your request again.

500
Whoops! Something went wrong with the server. Submit your request again and it should go through just fine. (If it doesn't, give us a call and we'll figure it out for you.)