@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.
@@ -2,8 +2,8 @@
2
2
  "openapi": "3.1.1",
3
3
  "info": {
4
4
  "title": "Commodities Time Series API",
5
- "version": "1.0.0",
6
- "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.",
5
+ "version": "2.0.0",
6
+ "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.",
7
7
  "contact": {
8
8
  "name": "APIFreaks Support",
9
9
  "url": "https://apifreaks.com/contact",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "servers": [
14
14
  {
15
- "url": "https://api.apifreaks.com/v1.0",
15
+ "url": "https://api.apifreaks.com/v2.0",
16
16
  "description": "Commodity Time Series API Server"
17
17
  }
18
18
  ],
@@ -105,6 +105,96 @@
105
105
  }
106
106
  }
107
107
  }
108
+ },
109
+ "monthlyCommodity": {
110
+ "summary": "Monthly-updated commodity (open/high/low unavailable)",
111
+ "value": {
112
+ "success": true,
113
+ "startDate": "2025-01-01",
114
+ "endDate": "2025-03-01",
115
+ "rates": {
116
+ "2025-01-01": {
117
+ "NG-EU": {
118
+ "open": 0,
119
+ "high": 0,
120
+ "low": 0,
121
+ "close": 14.66
122
+ }
123
+ },
124
+ "2025-02-01": {
125
+ "NG-EU": {
126
+ "open": 0,
127
+ "high": 0,
128
+ "low": 0,
129
+ "close": 15.34
130
+ }
131
+ },
132
+ "2025-03-01": {
133
+ "NG-EU": {
134
+ "open": 0,
135
+ "high": 0,
136
+ "low": 0,
137
+ "close": 13.24
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ },
146
+ "headers": {
147
+ "X-AF-Credits-Cost": {
148
+ "$ref": "#/components/headers/X-AF-Credits-Cost"
149
+ }
150
+ }
151
+ },
152
+ "206": {
153
+ "description": "Partial Content — Some requested symbols could not be resolved",
154
+ "content": {
155
+ "application/json": {
156
+ "schema": {
157
+ "$ref": "#/components/schemas/CommodityTimeSeriesResponse"
158
+ },
159
+ "examples": {
160
+ "partial": {
161
+ "summary": "One valid symbol, one unresolved symbol",
162
+ "value": {
163
+ "success": true,
164
+ "startDate": "2025-01-06",
165
+ "endDate": "2025-01-08",
166
+ "rates": {
167
+ "2025-01-06": {
168
+ "XAU": {
169
+ "open": 2649.01,
170
+ "high": 2651.33,
171
+ "low": 2645.36,
172
+ "close": 2646.91
173
+ }
174
+ },
175
+ "2025-01-07": {
176
+ "XAU": {
177
+ "open": 2662.45,
178
+ "high": 2663.06,
179
+ "low": 2655.66,
180
+ "close": 2658.9
181
+ }
182
+ },
183
+ "2025-01-08": {
184
+ "XAU": {
185
+ "open": 2669.69,
186
+ "high": 2674.68,
187
+ "low": 2668.58,
188
+ "close": 2671.8
189
+ }
190
+ }
191
+ },
192
+ "unresolved": {
193
+ "FAKESYM": {
194
+ "message": "We don't support this symbol, please visit our symbols page to see supported symbols."
195
+ }
196
+ }
197
+ }
108
198
  }
109
199
  }
110
200
  }
@@ -125,9 +215,9 @@
125
215
  "value": {
126
216
  "error": "Invalid Param Exception",
127
217
  "message": "please pass correct parameters",
128
- "path": "/v1.0/commodity/time-series",
218
+ "path": "/v2.0/commodity/time-series",
129
219
  "status": 400,
130
- "timestamp": "2026-07-27T11:38:40.063Z"
220
+ "timestamp": "2026-09-14T08:43:58.547Z"
131
221
  }
132
222
  },
133
223
  "invalidDate": {
@@ -172,6 +262,33 @@
172
262
  }
173
263
  }
174
264
  },
265
+ "402": {
266
+ "description": "Payment Required — Maximum symbols per request exceeded",
267
+ "content": {
268
+ "application/json": {
269
+ "schema": {
270
+ "$ref": "#/components/schemas/ErrorResponse"
271
+ },
272
+ "examples": {
273
+ "maxSymbolsExceeded": {
274
+ "summary": "Too many symbols requested",
275
+ "value": {
276
+ "timestamp": "2026-09-14T08:44:00.586Z",
277
+ "path": "/rates/time-series",
278
+ "code": 402,
279
+ "error": "PAYMENT_REQUIRED",
280
+ "message": "Maximum symbols per request exceeded"
281
+ }
282
+ }
283
+ }
284
+ }
285
+ },
286
+ "headers": {
287
+ "X-AF-Credits-Cost": {
288
+ "$ref": "#/components/headers/X-AF-Credits-Cost"
289
+ }
290
+ }
291
+ },
175
292
  "404": {
176
293
  "description": "Not found - Symbol or data not available",
177
294
  "content": {
@@ -183,17 +300,22 @@
183
300
  "symbolNotFound": {
184
301
  "summary": "Symbol Not Found",
185
302
  "value": {
186
- "timestamp": "2026-07-27T11:38:41.234Z",
303
+ "timestamp": "2026-09-14T08:44:00.586Z",
187
304
  "path": "/rates/time-series",
188
305
  "code": 404,
189
306
  "error": "SYMBOL_NOT_FOUND",
190
- "message": "The symbol is not supported, please visit the documentation for a list of supported symbols"
307
+ "message": "The symbol is not supported, please visit the documentation for a list of supported symbols",
308
+ "unresolved": {
309
+ "FAKESYM": {
310
+ "message": "We don't support this symbol, please visit our symbols page to see supported symbols."
311
+ }
312
+ }
191
313
  }
192
314
  },
193
315
  "dataNotFound": {
194
316
  "summary": "No data available for the given date range",
195
317
  "value": {
196
- "timestamp": "2026-07-27T11:38:41.234Z",
318
+ "timestamp": "2026-09-14T08:44:31.547Z",
197
319
  "path": "/rates/time-series",
198
320
  "code": 404,
199
321
  "error": "DATA_NOT_FOUND",
@@ -247,6 +369,26 @@
247
369
  },
248
370
  "rates": {
249
371
  "$ref": "#/components/schemas/CommodityTimeSeriesRates"
372
+ },
373
+ "unresolved": {
374
+ "type": "object",
375
+ "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.",
376
+ "additionalProperties": {
377
+ "type": "object",
378
+ "properties": {
379
+ "message": {
380
+ "type": "string",
381
+ "description": "Detail message explaining why this symbol was not resolved."
382
+ },
383
+ "suggestions": {
384
+ "type": "array",
385
+ "description": "Optional list of supported symbols that closely match the unresolved symbol.",
386
+ "items": {
387
+ "type": "string"
388
+ }
389
+ }
390
+ }
391
+ }
250
392
  }
251
393
  },
252
394
  "description": "Commodity time series response containing date-indexed OHLC data per symbol."
@@ -265,23 +407,23 @@
265
407
  },
266
408
  "CommodityOhlc": {
267
409
  "type": "object",
268
- "description": "OHLC price data for a single commodity on a single trading day.",
410
+ "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`.",
269
411
  "required": ["open", "high", "low", "close"],
270
412
  "properties": {
271
413
  "open": {
272
414
  "type": "number",
273
415
  "format": "float",
274
- "description": "Opening price on the given date."
416
+ "description": "Opening price on the given date. `0` for monthly-updated commodities."
275
417
  },
276
418
  "high": {
277
419
  "type": "number",
278
420
  "format": "float",
279
- "description": "Highest price on the given date."
421
+ "description": "Highest price on the given date. `0` for monthly-updated commodities."
280
422
  },
281
423
  "low": {
282
424
  "type": "number",
283
425
  "format": "float",
284
- "description": "Lowest price on the given date."
426
+ "description": "Lowest price on the given date. `0` for monthly-updated commodities."
285
427
  },
286
428
  "close": {
287
429
  "type": "number",
@@ -319,6 +461,26 @@
319
461
  "type": "string",
320
462
  "format": "date-time",
321
463
  "description": "Timestamp when the error occurred (ISO 8601)."
464
+ },
465
+ "unresolved": {
466
+ "type": "object",
467
+ "description": "Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.",
468
+ "additionalProperties": {
469
+ "type": "object",
470
+ "properties": {
471
+ "message": {
472
+ "type": "string",
473
+ "description": "Detail message explaining why this symbol was not resolved."
474
+ },
475
+ "suggestions": {
476
+ "type": "array",
477
+ "description": "Optional list of supported symbols that closely match the unresolved symbol.",
478
+ "items": {
479
+ "type": "string"
480
+ }
481
+ }
482
+ }
483
+ }
322
484
  }
323
485
  }
324
486
  }
@@ -2,8 +2,8 @@
2
2
  "openapi": "3.1.1",
3
3
  "info": {
4
4
  "title": "Historical Commodity Prices, Delivered Simply.",
5
- "version": "1.0.0",
6
- "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.",
5
+ "version": "2.0.0",
6
+ "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.",
7
7
  "contact": {
8
8
  "name": "APIFreaks Support",
9
9
  "url": "https://apifreaks.com/contact",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "servers": [
14
14
  {
15
- "url": "https://api.apifreaks.com/v1.0",
15
+ "url": "https://api.apifreaks.com/v2.0",
16
16
  "description": "Historical Commodity Prices API Server"
17
17
  }
18
18
  ],
@@ -85,6 +85,60 @@
85
85
  }
86
86
  }
87
87
  }
88
+ },
89
+ "monthlyCommodity": {
90
+ "summary": "Monthly-updated commodity (open/high/low unavailable)",
91
+ "value": {
92
+ "success": true,
93
+ "date": "2025-01-10",
94
+ "rates": {
95
+ "NG-EU": {
96
+ "date": "2025-01-01",
97
+ "open": 0,
98
+ "high": 0,
99
+ "low": 0,
100
+ "close": 14.66
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "headers": {
109
+ "X-AF-Credits-Cost": {
110
+ "$ref": "#/components/headers/X-AF-Credits-Cost"
111
+ }
112
+ }
113
+ },
114
+ "206": {
115
+ "description": "Partial Content — Some requested symbols could not be resolved",
116
+ "content": {
117
+ "application/json": {
118
+ "schema": {
119
+ "$ref": "#/components/schemas/HistoricalCommodityPricesResponse"
120
+ },
121
+ "examples": {
122
+ "partial": {
123
+ "summary": "One valid symbol, one unresolved symbol",
124
+ "value": {
125
+ "success": true,
126
+ "date": "2025-01-10",
127
+ "rates": {
128
+ "XAU": {
129
+ "date": "2025-01-10",
130
+ "open": 2669.93,
131
+ "high": 2697.85,
132
+ "low": 2663.61,
133
+ "close": 2689.44
134
+ }
135
+ },
136
+ "unresolved": {
137
+ "FAKESYM": {
138
+ "message": "We don't support this symbol, please visit our symbols page to see supported symbols."
139
+ }
140
+ }
141
+ }
88
142
  }
89
143
  }
90
144
  }
@@ -96,31 +150,68 @@
96
150
  }
97
151
  },
98
152
  "400": {
99
- "description": "Bad request - Invalid date format",
153
+ "description": "Bad Request — Missing parameters or invalid date",
100
154
  "content": {
101
155
  "application/json": {
102
156
  "schema": {
103
157
  "$ref": "#/components/schemas/ErrorResponse"
104
158
  },
105
159
  "examples": {
160
+ "missingSymbols": {
161
+ "summary": "Missing required symbols parameter",
162
+ "value": {
163
+ "error": "Invalid Param Exception",
164
+ "message": "please pass correct parameters",
165
+ "path": "/v2.0/commodity/rates/historical",
166
+ "status": 400,
167
+ "timestamp": "2026-09-14T08:44:32.013Z"
168
+ }
169
+ },
106
170
  "invalidDateFormat": {
107
171
  "summary": "Invalid date format",
108
172
  "value": {
109
- "timestamp": 1781792620618,
110
- "status": 400,
173
+ "timestamp": "2026-09-14T08:45:13.934Z",
174
+ "path": "/rates/historical",
175
+ "code": 400,
111
176
  "error": "VALIDATION_ERROR",
112
- "message": "Invalid Date Format (YYYY-MM-DD).",
113
- "path": "/v1.0/commodity/rates/historical"
177
+ "message": "Invalid Date Format (YYYY-MM-DD)."
114
178
  }
115
179
  },
116
180
  "dateNotExist": {
117
181
  "summary": "Date does not exist",
118
182
  "value": {
119
- "timestamp": 1781792620618,
120
- "status": 400,
183
+ "timestamp": "2026-09-14T08:44:01.487Z",
184
+ "path": "/rates/historical",
185
+ "code": 400,
121
186
  "error": "VALIDATION_ERROR",
122
- "message": "Invalid Date: The provided date does not exist.",
123
- "path": "/v1.0/commodity/rates/historical"
187
+ "message": "Invalid Date: The provided date does not exist."
188
+ }
189
+ }
190
+ }
191
+ }
192
+ },
193
+ "headers": {
194
+ "X-AF-Credits-Cost": {
195
+ "$ref": "#/components/headers/X-AF-Credits-Cost"
196
+ }
197
+ }
198
+ },
199
+ "402": {
200
+ "description": "Payment Required — Maximum symbols per request exceeded",
201
+ "content": {
202
+ "application/json": {
203
+ "schema": {
204
+ "$ref": "#/components/schemas/ErrorResponse"
205
+ },
206
+ "examples": {
207
+ "maxSymbolsExceeded": {
208
+ "summary": "Too many symbols requested",
209
+ "value": {
210
+ "timestamp": "2026-09-14T08:44:01.978Z",
211
+ "path": "/rates/historical",
212
+ "code": 402,
213
+ "error": "PAYMENT_REQUIRED",
214
+ "message": "Maximum symbols per request exceeded"
124
215
  }
125
216
  }
126
217
  }
@@ -143,21 +234,26 @@
143
234
  "symbolNotFound": {
144
235
  "summary": "Symbol Not Found",
145
236
  "value": {
146
- "timestamp": 1781792620618,
147
- "status": 404,
237
+ "timestamp": "2026-09-14T08:44:01.978Z",
238
+ "path": "/rates/historical",
239
+ "code": 404,
148
240
  "error": "SYMBOL_NOT_FOUND",
149
241
  "message": "The symbol is not supported, please visit the documentation for a list of supported symbols",
150
- "path": "/v1.0/commodity/rates/historical"
242
+ "unresolved": {
243
+ "FAKESYM": {
244
+ "message": "We don't support this symbol, please visit our symbols page to see supported symbols."
245
+ }
246
+ }
151
247
  }
152
248
  },
153
249
  "rateNotFound": {
154
250
  "summary": "Rate Not Found",
155
251
  "value": {
156
- "timestamp": 1781792620618,
157
- "status": 404,
252
+ "timestamp": "2026-09-14T08:44:02.528Z",
253
+ "path": "/rates/historical",
254
+ "code": 404,
158
255
  "error": "RATE_NOT_FOUND",
159
- "message": "no rates found for the specified date",
160
- "path": "/v1.0/commodity/rates/historical"
256
+ "message": "no rates found for the specified date"
161
257
  }
162
258
  }
163
259
  }
@@ -203,6 +299,26 @@
203
299
  },
204
300
  "rates": {
205
301
  "$ref": "#/components/schemas/HistoricalCommodityRates"
302
+ },
303
+ "unresolved": {
304
+ "type": "object",
305
+ "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.",
306
+ "additionalProperties": {
307
+ "type": "object",
308
+ "properties": {
309
+ "message": {
310
+ "type": "string",
311
+ "description": "Detail message explaining why this symbol was not resolved."
312
+ },
313
+ "suggestions": {
314
+ "type": "array",
315
+ "description": "Optional list of supported symbols that closely match the unresolved symbol.",
316
+ "items": {
317
+ "type": "string"
318
+ }
319
+ }
320
+ }
321
+ }
206
322
  }
207
323
  },
208
324
  "description": "Historical commodity prices response containing success status, date, and OHLC rate data."
@@ -219,27 +335,27 @@
219
335
  },
220
336
  "HistoricalCommodityRate": {
221
337
  "type": "object",
222
- "description": "OHLC price data for a single commodity on a specific date.",
338
+ "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`.",
223
339
  "required": ["date", "open", "high", "low", "close"],
224
340
  "properties": {
225
341
  "date": {
226
342
  "type": "string",
227
- "description": "Date for which prices were fetched (YYYY-MM-DD)."
343
+ "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."
228
344
  },
229
345
  "open": {
230
346
  "type": "number",
231
347
  "format": "float",
232
- "description": "Opening price on the given date."
348
+ "description": "Opening price on the given date. `0` for monthly-updated commodities."
233
349
  },
234
350
  "high": {
235
351
  "type": "number",
236
352
  "format": "float",
237
- "description": "Highest price recorded on the given date."
353
+ "description": "Highest price recorded on the given date. `0` for monthly-updated commodities."
238
354
  },
239
355
  "low": {
240
356
  "type": "number",
241
357
  "format": "float",
242
- "description": "Lowest price recorded on the given date."
358
+ "description": "Lowest price recorded on the given date. `0` for monthly-updated commodities."
243
359
  },
244
360
  "close": {
245
361
  "type": "number",
@@ -250,19 +366,12 @@
250
366
  },
251
367
  "ErrorResponse": {
252
368
  "type": "object",
253
- "required": ["timestamp", "status", "error", "message", "path"],
369
+ "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.",
370
+ "required": ["message"],
254
371
  "properties": {
255
- "timestamp": {
256
- "type": "integer",
257
- "description": "Unix timestamp in milliseconds when the error occurred."
258
- },
259
- "status": {
260
- "type": "integer",
261
- "description": "HTTP status code returned with the error."
262
- },
263
372
  "error": {
264
373
  "type": "string",
265
- "description": "Specific error type (e.g., SYMBOL_NOT_FOUND, VALIDATION_ERROR)."
374
+ "description": "Short error category or exception type (e.g., Invalid Param Exception, VALIDATION_ERROR, SYMBOL_NOT_FOUND, RATE_NOT_FOUND)."
266
375
  },
267
376
  "message": {
268
377
  "type": "string",
@@ -270,10 +379,42 @@
270
379
  },
271
380
  "path": {
272
381
  "type": "string",
273
- "description": "API endpoint path that produced the error."
382
+ "description": "API endpoint path (gateway errors) or internal service path (commodity-service errors) that produced the error."
383
+ },
384
+ "status": {
385
+ "type": "integer",
386
+ "description": "HTTP status code. Present on gateway-level errors."
387
+ },
388
+ "code": {
389
+ "type": "integer",
390
+ "description": "HTTP status code. Present on commodity-service errors instead of status."
391
+ },
392
+ "timestamp": {
393
+ "type": "string",
394
+ "format": "date-time",
395
+ "description": "Timestamp when the error occurred (ISO 8601)."
396
+ },
397
+ "unresolved": {
398
+ "type": "object",
399
+ "description": "Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.",
400
+ "additionalProperties": {
401
+ "type": "object",
402
+ "properties": {
403
+ "message": {
404
+ "type": "string",
405
+ "description": "Detail message explaining why this symbol was not resolved."
406
+ },
407
+ "suggestions": {
408
+ "type": "array",
409
+ "description": "Optional list of supported symbols that closely match the unresolved symbol.",
410
+ "items": {
411
+ "type": "string"
412
+ }
413
+ }
414
+ }
415
+ }
274
416
  }
275
- },
276
- "description": "Standard error envelope returned by the API on failed requests."
417
+ }
277
418
  }
278
419
  },
279
420
  "headers": {