@apifreaks/openapi-specs 0.4.2 → 0.4.4

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.
@@ -1,14 +1,14 @@
1
1
  openapi: 3.1.1
2
2
  info:
3
3
  title: Commodities Time Series API
4
- version: 1.0.0
5
- description: Retrieve daily OHLC (open, high, low, close) price data for any supported commodity over a date range of up to 365 days. Accepts one or more comma-separated commodity symbols with a start and end date in YYYY-MM-DD format. Returns a date-indexed object where each date key maps to per-symbol OHLC data. Non-trading days are automatically excluded. Returns a 400 error for invalid dates or a range exceeding 365 days, and a 404 error for unsupported symbols or a date range with no available data.
4
+ version: 2.0.0
5
+ description: Daily OHLC history for one or more commodities over a date range of up to 365 days, indexed by date. Non-trading days are excluded. Monthly-updated commodities only have a closing price — `open`, `high`, and `low` come back as `0`. Unresolved symbols degrade to a 206 partial response instead of failing the whole request.
6
6
  contact:
7
7
  name: APIFreaks Support
8
8
  url: https://apifreaks.com/contact
9
9
  email: support@apifreaks.com
10
10
  servers:
11
- - url: https://api.apifreaks.com/v1.0
11
+ - url: https://api.apifreaks.com/v2.0
12
12
  description: Commodity Time Series API Server
13
13
  paths:
14
14
  /commodity/time-series:
@@ -79,6 +79,69 @@ paths:
79
79
  high: 2674.68
80
80
  low: 2668.58
81
81
  close: 2671.8
82
+ monthlyCommodity:
83
+ summary: Monthly-updated commodity (open/high/low unavailable)
84
+ value:
85
+ success: true
86
+ startDate: '2025-01-01'
87
+ endDate: '2025-03-01'
88
+ rates:
89
+ '2025-01-01':
90
+ NG-EU:
91
+ open: 0
92
+ high: 0
93
+ low: 0
94
+ close: 14.66
95
+ '2025-02-01':
96
+ NG-EU:
97
+ open: 0
98
+ high: 0
99
+ low: 0
100
+ close: 15.34
101
+ '2025-03-01':
102
+ NG-EU:
103
+ open: 0
104
+ high: 0
105
+ low: 0
106
+ close: 13.24
107
+ headers:
108
+ X-AF-Credits-Cost:
109
+ $ref: '#/components/headers/X-AF-Credits-Cost'
110
+ '206':
111
+ description: Partial Content — Some requested symbols could not be resolved
112
+ content:
113
+ application/json:
114
+ schema:
115
+ $ref: '#/components/schemas/CommodityTimeSeriesResponse'
116
+ examples:
117
+ partial:
118
+ summary: One valid symbol, one unresolved symbol
119
+ value:
120
+ success: true
121
+ startDate: '2025-01-06'
122
+ endDate: '2025-01-08'
123
+ rates:
124
+ '2025-01-06':
125
+ XAU:
126
+ open: 2649.01
127
+ high: 2651.33
128
+ low: 2645.36
129
+ close: 2646.91
130
+ '2025-01-07':
131
+ XAU:
132
+ open: 2662.45
133
+ high: 2663.06
134
+ low: 2655.66
135
+ close: 2658.9
136
+ '2025-01-08':
137
+ XAU:
138
+ open: 2669.69
139
+ high: 2674.68
140
+ low: 2668.58
141
+ close: 2671.8
142
+ unresolved:
143
+ FAKESYM:
144
+ message: We don't support this symbol, please visit our symbols page to see supported symbols.
82
145
  headers:
83
146
  X-AF-Credits-Cost:
84
147
  $ref: '#/components/headers/X-AF-Credits-Cost'
@@ -92,9 +155,9 @@ paths:
92
155
  value:
93
156
  error: Invalid Param Exception
94
157
  message: please pass correct parameters
95
- path: /v1.0/commodity/time-series
158
+ path: /v2.0/commodity/time-series
96
159
  status: 400
97
- timestamp: '2026-07-27T11:38:40.063Z'
160
+ timestamp: '2026-09-14T08:43:58.547Z'
98
161
  invalidDate:
