-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinternational-street-api.yaml
540 lines (514 loc) · 26 KB
/
international-street-api.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
openapi: 3.1.0
info:
title: International Address Verification API
version: '3.3'
description: ''
termsOfService: 'https://smartystreets.com/legal/terms-of-service'
license:
url: 'https://www.smarty.com/legal/terms-of-service'
name: Smarty License
contact:
url: 'https://www.smarty.com/contact/support'
email: [email protected]
name: Smarty Support
servers:
- url: 'https://international-street.api.smarty.com'
externalDocs:
description: Extensive documentation for the International Address API
url: 'https://www.smarty.com/docs/cloud/international-street-api'
paths:
/verify:
get:
summary: Submit Address to Verify
tags: []
security:
- auth-id: []
auth-token: []
- embedded-key: []
responses:
'200':
$ref: '#/components/responses/200'
'400':
$ref: '#/components/responses/400'
'401':
$ref: '#/components/responses/401'
'402':
$ref: '#/components/responses/402'
'403':
$ref: '#/components/responses/403'
'422':
$ref: '#/components/responses/422'
'429':
$ref: '#/components/responses/429'
'504':
$ref: '#/components/responses/504'
operationId: get-verify
description: "To send one (and only one) address to our API, simply encode the input field names from the table below along with the corresponding input values as query string parameters in the URL of your request. Here's an example that uses the address1, address2, locality, administrative_area, postal_code, and country fields:\n\ncurl -v 'https://international-street.api.smarty.com/verify?\n\tauth-id=YOUR+AUTH-ID+HERE&\n\tauth-token=YOUR+AUTH-TOKEN+HERE&\n\n\taddress1=Rua+Padre+Antonio+D%27Angelo+121&\n\taddress2=Casa+Verde&\n\tlocality=Sao+Paulo&\n\tadministrative_area=SP&\n\tpostal_code=02516-040&\n\tcountry=Brazil'\n\t\nPlease note that all query string parameter values must be url-encoded (spaces become + or %20, for example) to ensure that the data is transferred correctly. A common mistake we see is a non-encoded pound sign (#) like in an apartment number (# 409). This character, when properly encoded in a URL, becomes %23. When not encoded this character functions as the fragment identifier, which is ignored by our API servers.\n\n"
parameters:
- $ref: '#/components/parameters/Host'
- $ref: '#/components/parameters/input_id'
- $ref: '#/components/parameters/country'
- $ref: '#/components/parameters/geocode'
- $ref: '#/components/parameters/language'
- $ref: '#/components/parameters/freeform'
- $ref: '#/components/parameters/address1'
- $ref: '#/components/parameters/address2'
- $ref: '#/components/parameters/address3'
- $ref: '#/components/parameters/address4'
- $ref: '#/components/parameters/organization'
- $ref: '#/components/parameters/locality'
- $ref: '#/components/parameters/administrative_area'
- $ref: '#/components/parameters/postal_code'
- $ref: '#/components/parameters/license'
components:
schemas:
Root:
title: Root
type: object
properties:
input_id:
type: string
description: A unique identifier generated by you for this address for use within your application. The output will be identical to the value you provided in the request input_id.
maxLength: 16
organization:
type: string
description: 'The name of the recipient, firm, or company at this address. The output will be identical to the input.'
maxLength: 256
address1-12:
type: string
maxLength: 256
description: |-
If address_precision = DeliveryPoint or Premise, these fields will contain the correctly formatted address for mailing in the relevant country, split into individual address lines. (Note: These fields may contain values that are not referenced in the address components.)
If address_precision ≠ DeliveryPoint or Premise, the address fields may contain standardized address information or even the original input data.
components:
$ref: '#/components/schemas/Components'
description: ' Contains the various basic elements of the address.'
metadata:
$ref: '#/components/schemas/Metadata'
description: Contains ancillary data about each address.
analysis:
$ref: '#/components/schemas/Analysis'
description: Contains information about the validation and the precision of the output address.
Components:
title: Components
type: object
properties:
country_iso_3:
type: string
description: 'The ISO 3166-1 alpha-3 country code. See https://www.smarty.com/docs/cloud/international-street-api#countries for details.'
administrative_area:
type: string
description: |-
The most common administrative division within a country
(e.g., province in Canada)
super_administrative_area:
type: string
description: |-
The largest administrative division within a country
(e.g., region in France)
sub_administrative_area:
type: string
description: |-
The smallest administrative division within a country
(e.g., county in Germany)
locality:
type: string
description: |-
Within a country, this is the most common population center.
(e.g., city in Chile)
dependent_locality:
type: string
description: |-
If there is additional information about the locality, it will be here.
(e.g., neighborhood in Turkey)
dependent_locality_name:
type: string
description: |-
If the dependent_locality has a name, you'll find it here.
(E.g., the dependent_locality "Dong Cheng Qu" is named "Dong Cheng.")
double_dependent_locality:
type: string
description: |-
If there is additional information about the dependent_locality, you'll find it here.
(e.g., village in the United Kingdom)
postal_code:
type: string
description: |-
The complete postal code for the delivery point
(e.g., V6G1V9 in Canada)
postal_code_short:
type: string
description: |-
Primary postal code information
(e.g., 90210 in the United States)
postal_code_extra:
type: string
description: |-
Secondary postal code information
(e.g., 3425 in the United States)
premise:
type: string
description: Alphanumeric code pertaining to an individual location
premise_extra:
type: string
description: |-
Extra information about the premise that is not necessarily authoritative but might still be useful
(E.g., in a French address, 25 bis rue Emile Zola, 91190 Gif Sur Yvette, France, the premise number could be followed by the word "bis" which would be considered premise_extra data.)
premise_number:
type: string
description: |-
The alphanumeric component of the premise field
(E.g., if premise contains "Plot 7/7A" premise_number would contain "7/7A.")
premise_type:
type: string
description: |-
The premise type component of the premise field
(E.g., if premise contains "Plot 7/7A" premise_type would contain "Plot.")
thoroughfare:
type: string
description: All thoroughfare components combined
thoroughfare_predirection:
type: string
description: |-
The directional prefix component of the thoroughfare
(E.g., if thoroughfare contains "N Main St" thoroughfare_predirection would contain "N."
thoroughfare_postdirection:
type: string
description: |-
The directional suffix component of the thoroughfare
(E.g., if thoroughfare contains "Main St N" thoroughfare_postdirection would contain "N.")
thoroughfare_name:
type: string
description: |-
The name component of the thoroughfare
(E.g., if thoroughfare contains "Main St" thoroughfare_name would contain "Main.")
thoroughfare_trailing_type:
type: string
description: |-
The trailing thoroughfare type component of the thoroughfare
(E.g., if thoroughfare contains "N Main St" thoroughfare_trailing_type would contain "St.")
thoroughfare_type:
type: string
description: |-
The leading thoroughfare type component of the thoroughfare
(E.g., if thoroughfare contains "Rue De La Gare" thoroughfare_leading_type would contain "Rue.")
dependent_thoroughfare:
type: string
description: All of the dependent thoroughfare components combined
dependent_thoroughfare_predirection:
type: string
description: |-
The directional prefix component of the dependent_thoroughfare
(E.g., if dependent_thoroughfare contains "N Main St" dependent_thoroughfare_predirection would contain "N.")
dependent_thoroughfare_postdirection:
type: string
description: |-
The directional suffix component of the dependent_thoroughfare
(E.g., if dependent_thoroughfare contains "Main St N" dependent_thoroughfare_postdirection would contain "N.")
dependent_thoroughfare_name:
type: string
description: |-
The name component of the dependent_thoroughfare
(E.g., if dependent_thoroughfare contains "N Main St" dependent_thoroughfare_name would contain "Main.")
dependent_thoroughfare_trailing_type:
type: string
description: |-
The trailing dependent_thoroughfare type component of the dependent_thoroughfare
(E.g., if dependent_thoroughfare contains "N Main St" dependent_thoroughfare_trailing_type would contain "St.")
dependent_thoroughfare_type:
type: string
description: |-
The leading thoroughfare type component of the dependent_thoroughfare field
(E.g., if dependent_thoroughfare contains "Rue De La Gare" dependent_thoroughfare_type would contain "Rue.")
building:
type: string
description: 'The descriptive name that identifies an individual location, if one exists'
building_leading_type:
type: string
description: |-
The leading building type component of the building
(E.g., if building contains "Bloc C" building_leading_type would contain "Bloc.")
building_name:
type: string
description: |-
The name component of the building
(E.g., if building contains "Westminster House" building_name would contain "Westminster.")
building_trailing_type:
type: string
description: |-
The trailing building type component of the building
(E.g., if building contains "Westminster House" building_trailing_type would contain "House.")
sub_building:
type: string
description: All sub_building components combined
sub_building_type:
type: string
description: |-
The leading sub-building type of the sub_building
(E.g., if sub_building contains "Flat 1" sub_building_type would contain "Flat.")
sub_building_number:
type: string
description: |-
The alphanumeric component of the sub_building
(E.g., if sub_building contains "Flat 1" sub_building_number would contain "1.")
sub_building_name:
type: string
description: |-
The descriptive name component of the sub_building
(E.g., if sub_building contains "Basement Flat" sub_building_name would contain "Basement.")
post_box:
type: string
description: All post_box Post Office Box components combined
post_box_type:
type: string
description: |-
The type component of the post_box
(E.g., if post_box contains "PO Box 1234" post_box_type would contain "PO Box.")
post_box_number:
type: string
description: |-
The alphanumeric component of the postbox
(E.g., if post_box contains "PO Box 1234" post_box_number would contain "1234.")
Metadata:
title: Metadata
type: object
properties:
latitude:
type: number
description: 'The horizontal component used for geographic positioning; it is the angle between 0° (the equator) and ±90° (north or south) at the poles measured in decimal degrees. It is the first value in an ordered pair of latitude, longitude. A negative number denotes a location south of the equator; a positive number is north. Combining lat/long values enables you to pinpoint addresses on a map.'
longitude:
type: number
description: 'The vertical component used for geographic positioning; it is the angle between 0° (the Prime Meridian) and ±180° (westward or eastward) measured in decimal degrees. It is the second number in an ordered pair of (latitude, longitude). A negative number indicates a location west of Greenwich, England; a positive number east. Combining lat/long values enables you to pinpoint addresses on a map.'
geocode_precision:
type: string
description: |-
Indicates the precision level of the latitude and longitude values.
None — Geocode not known (possibly because address is invalid).
AdministrativeArea — Geocode is accurate down to the administrative area (i.e., region or province).
Locality — Geocode is accurate down to the locality (i.e., city).
Thoroughfare — Geocode is accurate down to the thoroughfare (i.e., street).
Premise — Geocode is accurate down to a range of addresses on the specified street (i.e., building, block level or street segment).
DeliveryPoint — Geocode is accurate to the actual delivery point (i.e., house, mailbox or apartment).
max_geocode_precision:
type: string
description: Indicates the best geocode_precision available for the input country.
address_format:
type: string
description: |-
A template that shows where we positioned the different address components on line 1, line 2, etc. (The format changes from one country to another.)
Due to the ever-changing nature of the underlying data, this field may contain values that are not referenced in the address components.
Example:
building | premise thoroughfare | postal_code locality
Each "pipe" character (|) represents a line break. Following this guide, the numbered address fields would be composed accordingly:
Address 1: building
Address 2: premise thoroughfare
Address 3: postal_code locality
For native languages that do not use spaces between words, the corresponding component fields will also not have spaces between them.
The address_format field will not be present for US addresses. Here's some additional info on the composition of US addresses.
Analysis:
title: Analysis
type: object
properties:
verification_status:
type: string
description: |-
Indicates the verification status of the address. (See address_precision for more details)
None — Not verified. The output fields will contain the input data.
Partial — Verification only at the level indicated by address_precision. (Better input might result in a better match.)
Ambiguous — Multiple matching addresses found. Each candidate address will have its own precision level. A common "ambiguous" scenario is that the output will contain two versions of the same address — one with an organization name and one without.
Verified — The address was verified, at the indicated precision level.
address_precision:
type: string
description: |-
Indicates the precision level at which an address match is found.
None — None of the address is verified.
AdministrativeArea — Address match is verified to the administrative area (i.e., region or province).
Locality — Address match is verified to the locality (i.e., city).
Thoroughfare — Address match is verified down to the thoroughfare (i.e., street).
Premise — Address match is verified to a range of addresses on the specified street (i.e., building, block level or street segment).
DeliveryPoint — Address match is verified to the delivery point (i.e., building, sub-building, or mailbox)
max_address_precision:
type: string
description: Indicates the best address_precision available for the input country.
changes:
$ref: '#/components/schemas/Changes'
description: 'Contains a collection of address components paired with values which specify the difference between corresponding input/lookup and output/candidate data. See the explanation of possible Changes here: https://www.smarty.com/docs/cloud/international-street-api#changes'
organization:
type: string
description: 'If present, the degree of change to the name of the recipient, firm, or company at this address.'
address1-12:
type: string
description: 'If present, these fields show the degree of change to each of the address lines.'
components:
$ref: '#/components/schemas/Components'
Changes:
title: Changes
type: object
description: |-
Each value in this object (and any subordinate objects) will have a type of varchar(64) and will either be blank or contain one of the following values:
Verified-NoChange
Field has been verified using relevant reference data; no changes were needed.
Verified-AliasChange
Field has been verified using relevant reference data; an alias change was made during parsing (see Identified-AliasChange).
Verified-SmallChange
Field has been verified using relevant reference data; a small spelling change was made.
Verified-LargeChange
Field has been verified using relevant reference data; a large spelling change was made.
Added
Field has been added using relevant reference data.
Identified-NoChange
Field has been identified using relevant lexicon data; no changes were needed. E.g., an input value of 'PO Box 1234' may be identifiable as a postbox, but if it is unable to be verified then this value will be returned.
Identified-AliasChange
Field has been identified using relevant lexicon data; an alias change was made. E.g., an input value of 'Avnue' may be identifiable as an alias to the thoroughfare_type 'Ave'.
Identified-ContextChange
Field has been identified using relevant context rules. E.g., an input address of '123 sdovnsdv San Bruno CA USA' may identify the word 'sdovnsdv' as a thoroughfare, but only because of the context in which it appears (after an identifiable premise_number, and before an identifiable locality).
Unrecognized
Field was unrecognized.
properties:
components:
$ref: '#/components/schemas/Components'
securitySchemes:
auth-id:
type: apiKey
name: auth-id
in: query
auth-token:
type: apiKey
name: auth-token
in: query
embedded-key:
type: apiKey
name: key
in: query
responses:
'200':
description: 'OK (success!): A JSON array containing zero or more address matches for the input provided with the request. If none of the submitted addresses validate, the array will be empty ([]).'
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Root'
'400':
description: 'Bad Request (Malformed Payload): Inputs from the request could not be interpreted.'
'401':
description: 'Unauthorized: The credentials were provided incorrectly or did not match any existing, active credentials.'
'402':
description: 'Payment Required: There is no active subscription for the account associated with the credentials submitted with the request.'
'403':
description: 'Forbidden: Because the international service is currently in a limited release phase, only approved accounts may access the service. Please contact us for your account to be granted access.'
'422':
description: 'Unprocessable Entity: A GET request lacked required fields.'
'429':
description: |-
Too Many Requests: Too many requests with exactly the same input values were submitted within too short a period. This status code conveys that the input was not processed in order to prevent runaway charges caused by such conditions as a misbehaving (infinite) loop sending the same record over and over to the API. You're welcome.
OR
Too Many Requests: When using public "embedded key" authentication, we restrict the number of requests coming from a given source over too short of a time. If you use embedded key authentication, you can avoid this error by adding your IP address as an authorized host for the embedded key in question.
'504':
description: 'Gateway Timeout: Our own upstream data provider did not respond in a timely fashion and the request failed. A serious, yet rare occurrence indeed.'
parameters:
Host:
name: Host
in: header
required: true
schema:
type: string
description: 'The Host request header field specifies the internet host and port number of the resource being requested. Ex: Host: international-street.api.smarty.com'
input_id:
name: input_id
in: query
required: false
schema:
type: string
description: 'A unique identifier generated by you for this address for use within your application; this field will be copied into the output. (e.g., 123456) Max Characters: 36'
country:
name: country
in: query
required: false
schema:
type: string
description: '(required) This must be entered with every address. Country Name or ISO classification (ISO-3, ISO-2 or ISO-N). Address validation will fail if this is missing. (e.g., Brazil, BRA, BR, or 076)'
geocode:
name: geocode
in: query
required: false
schema:
type: string
description: 'Set to true to enable geocoding (disabled by default). See the examples section for, well, an example.'
language:
name: language
in: query
required: false
schema:
type: string
description: 'When not set, the output language will match the language of the input values. When set to native, the results will always be in the language of the output country whenever possible. When set to latin, the results will always be provided using a Latin character set basic ASCII, accents and other diacritics removed. The following character sets can be transliterated, into either native or Latin characters, for the specified countries: Russian (Kazakhstan, Azerbaijan) Japanese (Japan) Simplified Chinese (China) Thai (Thailand) Arabic (Algeria, Bahrain, Egypt, Iraq, Jordan, Kuwait, Lebanon, Morocco, Oman, Qatar, Saudi Arabia, United Arab Emirates, Yemen)'
freeform:
name: freeform
in: query
required: false
schema:
type: string
description: 'The entire address in a single field (without the country). If freeform is specified, all other address input fields (except country) will be ignored. (e.g., Via Santa Maria di Costantinopoli, 72 46030-Tabellano MN) Max Characters: 512'
address1:
name: address1
in: query
required: false
schema:
type: string
description: 'The first address line (e.g., Calle Proc. San Sebastián, 15)'
address2:
name: address2
in: query
required: false
schema:
type: string
description: The second address line (if any)
address3:
name: address3
in: query
required: false
schema:
type: string
description: The third address line (if any)
address4:
name: address4
in: query
required: false
schema:
type: string
description: The forth address line (if any)
organization:
name: organization
in: query
required: false
schema:
type: string
description: 'The name of the recipient, firm, or company at this address (e.g., Robert Smith OR The Clean Oil Company)'
locality:
name: locality
in: query
required: false
schema:
type: string
description: 'The city name (e.g., Paris)'
administrative_area:
name: administrative_area
in: query
required: false
schema:
type: string
description: 'The state or province name or abbreviation (e.g., Alberta or AB)'
postal_code:
name: postal_code
in: query
required: false
schema:
type: string
description: 'The postal code (e.g., 90210-2301)'
license:
name: license
in: query
required: false
schema:
type: string
description: 'The license or licenses (comma separated) to use for this lookup. Valid values can be found in the account dashboard under the appropriate subscription. If multiple licenses are specified, they are considered in left to right order. We recommend that each request explicitly specify a license value. For more information see License Selection.'