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
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.
- The createtoken endpoint requires Basic authentication.
- The username is your API key such as
pub_xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
. The password is left blank. - This results in an Authorization header that looks like: Authorization: Basic <Base64 encoded API Key:>
The following is an example cURL CreateToken call
curl 'https://api.autoaddress.com/3.0/createtoken' \ --header 'Authorization: Basic cHViXzE5YjlmNpRmLTAxNDAtNGM5OC04ZWU4LXM0ZjBlYzE0Y2MoNzo='
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
Name | Type | Description |
---|---|---|
token | string | Access token that can be used to access data endpoints |
type | string | Type of the response object |
transactionId | string | Unique UUID identifying the request |
Examples
jQuery
var settings = { "url": "https://api.autoaddress.com/3.0/createtoken", "method": "GET", "timeout": 0, "headers": { "Authorization": "Basic cHViXzE5YjlmNpRmLTAxNDAtNGM5OC04ZWU4LXM0ZjBlYzE0Y2MoNzo="
}, }; $.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 cHViXzE5YjlmNpRmLTAxNDAtNGM5OC04ZWU4LXM0ZjBlYzE0Y2MoNzo="
request["User-Agent"] = "Ruby application"
response = https.request(request) puts response.read_body
Python
import requests url = "https://api.autoaddress.com/3.0/createtoken" payload={} headers = { 'Authorization': 'Basic cHViXzE5YjlmNpRmLTAxNDAtNGM5OC04ZWU4LXM0ZjBlYzE0Y2MoNzo=',
'User-Agent': 'Python application'
} 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 cHViXzE5YjlmNpRmLTAxNDAtNGM5OC04ZWU4LXM0ZjBlYzE0Y2MoNzo=");
request.Headers.Add("User-Agent", ".NET application");var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());