99
162
  summary: Date does not exist on the calendar
100
163
  value:
@@ -124,6 +187,24 @@ paths:
124
187
  headers:
125
188
  X-AF-Credits-Cost:
126
189
  $ref: '#/components/headers/X-AF-Credits-Cost'
190
+ '402':
191
+ description: Payment Required — Maximum symbols per request exceeded
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: '#/components/schemas/ErrorResponse'
196
+ examples:
197
+ maxSymbolsExceeded:
198
+ summary: Too many symbols requested
199
+ value:
200
+ timestamp: '2026-09-14T08:44:00.586Z'
201
+ path: /rates/time-series
202
+ code: 402
203
+ error: PAYMENT_REQUIRED
204
+ message: Maximum symbols per request exceeded
205
+ headers:
206
+ X-AF-Credits-Cost:
207
+ $ref: '#/components/headers/X-AF-Credits-Cost'
127
208
  '404':
128
209
  description: Not found - Symbol or data not available
129
210
  content:
@@ -134,15 +215,18 @@ paths:
134
215
  symbolNotFound:
135
216
  summary: Symbol Not Found
136
217
  value:
137
- timestamp: '2026-07-27T11:38:41.234Z'
218
+ timestamp: '2026-09-14T08:44:00.586Z'
138
219
  path: /rates/time-series
139
220
  code: 404
140
221
  error: SYMBOL_NOT_FOUND
141
222
  message: The symbol is not supported, please visit the documentation for a list of supported symbols
223
+ unresolved:
224
+ FAKESYM:
225
+ message: We don't support this symbol, please visit our symbols page to see supported symbols.
142
226
  dataNotFound:
143
227
  summary: No data available for the given date range
144
228
  value:
145
- timestamp: '2026-07-27T11:38:41.234Z'
229
+ timestamp: '2026-09-14T08:44:31.547Z'
146
230
  path: /rates/time-series
147
231
  code: 404
148
232
  error: DATA_NOT_FOUND
@@ -182,6 +266,20 @@ components:
182
266
  description: End date of the time series (YYYY-MM-DD).
183
267
  rates:
184
268
  $ref: '#/components/schemas/CommodityTimeSeriesRates'
269
+ unresolved:
270
+ type: object
271
+ description: Present only on a 206 Partial Content response, when some requested symbols could not be resolved on any date in the range. Map of each unresolved symbol to a detail message and optional close-match suggestions.
272
+ additionalProperties:
273
+ type: object
274
+ properties:
275
+ message:
276
+ type: string
277
+ description: Detail message explaining why this symbol was not resolved.
278
+ suggestions:
279
+ type: array
280
+ description: Optional list of supported symbols that closely match the unresolved symbol.
281
+ items:
282
+ type: string
185
283
  description: Commodity time series response containing date-indexed OHLC data per symbol.
186
284
  CommodityTimeSeriesRates:
187
285
  type: object
@@ -194,7 +292,7 @@ components:
194
292
  $ref: '#/components/schemas/CommodityOhlc'
195
293
  CommodityOhlc:
196
294
  type: object
197
- description: OHLC price data for a single commodity on a single trading day.
295
+ description: OHLC price data for a single commodity on a single trading day. For monthly-updated commodities, only `close` is meaningful — `open`, `high`, and `low` are returned as `0`.
198
296
  required:
199
297
  - open
200
298
  - high
@@ -204,15 +302,15 @@ components:
204
302
  open:
205
303
  type: number
206
304
  format: float
207
- description: Opening price on the given date.
305
+ description: Opening price on the given date. `0` for monthly-updated commodities.
208
306
  high:
209
307
  type: number
210
308
  format: float
211
- description: Highest price on the given date.
309
+ description: Highest price on the given date. `0` for monthly-updated commodities.
212
310
  low:
213
311
  type: number
214
312
  format: float
215
- description: Lowest price on the given date.
313
+ description: Lowest price on the given date. `0` for monthly-updated commodities.
216
314
  close:
217
315
  type: number
218
316
  format: float
@@ -242,6 +340,20 @@ components:
242
340
  type: string
243
341
  format: date-time
244
342
  description: Timestamp when the error occurred (ISO 8601).
