addressverify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AETHER TECHNOLOGY LLC (AddressVerify)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # AddressVerify JavaScript / TypeScript SDK
2
+
3
+ Official SDK for the [AddressVerify](https://addressverify.io) API: validate U.S. residential
4
+ addresses, classify home types, and get estimated property values in real time.
5
+
6
+ [![npm](https://img.shields.io/npm/v/addressverify.svg)](https://www.npmjs.com/package/addressverify)
7
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
8
+
9
+ - 🏠 **Address validation**: confirm an address is a real, deliverable U.S. residence
10
+ - 🏷️ **Home-type classification**: `SINGLE_FAMILY`, `MULTI_FAMILY`, `APARTMENT`, `CONDO`, `TOWNHOUSE`, `MANUFACTURED`, `LOT`
11
+ - 💰 **Property values**: estimated home value, plus optional expanded property data
12
+ - 📦 **Zero runtime dependencies**: uses native `fetch` (Node 18+)
13
+ - 🟦 **Fully typed**: first-class TypeScript types
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install addressverify
19
+ ```
20
+
21
+ ## Get an API key
22
+
23
+ Create a free account at **[app.addressverify.io](https://app.addressverify.io/user/register)** and copy your API key from the dashboard. The free tier includes 50 free API calls to get started.
24
+
25
+ ## Quick start
26
+
27
+ ```ts
28
+ import { AddressVerify } from "addressverify";
29
+
30
+ const av = new AddressVerify({ apiKey: process.env.ADDRESSVERIFY_API_KEY! });
31
+
32
+ // Single-line address
33
+ const result = await av.verify("123 Main St, New York, NY 10001");
34
+
35
+ console.log(result.addressValid); // true
36
+ console.log(result.homeType); // "SINGLE_FAMILY"
37
+ console.log(result.homeValue); // 273900
38
+ ```
39
+
40
+ ### Multi-line address
41
+
42
+ ```ts
43
+ const result = await av.verify({
44
+ street: "20 Marie St",
45
+ city: "Iberia",
46
+ state: "MO",
47
+ zip: "65486",
48
+ });
49
+ ```
50
+
51
+ ### Expanded property data
52
+
53
+ Pass `{ expanded: true }` to receive parsed address components, property details, tax
54
+ assessment, and listing data (available on all plans at no extra cost):
55
+
56
+ ```ts
57
+ const result = await av.verify("20 Marie St, Iberia, MO 65486", { expanded: true });
58
+
59
+ console.log(result.propertyInfo?.bedrooms); // 4
60
+ console.log(result.taxAssessment?.taxAssessedValue); // 150210
61
+ console.log(result.listing?.listingStatus); // "recentlySold"
62
+ ```
63
+
64
+ ## Response shape
65
+
66
+ ```jsonc
67
+ {
68
+ "address": "20 Marie St, Iberia, MO 65486",
69
+ "addressValid": true,
70
+ "homeType": "SINGLE_FAMILY",
71
+ "homeValue": 371000,
72
+
73
+ // present only with { expanded: true }
74
+ "addressInfo": { "streetAddress": "20 Marie St", "zipcode": "65486", "city": "Iberia", "state": "MO" },
75
+ "propertyInfo": { "bathrooms": 2, "bedrooms": 4, "livingArea": 2072, "yearBuilt": 2001, "lotSize": "1.84 acres" },
76
+ "taxAssessment": { "taxAssessedValue": 150210, "taxAssessmentYear": "2024" },
77
+ "listing": { "lastSoldDate": "2025-05-22", "isPreforeclosureAuction": false, "listingStatus": "recentlySold" }
78
+ }
79
+ ```
80
+
81
+ ## Error handling
82
+
83
+ Non-2xx responses throw an `AddressVerifyError` with the HTTP `status` and parsed `body`:
84
+
85
+ ```ts
86
+ import { AddressVerify, AddressVerifyError } from "addressverify";
87
+
88
+ try {
89
+ await av.verify("not a real address");
90
+ } catch (err) {
91
+ if (err instanceof AddressVerifyError) {
92
+ console.error(err.status); // e.g. 422
93
+ console.error(err.body); // API error payload
94
+ }
95
+ }
96
+ ```
97
+
98
+ | Status | Meaning |
99
+ | ------ | ------- |
100
+ | `400` | Bad Request: invalid or missing parameters |
101
+ | `401` | Unauthorized: invalid API key |
102
+ | `422` | Invalid address (e.g. missing street number) |
103
+ | `429` | Too Many Requests: rate limit exceeded |
104
+
105
+ ## Configuration
106
+
107
+ ```ts
108
+ new AddressVerify({
109
+ apiKey: "...", // required
110
+ baseUrl: "https://api.addressverify.io" // optional override
111
+ });
112
+ ```
113
+
114
+ `verify()` also accepts an `AbortSignal` for cancellation/timeouts:
115
+
116
+ ```ts
117
+ await av.verify("123 Main St, New York, NY 10001", {
118
+ signal: AbortSignal.timeout(5000),
119
+ });
120
+ ```
121
+
122
+ ## Roadmap
123
+
124
+ - **Home Verify** (homeowner + person & property lookup, `…/isHomeOwner/homeOwner`): coming to the SDK. Already available on the [REST API](https://addressverify.io/docs).
125
+
126
+ ## Links
127
+
128
+ - 🌐 Website: <https://addressverify.io>
129
+ - 📚 API docs: <https://addressverify.io/docs>
130
+ - 🔑 Get an API key: <https://app.addressverify.io/user/register>
131
+
132
+ ## License
133
+
134
+ MIT © AddressVerify
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Official TypeScript/JavaScript SDK for the AddressVerify API.
3
+ *
4
+ * AddressVerify validates U.S. residential addresses, classifies home types,
5
+ * and returns estimated property values — with optional expanded property data.
6
+ *
7
+ * @see https://addressverify.io
8
+ * @see https://addressverify.io/docs
9
+ */
10
+ /** Known home-type classifications. Unknown future values fall back to `string`. */
11
+ export type HomeType = "SINGLE_FAMILY" | "MULTI_FAMILY" | "APARTMENT" | "CONDO" | "TOWNHOUSE" | "MANUFACTURED" | "LOT" | (string & {});
12
+ /** Parsed address components (present only with `expanded: true`). */
13
+ export interface AddressInfo {
14
+ streetAddress: string;
15
+ zipcode: string;
16
+ city: string;
17
+ state: string;
18
+ }
19
+ /** Physical property details (present only with `expanded: true`). */
20
+ export interface PropertyInfo {
21
+ bathrooms: number;
22
+ bedrooms: number;
23
+ livingArea: number;
24
+ yearBuilt: number;
25
+ /** Lot size with unit, e.g. "5001 sqft" or "1.84 acres". */
26
+ lotSize: string;
27
+ }
28
+ /** Tax assessment data (present only with `expanded: true`). */
29
+ export interface TaxAssessment {
30
+ taxAssessedValue: number;
31
+ taxAssessmentYear: string;
32
+ }
33
+ /** Listing/market data (present only with `expanded: true`). */
34
+ export interface Listing {
35
+ /** Date the property was last sold (YYYY-MM-DD). */
36
+ lastSoldDate: string;
37
+ isPreforeclosureAuction: boolean;
38
+ /** e.g. "forSale", "recentlySold", "offMarket". */
39
+ listingStatus: string;
40
+ }
41
+ /** Response from {@link AddressVerify.verify}. Expanded fields appear only with `expanded: true`. */
42
+ export interface VerifyResult {
43
+ address: string;
44
+ addressValid: boolean;
45
+ homeType: HomeType;
46
+ homeValue: number;
47
+ addressInfo?: AddressInfo;
48
+ propertyInfo?: PropertyInfo;
49
+ taxAssessment?: TaxAssessment;
50
+ listing?: Listing;
51
+ }
52
+ /** A full address on one line, e.g. "123 Main St, New York, NY 10001". */
53
+ export type SingleLineInput = string | {
54
+ address: string;
55
+ };
56
+ /** A split address. */
57
+ export interface MultiLineInput {
58
+ street: string;
59
+ city: string;
60
+ state: string;
61
+ zip: string;
62
+ }
63
+ export type VerifyInput = SingleLineInput | MultiLineInput;
64
+ export interface AddressVerifyOptions {
65
+ /** Your API key (sent as the `x-api-key` header). Get one at https://app.addressverify.io/user/register */
66
+ apiKey: string;
67
+ /** Override the API base URL. Defaults to https://api.addressverify.io */
68
+ baseUrl?: string;
69
+ /** Custom fetch implementation (defaults to the global `fetch`). */
70
+ fetch?: typeof fetch;
71
+ }
72
+ export interface VerifyRequestOptions {
73
+ /** Return expanded property data (addressInfo, propertyInfo, taxAssessment, listing). */
74
+ expanded?: boolean;
75
+ /** Abort signal for cancellation/timeouts. */
76
+ signal?: AbortSignal;
77
+ }
78
+ /** Thrown when the API responds with a non-2xx status. */
79
+ export declare class AddressVerifyError extends Error {
80
+ /** HTTP status code (e.g. 400, 401, 422, 429). */
81
+ readonly status: number;
82
+ /** Parsed response body (JSON object when available, otherwise raw text). */
83
+ readonly body: unknown;
84
+ constructor(message: string, status: number, body: unknown);
85
+ }
86
+ /**
87
+ * Client for the AddressVerify API.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * import { AddressVerify } from "addressverify";
92
+ *
93
+ * const av = new AddressVerify({ apiKey: process.env.ADDRESSVERIFY_API_KEY! });
94
+ *
95
+ * // Single-line
96
+ * const r = await av.verify("123 Main St, New York, NY 10001");
97
+ * console.log(r.addressValid, r.homeType, r.homeValue);
98
+ *
99
+ * // Multi-line + expanded property data
100
+ * const full = await av.verify(
101
+ * { street: "20 Marie St", city: "Iberia", state: "MO", zip: "65486" },
102
+ * { expanded: true },
103
+ * );
104
+ * console.log(full.propertyInfo?.bedrooms);
105
+ * ```
106
+ */
107
+ export declare class AddressVerify {
108
+ private readonly apiKey;
109
+ private readonly baseUrl;
110
+ private readonly fetchImpl;
111
+ constructor(options: AddressVerifyOptions);
112
+ /**
113
+ * Verify an address.
114
+ *
115
+ * @param input Single-line string, `{ address }`, or `{ street, city, state, zip }`.
116
+ * @param options `{ expanded }` to request detailed property data.
117
+ * @throws {AddressVerifyError} on a non-2xx response.
118
+ */
119
+ verify(input: VerifyInput, options?: VerifyRequestOptions): Promise<VerifyResult>;
120
+ }
121
+ export default AddressVerify;
package/dist/index.js ADDED
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * Official TypeScript/JavaScript SDK for the AddressVerify API.
4
+ *
5
+ * AddressVerify validates U.S. residential addresses, classifies home types,
6
+ * and returns estimated property values — with optional expanded property data.
7
+ *
8
+ * @see https://addressverify.io
9
+ * @see https://addressverify.io/docs
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AddressVerify = exports.AddressVerifyError = void 0;
13
+ const DEFAULT_BASE_URL = "https://api.addressverify.io";
14
+ const VERIFY_PATH = "/service/lookup/address";
15
+ /** Thrown when the API responds with a non-2xx status. */
16
+ class AddressVerifyError extends Error {
17
+ constructor(message, status, body) {
18
+ super(message);
19
+ this.name = "AddressVerifyError";
20
+ this.status = status;
21
+ this.body = body;
22
+ Object.setPrototypeOf(this, AddressVerifyError.prototype);
23
+ }
24
+ }
25
+ exports.AddressVerifyError = AddressVerifyError;
26
+ function isMultiLine(input) {
27
+ return typeof input === "object" && "street" in input;
28
+ }
29
+ /**
30
+ * Client for the AddressVerify API.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { AddressVerify } from "addressverify";
35
+ *
36
+ * const av = new AddressVerify({ apiKey: process.env.ADDRESSVERIFY_API_KEY! });
37
+ *
38
+ * // Single-line
39
+ * const r = await av.verify("123 Main St, New York, NY 10001");
40
+ * console.log(r.addressValid, r.homeType, r.homeValue);
41
+ *
42
+ * // Multi-line + expanded property data
43
+ * const full = await av.verify(
44
+ * { street: "20 Marie St", city: "Iberia", state: "MO", zip: "65486" },
45
+ * { expanded: true },
46
+ * );
47
+ * console.log(full.propertyInfo?.bedrooms);
48
+ * ```
49
+ */
50
+ class AddressVerify {
51
+ constructor(options) {
52
+ if (!options || !options.apiKey) {
53
+ throw new Error("AddressVerify: `apiKey` is required.");
54
+ }
55
+ this.apiKey = options.apiKey;
56
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
57
+ const fetchImpl = options.fetch ?? globalThis.fetch;
58
+ if (typeof fetchImpl !== "function") {
59
+ throw new Error("AddressVerify: global `fetch` is unavailable. Use Node 18+ or pass a `fetch` implementation.");
60
+ }
61
+ this.fetchImpl = fetchImpl;
62
+ }
63
+ /**
64
+ * Verify an address.
65
+ *
66
+ * @param input Single-line string, `{ address }`, or `{ street, city, state, zip }`.
67
+ * @param options `{ expanded }` to request detailed property data.
68
+ * @throws {AddressVerifyError} on a non-2xx response.
69
+ */
70
+ async verify(input, options = {}) {
71
+ const body = typeof input === "string"
72
+ ? { address: input }
73
+ : isMultiLine(input)
74
+ ? { street: input.street, city: input.city, state: input.state, zip: input.zip }
75
+ : { address: input.address };
76
+ const url = `${this.baseUrl}${VERIFY_PATH}${options.expanded ? "?expanded=true" : ""}`;
77
+ const response = await this.fetchImpl(url, {
78
+ method: "POST",
79
+ headers: {
80
+ "x-api-key": this.apiKey,
81
+ "Content-Type": "application/json",
82
+ },
83
+ body: JSON.stringify(body),
84
+ signal: options.signal,
85
+ });
86
+ const raw = await response.text();
87
+ let data = null;
88
+ if (raw) {
89
+ try {
90
+ data = JSON.parse(raw);
91
+ }
92
+ catch {
93
+ data = raw;
94
+ }
95
+ }
96
+ if (!response.ok) {
97
+ const detail = data && typeof data === "object" && "message" in data
98
+ ? String(data.message)
99
+ : response.statusText;
100
+ throw new AddressVerifyError(`AddressVerify request failed (${response.status} ${detail})`, response.status, data);
101
+ }
102
+ return data;
103
+ }
104
+ }
105
+ exports.AddressVerify = AddressVerify;
106
+ exports.default = AddressVerify;
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "addressverify",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript/JavaScript SDK for the AddressVerify API: validate residential addresses, classify home types, and get property values.",
5
+ "keywords": [
6
+ "addressverify",
7
+ "address verification",
8
+ "address validation",
9
+ "usps",
10
+ "property data",
11
+ "home value",
12
+ "real estate api",
13
+ "api",
14
+ "sdk"
15
+ ],
16
+ "homepage": "https://addressverify.io",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/AddressVerify-io/addressverify-js.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/AddressVerify-io/addressverify-js/issues"
23
+ },
24
+ "license": "MIT",
25
+ "author": "AddressVerify (https://addressverify.io)",
26
+ "type": "commonjs",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "files": [
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^5.6.0"
43
+ }
44
+ }