SDKs overview
US Autocomplete provides Software Development Kits (SDKs) and client libraries designed to facilitate integration with its address autocompletion and validation APIs. These SDKs abstract the underlying HTTP requests and response parsing, allowing developers to interact with the service using native language constructs. The primary goal of these tools is to reduce the boilerplate code required for API interactions, enabling quicker development cycles for applications requiring address data services.
The available SDKs support common programming languages, offering modules or packages that encapsulate the logic for sending address lookup requests and processing the structured address suggestions or validated addresses returned by the API. This approach aims to standardize the integration process across different development environments, ensuring consistent behavior and ease of maintenance. Developers can find detailed instructions and code examples for each supported language within the US Autocomplete developer documentation.
Official SDKs by language
US Autocomplete maintains official SDKs for several popular programming languages. These libraries are developed and supported by US Autocomplete to ensure compatibility with the latest API versions and features. Each SDK typically includes methods for performing address autocompletion, retrieving address details, and handling potential API errors.
The following table outlines the official SDKs, their corresponding package names, common installation commands, and their general maturity status as indicated by US Autocomplete's documentation:
| Language | Package Name | Installation Command | Maturity |
|---|---|---|---|
| JavaScript | @usautocomplete/js-sdk |
npm install @usautocomplete/js-sdk or yarn add @usautocomplete/js-sdk |
Stable |
| Python | usautocomplete-python |
pip install usautocomplete-python |
Stable |
| PHP | usautocomplete/php-sdk |
composer require usautocomplete/php-sdk |
Stable |
| Ruby | usautocomplete-ruby |
gem install usautocomplete-ruby |
Stable |
| C# | USAutocomplete.NET |
Install-Package USAutocomplete.NET (NuGet) |
Stable |
| Java | com.usautocomplete.java |
Maven: Add dependency; Gradle: Add dependency | Stable |
Each SDK provides specific client classes or functions to interact with the US Autocomplete RESTful API endpoints. For example, the JavaScript SDK might expose a client object with methods like autocompleteAddress(query) or validateAddress(addressId), simplifying asynchronous interactions. Developers are encouraged to consult the language-specific examples in the official US Autocomplete documentation for detailed usage patterns and object structures.
Installation
Installation of US Autocomplete SDKs generally follows the standard package management practices for each programming language. The process typically involves using a command-line tool to add the library as a dependency to your project. After installation, the SDK can be imported and initialized within your application code, usually requiring an API key for authentication.
JavaScript / Node.js
For JavaScript projects, particularly in Node.js environments or front-end applications built with module bundlers, npm or Yarn are the primary package managers:
npm install @usautocomplete/js-sdk
# or
yarn add @usautocomplete/js-sdk
Once installed, you can import the library and instantiate the client:
import { USAutocompleteClient } from '@usautocomplete/js-sdk';
const apiKey = 'YOUR_API_KEY';
const client = new USAutocompleteClient(apiKey);
// Example usage (see Quickstart for full example)
client.autocomplete('123 Main St').then(suggestions => {
console.log(suggestions);
});
Python
Python developers can install the SDK using pip, the Python package installer:
pip install usautocomplete-python
After installation, the library can be imported into your Python script:
from usautocomplete_python import USAutocompleteClient
api_key = 'YOUR_API_KEY'
client = USAutocompleteClient(api_key)
# Example usage (see Quickstart for full example)
suggestions = client.autocomplete('123 Main St')
print(suggestions)
PHP
PHP projects typically use Composer for dependency management:
composer require usautocomplete/php-sdk
Then, include Composer's autoloader and use the client:
<?php
require 'vendor/autoload.php';
use USAutocomplete\Client as USAutocompleteClient;
$apiKey = 'YOUR_API_KEY';
$client = new USAutocompleteClient($apiKey);
// Example usage (see Quickstart for full example)
$suggestions = $client->autocomplete('123 Main St');
print_r($suggestions);
?>
Ruby
Ruby developers install gems using the gem command:
gem install usautocomplete-ruby
Then require the library in your Ruby application:
require 'usautocomplete-ruby'
api_key = 'YOUR_API_KEY'
client = USAutocomplete::Client.new(api_key)
# Example usage (see Quickstart for full example)
suggestions = client.autocomplete('123 Main St')
puts suggestions
C# / .NET
For C# and .NET applications, the NuGet package manager is used:
Install-Package USAutocomplete.NET
In your C# code, you can then instantiate the client:
using USAutocomplete.NET;
string apiKey = "YOUR_API_KEY";
var client = new USAutocompleteClient(apiKey);
// Example usage (see Quickstart for full example)
var suggestions = await client.AutocompleteAsync("123 Main St");
Console.WriteLine(suggestions);
Java
Java projects typically use Maven or Gradle for dependency management. For Maven, add the following to your pom.xml:
<dependency>
<groupId>com.usautocomplete.java</groupId>
<artifactId>usautocomplete-java-sdk</artifactId>
<version>1.0.0</version> <!-- Check for the latest version -->
</dependency>
Then, in your Java code:
import com.usautocomplete.java.USAutocompleteClient;
import com.usautocomplete.java.models.AutocompleteResult;
public class AutocompleteExample {
public static void main(String[] args) {
String apiKey = "YOUR_API_KEY";
USAutocompleteClient client = new USAutocompleteClient(apiKey);
try {
AutocompleteResult result = client.autocomplete("123 Main St");
System.out.println(result.getSuggestions());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Always refer to the US Autocomplete documentation for specific language setup and the latest version information.
Quickstart example
This section provides a basic quickstart example using the Python SDK to demonstrate how to perform an address autocompletion lookup. The example assumes you have installed the usautocomplete-python package and have a valid API key.
Goal: Autocomplete an address query and print the top suggestions.
Python Quickstart
import os
from usautocomplete_python import USAutocompleteClient
from usautocomplete_python.exceptions import USAutocompleteAPIError
# It's recommended to load your API key from environment variables
# For demonstration, you can replace 'YOUR_API_KEY' directly
api_key = os.environ.get('US_AUTOCOMPLETE_API_KEY', 'YOUR_API_KEY')
if api_key == 'YOUR_API_KEY':
print("Warning: Replace 'YOUR_API_KEY' with your actual API key or set the US_AUTOCOMPLETE_API_KEY environment variable.")
exit()
client = USAutocompleteClient(api_key)
def get_address_suggestions(query):
"""
Fetches address suggestions for a given query string.
"""
try:
print(f"Searching for suggestions for: '{query}'")
suggestions = client.autocomplete(query)
if suggestions:
print("--- Suggestions ---")
for i, suggestion in enumerate(suggestions):
# Each suggestion typically has 'text' and 'id' fields
print(f"{i + 1}. {suggestion.get('text', 'N/A')} (ID: {suggestion.get('id', 'N/A')})")
print("-------------------")
else:
print("No suggestions found.")
except USAutocompleteAPIError as e:
print(f"API Error: {e.status_code} - {e.message}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
# Example 1: Common street address
get_address_suggestions("1600 Amphitheatre Pkwy")
# Example 2: Partial address
get_address_suggestions("123 Main")
# Example 3: Address with city and state
get_address_suggestions("200 S Biscayne Blvd, Miami, FL")
# Example 4: A query that might yield no results
# get_address_suggestions("xyz123invalidaddress")
This Python quickstart demonstrates initializing the client with an API key, making an asynchronous autocomplete call, and iterating through the returned suggestions. Error handling is included to catch potential API-specific issues or general exceptions. For production environments, it is best practice to store API keys securely, such as in environment variables, rather than hardcoding them directly into the source code, as recommended by security guidelines for API key management, which you can read about in the Google Cloud API keys documentation.
Community libraries
While US Autocomplete provides official SDKs, the developer community may also contribute third-party libraries or wrappers. These community-driven projects can sometimes offer alternative approaches, integrations with specific frameworks, or support for languages not officially covered. However, it is important to note that community libraries are not officially maintained or supported by US Autocomplete.
When considering a community library, developers should evaluate its:
- Maintenance Status: Check the project's activity, last commit dates, and open issues to gauge ongoing support.
- Documentation: Assess the clarity and completeness of usage instructions.
- Code Quality: Review the codebase for best practices, test coverage, and potential security vulnerabilities.
- Compatibility: Verify that the library is compatible with the latest US Autocomplete API versions and your project's dependencies.
- License: Understand the licensing terms to ensure it aligns with your project's requirements.
As of 2026, the official documentation does not explicitly list widely recognized community-contributed libraries. Developers looking for such resources might explore public code repositories like GitHub or specialized package indexes for their language (e.g., PyPI for Python, RubyGems for Ruby) using search terms like "US Autocomplete client" or "US Autocomplete wrapper." Any community library should be thoroughly vetted before integration into a production system due to the lack of direct vendor support and potential for unpatched vulnerabilities or outdated API interactions. The official US Autocomplete SDKs, detailed in the official US Autocomplete documentation, are the recommended starting point for most integrations.