343
+ unresolved:
344
+ type: object
345
+ description: Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.
346
+ additionalProperties:
347
+ type: object
348
+ properties:
349
+ message:
350
+ type: string
351
+ description: Detail message explaining why this symbol was not resolved.
352
+ suggestions:
353
+ type: array
354
+ description: Optional list of supported symbols that closely match the unresolved symbol.
355
+ items:
356
+ type: string
245
357
  headers:
246
358
  X-AF-Credits-Cost:
247
359
  description: Specifies the number of credits consumed by the current request.
@@ -1,14 +1,14 @@
1
1
  openapi: 3.1.1
2
2
  info:
3
3
  title: Historical Commodity Prices, Delivered Simply.
4
- version: 1.0.0
5
- description: Retrieve OHLC (open, high, low, close) price data for any supported commodity on a specific date. Data is available from January 1990 onwards for 130+ commodities. Accepts one or more comma-separated commodity symbols and a date in YYYY-MM-DD format. The response contains the opening, high, low, and closing price for each symbol on the given date. Returns a 400 error for invalid dates and a 404 error for unsupported symbols or missing rates.
4
+ version: 2.0.0
5
+ description: OHLC price data for one or more commodities on a specific date, back to January 1990. Falls back to the nearest earlier rate if none exists for the exact date. Monthly-updated commodities only have a closing price — `open`, `high`, and `low` come back as `0`. Unresolved symbols degrade to a 206 partial response instead of failing the whole request.
6
6
  contact:
7
7
  name: APIFreaks Support
8
8
  url: https://apifreaks.com/contact
9
9
  email: support@apifreaks.com
10
10
  servers:
11
- - url: https://api.apifreaks.com/v1.0
11
+ - url: https://api.apifreaks.com/v2.0
12
12
  description: Historical Commodity Prices API Server
13
13
  paths:
14
14
  /commodity/rates/historical:
@@ -66,32 +66,95 @@ paths:
66
66
  high: 2697.85
67
67
  low: 2663.61
68
68
  close: 2689.44
69
+ monthlyCommodity:
70
+ summary: Monthly-updated commodity (open/high/low unavailable)
71
+ value:
72
+ success: true
73
+ date: '2025-01-10'
74
+ rates:
75
+ NG-EU:
76
+ date: '2025-01-01'
77
+ open: 0
78
+ high: 0
79
+ low: 0
80
+ close: 14.66
81
+ headers:
82
+ X-AF-Credits-Cost:
83
+ $ref: '#/components/headers/X-AF-Credits-Cost'
84
+ '206':
85
+ description: Partial Content — Some requested symbols could not be resolved
86
+ content:
87
+ application/json:
88
+ schema:
89
+ $ref: '#/components/schemas/HistoricalCommodityPricesResponse'
90
+ examples:
91
+ partial:
92
+ summary: One valid symbol, one unresolved symbol
93
+ value:
94
+ success: true
95
+ date: '2025-01-10'
96
+ rates:
97
+ XAU:
98
+ date: '2025-01-10'
99
+ open: 2669.93
100
+ high: 2697.85
101
+ low: 2663.61
102
+ close: 2689.44
103
+ unresolved:
104
+ FAKESYM:
105
+ message: We don't support this symbol, please visit our symbols page to see supported symbols.
69
106
  headers:
70
107
  X-AF-Credits-Cost:
71
108
  $ref: '#/components/headers/X-AF-Credits-Cost'
72
109
  '400':
73
- description: Bad request - Invalid date format
110
+ description: Bad Request — Missing parameters or invalid date
74
111
  content:
75
112
  application/json:
76
113
  schema:
77
114
  $ref: '#/components/schemas/ErrorResponse'
78
115
  examples:
116
+ missingSymbols:
117
+ summary: Missing required symbols parameter
118
+ value:
119
+ error: Invalid Param Exception
120
+ message: please pass correct parameters
121
+ path: /v2.0/commodity/rates/historical
122
+ status: 400
123
+ timestamp: '2026-09-14T08:44:32.013Z'
79
124
  invalidDateFormat:
80
125
  summary: Invalid date format
81
126
  value:
