Create Token

Overview

The CreateToken endpoint is used to exchange your API key for a short-lived access token. We recommend you create them on your server to grant access to API features without exposing your API key. All tokens have a limited lifetime. 

Best practice is to generate an Access Token on page load to be used for that address search session only.

Please read API Overview first.

API Endpoint

The CreateToken API endpoint won't change. It can be set as a constant.

https://api.autoaddress.com/3.0/createtoken

Request

To create a Token, a simple  GET request from your desired language is all that is needed.

  1. The createtoken endpoint requires Basic authentication. 
  2. The username is your API key such as  pub_xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx. The password is left blank.
  3. This results in an Authorization header that looks like: Authorization: Basic <credentials> where <credentials> is pub_xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx: Base64 encoded

The following is an example cURL CreateToken call

curl 'https://api.autoaddress.com/3.0/createtoken' \ --header 'Authorization: Basic cHViXzE5YjlmNzRmLTAxNDAtNGM5OC04ZWU4LWM0ZjBlYzE0Y2MyNzo='

Response

The following is a sample JSON response returned for a Create Token API request:

{    
    "token": "fvBby7sc9D+oGwJKa6f83sMca6oNynj2ehtH5P/mQpHfFpqemQ+Ge17P1lVmboVXz0/HGwS7KYDWvXn+qZJ1Ww==",    
    "type": "Token Create",    
    "transactionId": "08ef0f04-7603-4fae-aa8e-193aeb867032" 
}

Output Fields

NameTypeDescription
tokenstringAccess token that can be used to access data endpoints
typestringType of the response object
transactionIdstringUnique UUID identifying the request

Examples

jQuery

var settings = {
  "url": "https://api.autoaddress.com/3.0/createtoken",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Basic cHViXzAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA="
  },
};


$.ajax(settings).done(function (response) {
  console.log(response);
});

Ruby

require "uri" require "net/http" 

url = URI("https://api.autoaddress.com/3.0/createtoken") 

https = Net::HTTP.new(url.host, url.port) https.use_ssl = true 

request = Net::HTTP::Get.new(url) request["Authorization"] = "Basic cHViXzAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA=" 

response = https.request(request) puts response.read_body<br>

Python

import requests

url = "https://api.autoaddress.com/3.0/createtoken"

payload={}
headers = {
  'Authorization': 'Basic cHViXzAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA='
}

response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)

C#

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.autoaddress.com/3.0/createtoken");
request.Headers.Add("Authorization", "Basic cHViXzAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA=");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());