-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpositionstack-openapi.yml
More file actions
600 lines (600 loc) · 18.4 KB
/
Copy pathpositionstack-openapi.yml
File metadata and controls
600 lines (600 loc) · 18.4 KB
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
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
openapi: 3.0.3
info:
title: positionstack
description: |
Forward and Reverse Batch Geocoding REST API by positionstack (apilayer).
Convert addresses to coordinates (forward geocoding) and coordinates to addresses
(reverse geocoding). Supports batch requests, multiple output formats
(JSON, XML, GeoJSON), 2+ billion global places, and add-on modules for timezone,
bounding box, country, and sun (sunrise/sunset) data.
version: "1.0.0"
contact:
name: positionstack Support
email: support@positionstack.com
url: https://positionstack.com/
license:
name: Commercial
url: https://www.ideracorp.com/legal/APILayer
termsOfService: https://www.ideracorp.com/legal/APILayer
servers:
- url: https://api.positionstack.com/v1
description: Production API (HTTPS available on Basic plan and above)
- url: http://api.positionstack.com/v1
description: Production API (HTTP - Free plan)
security:
- AccessKeyAuth: []
tags:
- name: Forward Geocoding
description: Convert addresses, place names, or partial location strings into geographic coordinates.
- name: Reverse Geocoding
description: Convert latitude/longitude coordinates into a full address with locality, region, and country.
- name: Batch Geocoding
description: Run multiple forward or reverse geocoding lookups in a single request (Professional plan and above).
paths:
/forward:
get:
operationId: forwardGeocode
summary: Forward Geocode an Address
description: |
Convert one or more location strings (street, city, place name, postal code)
into geographic coordinates and structured address data. Supply one or more
comma-separated queries to perform a batch request (Professional plan and above).
tags:
- Forward Geocoding
- Batch Geocoding
parameters:
- $ref: '#/components/parameters/AccessKey'
- name: query
in: query
required: true
description: |
The address, place name, or location string to geocode. To run a batch
request, pass multiple comma-separated queries (Professional plan and above).
schema:
type: string
example: "1600 Pennsylvania Ave NW, Washington DC"
- $ref: '#/components/parameters/Country'
- $ref: '#/components/parameters/Region'
- $ref: '#/components/parameters/Bbox'
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Language'
- $ref: '#/components/parameters/Fields'
- $ref: '#/components/parameters/Output'
- $ref: '#/components/parameters/Callback'
- $ref: '#/components/parameters/CountryModule'
- $ref: '#/components/parameters/SunModule'
- $ref: '#/components/parameters/TimezoneModule'
- $ref: '#/components/parameters/BboxModule'
responses:
'200':
description: Successful geocoding response.
content:
application/json:
schema:
$ref: '#/components/schemas/GeocodingResponse'
application/xml:
schema:
$ref: '#/components/schemas/GeocodingResponse'
application/geo+json:
schema:
$ref: '#/components/schemas/GeoJSONFeatureCollection'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/InternalError'
/reverse:
get:
operationId: reverseGeocode
summary: Reverse Geocode Coordinates
description: |
Convert one or more latitude/longitude coordinate pairs into structured
address data. Supply one or more semicolon-separated coordinate pairs
(or comma-separated batched queries) to perform a batch request
(Professional plan and above).
tags:
- Reverse Geocoding
- Batch Geocoding
parameters:
- $ref: '#/components/parameters/AccessKey'
- name: query
in: query
required: true
description: |
Latitude and longitude coordinate pair as a comma-separated string
("LAT,LON"). For batch reverse lookups, separate multiple pairs with
a semicolon (Professional plan and above).
schema:
type: string
pattern: '^-?\d+(\.\d+)?,-?\d+(\.\d+)?(;-?\d+(\.\d+)?,-?\d+(\.\d+)?)*$'
example: "40.7638435,-73.9729691"
- $ref: '#/components/parameters/Country'
- $ref: '#/components/parameters/Region'
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Language'
- $ref: '#/components/parameters/Fields'
- $ref: '#/components/parameters/Output'
- $ref: '#/components/parameters/Callback'
- $ref: '#/components/parameters/CountryModule'
- $ref: '#/components/parameters/SunModule'
- $ref: '#/components/parameters/TimezoneModule'
- $ref: '#/components/parameters/BboxModule'
responses:
'200':
description: Successful reverse geocoding response.
content:
application/json:
schema:
$ref: '#/components/schemas/GeocodingResponse'
application/xml:
schema:
$ref: '#/components/schemas/GeocodingResponse'
application/geo+json:
schema:
$ref: '#/components/schemas/GeoJSONFeatureCollection'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
'500':
$ref: '#/components/responses/InternalError'
components:
securitySchemes:
AccessKeyAuth:
type: apiKey
in: query
name: access_key
description: API access key obtained from your positionstack dashboard.
parameters:
AccessKey:
name: access_key
in: query
required: true
description: Your positionstack API access key.
schema:
type: string
Country:
name: country
in: query
required: false
description: |
Filter results to one or more ISO 3166 alpha-2 country codes (comma separated).
schema:
type: string
example: "US,CA"
Region:
name: region
in: query
required: false
description: Filter results by region or state name.
schema:
type: string
example: "California"
Bbox:
name: bbox
in: query
required: false
description: |
Bounding box filter as `min_lon,min_lat,max_lon,max_lat` to restrict the
geographic area of the search.
schema:
type: string
example: "-74.2591,40.4774,-73.7004,40.9176"
Limit:
name: limit
in: query
required: false
description: Maximum number of results returned. Defaults to 10, maximum 80.
schema:
type: integer
default: 10
minimum: 1
maximum: 80
Language:
name: language
in: query
required: false
description: Two-letter ISO 639-1 language code for localized results.
schema:
type: string
example: "en"
Fields:
name: fields
in: query
required: false
description: |
Comma-separated whitelist of fields to include in the response (e.g. `results.latitude,results.longitude`).
Defaults to all fields.
schema:
type: string
default: "all"
Output:
name: output
in: query
required: false
description: Response output format.
schema:
type: string
enum: [json, xml, geojson]
default: json
Callback:
name: callback
in: query
required: false
description: JSONP callback function name (JSON output only).
schema:
type: string
CountryModule:
name: country_module
in: query
required: false
description: |
Set to `1` to enrich results with country-level data such as ISO codes,
capital, population, currency, language, flag URLs, and dial code.
schema:
type: integer
enum: [0, 1]
default: 0
SunModule:
name: sun_module
in: query
required: false
description: |
Set to `1` to enrich results with sunrise, sunset, and solar transit times
for the location.
schema:
type: integer
enum: [0, 1]
default: 0
TimezoneModule:
name: timezone_module
in: query
required: false
description: |
Set to `1` to enrich results with timezone name, abbreviation, GMT offset,
and DST status.
schema:
type: integer
enum: [0, 1]
default: 0
BboxModule:
name: bbox_module
in: query
required: false
description: |
Set to `1` to include the bounding box coordinates of each returned result.
schema:
type: integer
enum: [0, 1]
default: 0
responses:
Unauthorized:
description: Missing or invalid access_key.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
Forbidden:
description: Subscription does not permit this request (e.g. HTTPS or batch on Free plan).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
NotFound:
description: The requested resource was not found.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
RateLimited:
description: Monthly request quota exhausted or rate limit exceeded.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
InternalError:
description: An unexpected server-side error occurred.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
GeocodingResponse:
type: object
description: A wrapper containing the array of geocoded location results.
properties:
data:
type: array
items:
$ref: '#/components/schemas/Location'
Location:
type: object
description: A single geocoded location result.
properties:
latitude:
type: number
format: double
description: Geographic latitude in decimal degrees.
longitude:
type: number
format: double
description: Geographic longitude in decimal degrees.
type:
type: string
description: |
Result classification (e.g. `address`, `venue`, `street`, `neighbourhood`,
`borough`, `locality`, `county`, `macrocounty`, `region`, `macroregion`,
`country`, `coarse`, `postalcode`).
name:
type: string
description: The short name of the location (e.g. building or street name).
number:
type: string
nullable: true
description: Building or street number.
postal_code:
type: string
nullable: true
description: Postal/ZIP code of the address.
street:
type: string
nullable: true
description: Street name.
confidence:
type: number
format: float
minimum: 0
maximum: 1
description: Confidence score (0.0-1.0) representing match quality.
region:
type: string
nullable: true
description: Name of the region (state, province).
region_code:
type: string
nullable: true
description: ISO 3166-2 region code.
county:
type: string
nullable: true
description: County name.
locality:
type: string
nullable: true
description: Locality / city name.
administrative_area:
type: string
nullable: true
description: Administrative area name.
neighbourhood:
type: string
nullable: true
description: Neighbourhood name.
country:
type: string
description: Country name.
country_code:
type: string
description: ISO 3166 alpha-3 country code.
continent:
type: string
nullable: true
description: Continent name.
label:
type: string
description: Fully formatted label for the result.
map_url:
type: string
format: uri
nullable: true
description: Embeddable map URL for the location (iFrame).
distance:
type: number
format: float
nullable: true
description: Distance (meters) from the query coordinates (reverse geocoding only).
bbox_module:
type: array
nullable: true
description: Bounding box of the result as `[min_lon, min_lat, max_lon, max_lat]` (requires `bbox_module=1`).
items:
type: number
format: double
country_module:
$ref: '#/components/schemas/CountryModuleData'
timezone_module:
$ref: '#/components/schemas/TimezoneModuleData'
sun_module:
$ref: '#/components/schemas/SunModuleData'
CountryModuleData:
type: object
nullable: true
description: Country-level enrichment data (requires `country_module=1`).
properties:
latitude:
type: number
format: double
longitude:
type: number
format: double
common_name:
type: string
official_name:
type: string
capital:
type: string
flag:
type: string
format: uri
area:
type: number
format: float
description: Area in square kilometers.
landlocked:
type: boolean
independent:
type: boolean
global:
type: object
properties:
alpha2:
type: string
alpha3:
type: string
numeric_code:
type: string
region:
type: string
subregion:
type: string
region_code:
type: string
subregion_code:
type: string
world_region:
type: string
continent_name:
type: string
continent_code:
type: string
dial:
type: object
properties:
calling_code:
type: string
national_prefix:
type: string
international_prefix:
type: string
currencies:
type: array
items:
type: object
properties:
symbol:
type: string
code:
type: string
name:
type: string
numeric:
type: string
minor_unit:
type: string
languages:
type: object
additionalProperties:
type: string
TimezoneModuleData:
type: object
nullable: true
description: Timezone enrichment data (requires `timezone_module=1`).
properties:
name:
type: string
description: IANA timezone name (e.g. `America/New_York`).
abbreviation:
type: string
offset_sec:
type: integer
offset_string:
type: string
gmt_offset:
type: integer
is_dst:
type: boolean
SunModuleData:
type: object
nullable: true
description: Sunrise/sunset data (requires `sun_module=1`).
properties:
rise:
type: object
properties:
time:
type: integer
description: Unix timestamp of sunrise.
astronomical:
type: integer
civil:
type: integer
nautical:
type: integer
set:
type: object
properties:
time:
type: integer
description: Unix timestamp of sunset.
astronomical:
type: integer
civil:
type: integer
nautical:
type: integer
transit:
type: integer
description: Unix timestamp of solar transit (noon).
GeoJSONFeatureCollection:
type: object
description: Standard GeoJSON FeatureCollection envelope (when `output=geojson`).
properties:
type:
type: string
enum: [FeatureCollection]
features:
type: array
items:
$ref: '#/components/schemas/GeoJSONFeature'
GeoJSONFeature:
type: object
properties:
type:
type: string
enum: [Feature]
geometry:
type: object
properties:
type:
type: string
enum: [Point]
coordinates:
type: array
minItems: 2
maxItems: 2
items:
type: number
format: double
properties:
$ref: '#/components/schemas/Location'
ErrorResponse:
type: object
description: Standard apilayer/positionstack error envelope.
properties:
success:
type: boolean
example: false
error:
type: object
properties:
code:
type: integer
description: |
Numeric error code (e.g. 101 invalid_access_key, 103 invalid_api_function,
104 usage_limit_reached, 105 function_access_restricted, 601 invalid_query,
602 no_results_found, 603 invalid_latitude, 604 invalid_longitude, 605 invalid_bbox).
type:
type: string
description: Error type slug.
info:
type: string
description: Human-readable error description.