82
- timestamp: 1781792620618
83
- status: 400
127
+ timestamp: '2026-09-14T08:45:13.934Z'
128
+ path: /rates/historical
129
+ code: 400
84
130
  error: VALIDATION_ERROR
85
131
  message: Invalid Date Format (YYYY-MM-DD).
86
- path: /v1.0/commodity/rates/historical
87
132
  dateNotExist:
88
133
  summary: Date does not exist
89
134
  value:
90
- timestamp: 1781792620618
91
- status: 400
135
+ timestamp: '2026-09-14T08:44:01.487Z'
136
+ path: /rates/historical
137
+ code: 400
92
138
  error: VALIDATION_ERROR
93
139
  message: 'Invalid Date: The provided date does not exist.'
94
- path: /v1.0/commodity/rates/historical
140
+ headers:
141
+ X-AF-Credits-Cost:
142
+ $ref: '#/components/headers/X-AF-Credits-Cost'
143
+ '402':
144
+ description: Payment Required — Maximum symbols per request exceeded
145
+ content:
146
+ application/json:
147
+ schema:
148
+ $ref: '#/components/schemas/ErrorResponse'
149
+ examples:
150
+ maxSymbolsExceeded:
151
+ summary: Too many symbols requested
152
+ value:
153
+ timestamp: '2026-09-14T08:44:01.978Z'
154
+ path: /rates/historical
155
+ code: 402
156
+ error: PAYMENT_REQUIRED
157
+ message: Maximum symbols per request exceeded
95
158
  headers:
96
159
  X-AF-Credits-Cost:
97
160
  $ref: '#/components/headers/X-AF-Credits-Cost'
@@ -105,19 +168,22 @@ paths:
105
168
  symbolNotFound:
106
169
  summary: Symbol Not Found
107
170
  value:
108
- timestamp: 1781792620618
109
- status: 404
171
+ timestamp: '2026-09-14T08:44:01.978Z'
172
+ path: /rates/historical
173
+ code: 404
110
174
  error: SYMBOL_NOT_FOUND
111
175
  message: The symbol is not supported, please visit the documentation for a list of supported symbols
112
- path: /v1.0/commodity/rates/historical
176
+ unresolved:
177
+ FAKESYM:
178
+ message: We don't support this symbol, please visit our symbols page to see supported symbols.
113
179
  rateNotFound:
114
180
  summary: Rate Not Found
115
181
  value:
116
- timestamp: 1781792620618
117
- status: 404
182
+ timestamp: '2026-09-14T08:44:02.528Z'
183
+ path: /rates/historical
184
+ code: 404
118
185
  error: RATE_NOT_FOUND
119
186
  message: no rates found for the specified date
120
- path: /v1.0/commodity/rates/historical
121
187
  headers:
122
188
  X-AF-Credits-Cost:
123
189
  $ref: '#/components/headers/X-AF-Credits-Cost'
@@ -149,6 +215,20 @@ components:
149
215
  description: Date for which prices were fetched (YYYY-MM-DD).
150
216
  rates:
151
217
  $ref: '#/components/schemas/HistoricalCommodityRates'
218
+ unresolved:
219
+ type: object
220
+ description: Present only on a 206 Partial Content response, when some requested symbols could not be resolved. Map of each unresolved symbol to a detail message and optional close-match suggestions.
221
+ additionalProperties:
222
+ type: object
223
+ properties:
224
+ message:
225
+ type: string
226
+ description: Detail message explaining why this symbol was not resolved.
227
+ suggestions:
228
+ type: array
229
+ description: Optional list of supported symbols that closely match the unresolved symbol.
230
+ items:
231
+ type: string
152
232
  description: Historical commodity prices response containing success status, date, and OHLC rate data.
153
233
  HistoricalCommodityRates:
154
234
  type: object
@@ -160,7 +240,7 @@ components:
160
240
  - symbol
161
241
  HistoricalCommodityRate:
162
242
  type: object
163
- description: OHLC price data for a single commodity on a specific date.
243
+ description: OHLC price data for a single commodity on a specific date. For monthly-updated commodities, only `close` is meaningful — `open`, `high`, and `low` are returned as `0`.
164
244
  required:
165
245
  - date
166
246
  - open
@@ -170,48 +250,62 @@ components:
170
250
  properties:
171
251
  date:
172
252
  type: string
173
- description: Date for which prices were fetched (YYYY-MM-DD).
253
+ description: Date for which prices were fetched (YYYY-MM-DD). May differ from the requested `date` when the API falls back to the last available rate before it, or snaps to the first day of the month for monthly-updated commodities.
174
254
  open:
175
255
  type: number
176
256
  format: float
177
- description: Opening price on the given date.
257
+ description: Opening price on the given date. `0` for monthly-updated commodities.
178
258
  high:
179
259
  type: number
180
260
  format: float
181
- description: Highest price recorded on the given date.
261
+ description: Highest price recorded on the given date. `0` for monthly-updated commodities.
182
262
  low:
183
263
  type: number
184
264
  format: float
185
- description: Lowest price recorded on the given date.
265
+ description: Lowest price recorded on the given date. `0` for monthly-updated commodities.
186
266
  close:
187
267
  type: number
188
268
  format: float
189
269
  description: Closing price on the given date.
190
270
  ErrorResponse:
191
271
  type: object
272
+ description: Standard error envelope returned by the API on failed requests. Gateway-level validation errors populate status; commodity-service errors (date/symbol/rate validation) populate code instead — check whichever is present.
192
273
  required:
193
- - timestamp
194
- - status
195
- - error
196
274
  - message
197
- - path
198
275
  properties:
199
- timestamp:
200
- type: integer
201
- description: Unix timestamp in milliseconds when the error occurred.
202
- status:
203
- type: integer
204
- description: HTTP status code returned with the error.
205
276
  error:
206
277
  type: string
207
- description: Specific error type (e.g., SYMBOL_NOT_FOUND, VALIDATION_ERROR).
278
+ description: Short error category or exception type (e.g., Invalid Param Exception, VALIDATION_ERROR, SYMBOL_NOT_FOUND, RATE_NOT_FOUND).
208
279
  message:
209
280
  type: string
210
281
  description: Human-readable error message describing the failure.
211
282
  path:
212
283
  type: string
213
- description: API endpoint path that produced the error.
214
- description: Standard error envelope returned by the API on failed requests.
284
+ description: API endpoint path (gateway errors) or internal service path (commodity-service errors) that produced the error.
285
+ status:
286
+ type: integer
287
+ description: HTTP status code. Present on gateway-level errors.
288
+ code:
289
+ type: integer
290
+ description: HTTP status code. Present on commodity-service errors instead of status.
291
+ timestamp:
292
+ type: string
293
+ format: date-time
294
+ description: Timestamp when the error occurred (ISO 8601).
295
+ unresolved:
296
+ type: object
297
+ description: Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.
298
+ additionalProperties:
299
+ type: object
300
+ properties:
301
+ message:
302
+ type: string
303
+ description: Detail message explaining why this symbol was not resolved.
304
+ suggestions:
305
+ type: array
306
+ description: Optional list of supported symbols that closely match the unresolved symbol.
307
+ items:
308
+ type: string
215
309
  headers:
216
310
  X-AF-Credits-Cost:
217
311
  description: Specifies the number of credits consumed by the current request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apifreaks/openapi-specs",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Public OpenAPI 3.1 specifications for all APIFreaks API products.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/specs/README.md CHANGED
@@ -41,7 +41,7 @@ Successful responses include `X-AF-Credits-Cost`, the credits consumed by that r
41
41
 
42
42
  Each document declares its base URL under `servers`. Most products use `https://api.apifreaks.com/v1.0`.
43
43
 
44
- These use `https://api.apifreaks.com/v2.0`: IP geolocation, bulk IP geolocation, timezone lookup, domain WHOIS, bulk WHOIS, and astronomy.
44
+ These use `https://api.apifreaks.com/v2.0`: IP geolocation, bulk IP geolocation, timezone lookup, domain WHOIS, bulk WHOIS, astronomy, and all commodity endpoints (live prices, historical prices, fluctuation, time series, symbols).
45
45
 
46
46
  Weather products (except astronomy) use `https://api.apifreaks.com/v1.0/weather`.
47
47