@apifreaks/openapi-specs 0.4.2 → 0.4.3
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/dist/index.cjs +657 -84
- package/dist/index.js +657 -84
- package/dist/specs/commodity/commodity-fluctuation.yaml +81 -7
- package/dist/specs/commodity/commodity-prices.yaml +130 -22
- package/dist/specs/commodity/commodity-symbols.yaml +54 -7
- package/dist/specs/commodity/commodity-time-series.yaml +94 -7
- package/dist/specs/commodity/historical-commodity-prices.yaml +112 -30
- package/package.json +1 -1
- package/specs/README.md +1 -1
- package/specs/commodity/commodity-fluctuation.json +118 -8
- package/specs/commodity/commodity-prices.json +176 -23
- package/specs/commodity/commodity-symbols.json +64 -7
- package/specs/commodity/commodity-time-series.json +136 -8
- package/specs/commodity/historical-commodity-prices.json +158 -33
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
openapi: 3.1.1
|
|
2
2
|
info:
|
|
3
3
|
title: Historical Commodity Prices, Delivered Simply.
|
|
4
|
-
version:
|
|
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
|
|
4
|
+
version: 2.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 245+ commodities, and only closing rates are available for monthly-updated commodities. If a commodity has no rate on the requested date, the API falls back to the last available rate before that date and returns it along with its actual date. Accepts one or more comma-separated commodity symbols and a date in YYYY-MM-DD format. If some requested symbols can't be resolved (unsupported, or no rate on or before the requested date), a 206 Partial Content response is returned with the resolved rates plus an `unresolved` object. Returns a 400 error for invalid dates and a 404 error for unsupported symbols or missing rates.
|
|
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/
|
|
11
|
+
- url: https://api.apifreaks.com/v2.0
|
|
12
12
|
description: Historical Commodity Prices API Server
|
|
13
13
|
paths:
|
|
14
14
|
/commodity/rates/historical:
|
|
@@ -69,29 +69,80 @@ paths:
|
|
|
69
69
|
headers:
|
|
70
70
|
X-AF-Credits-Cost:
|
|
71
71
|
$ref: '#/components/headers/X-AF-Credits-Cost'
|
|
72
|
+
'206':
|
|
73
|
+
description: Partial Content — Some requested symbols could not be resolved
|
|
74
|
+
content:
|
|
75
|
+
application/json:
|
|
76
|
+
schema:
|
|
77
|
+
$ref: '#/components/schemas/HistoricalCommodityPricesResponse'
|
|
78
|
+
examples:
|
|
79
|
+
partial:
|
|
80
|
+
summary: One valid symbol, one unresolved symbol
|
|
81
|
+
value:
|
|
82
|
+
success: true
|
|
83
|
+
date: '2025-01-10'
|
|
84
|
+
rates:
|
|
85
|
+
XAU:
|
|
86
|
+
date: '2025-01-10'
|
|
87
|
+
open: 2669.93
|
|
88
|
+
high: 2697.85
|
|
89
|
+
low: 2663.61
|
|
90
|
+
close: 2689.44
|
|
91
|
+
unresolved:
|
|
92
|
+
FAKESYM:
|
|
93
|
+
message: We don't support this symbol, please visit our symbols page to see supported symbols.
|
|
94
|
+
headers:
|
|
95
|
+
X-AF-Credits-Cost:
|
|
96
|
+
$ref: '#/components/headers/X-AF-Credits-Cost'
|
|
72
97
|
'400':
|
|
73
|
-
description: Bad
|
|
98
|
+
description: Bad Request — Missing parameters or invalid date
|
|
74
99
|
content:
|
|
75
100
|
application/json:
|
|
76
101
|
schema:
|
|
77
102
|
$ref: '#/components/schemas/ErrorResponse'
|
|
78
103
|
examples:
|
|
104
|
+
missingSymbols:
|
|
105
|
+
summary: Missing required symbols parameter
|
|
106
|
+
value:
|
|
107
|
+
error: Invalid Param Exception
|
|
108
|
+
message: please pass correct parameters
|
|
109
|
+
path: /v2.0/commodity/rates/historical
|
|
110
|
+
status: 400
|
|
111
|
+
timestamp: '2026-09-14T08:44:32.013Z'
|
|
79
112
|
invalidDateFormat:
|
|
80
113
|
summary: Invalid date format
|
|
81
114
|
value:
|
|
82
|
-
timestamp:
|
|
83
|
-
|
|
115
|
+
timestamp: '2026-09-14T08:45:13.934Z'
|
|
116
|
+
path: /rates/historical
|
|
117
|
+
code: 400
|
|
84
118
|
error: VALIDATION_ERROR
|
|
85
119
|
message: Invalid Date Format (YYYY-MM-DD).
|
|
86
|
-
path: /v1.0/commodity/rates/historical
|
|
87
120
|
dateNotExist:
|
|
88
121
|
summary: Date does not exist
|
|
89
122
|
value:
|
|
90
|
-
timestamp:
|
|
91
|
-
|
|
123
|
+
timestamp: '2026-09-14T08:44:01.487Z'
|
|
124
|
+
path: /rates/historical
|
|
125
|
+
code: 400
|
|
92
126
|
error: VALIDATION_ERROR
|
|
93
127
|
message: 'Invalid Date: The provided date does not exist.'
|
|
94
|
-
|
|
128
|
+
headers:
|
|
129
|
+
X-AF-Credits-Cost:
|
|
130
|
+
$ref: '#/components/headers/X-AF-Credits-Cost'
|
|
131
|
+
'402':
|
|
132
|
+
description: Payment Required — Maximum symbols per request exceeded
|
|
133
|
+
content:
|
|
134
|
+
application/json:
|
|
135
|
+
schema:
|
|
136
|
+
$ref: '#/components/schemas/ErrorResponse'
|
|
137
|
+
examples:
|
|
138
|
+
maxSymbolsExceeded:
|
|
139
|
+
summary: Too many symbols requested
|
|
140
|
+
value:
|
|
141
|
+
timestamp: '2026-09-14T08:44:01.978Z'
|
|
142
|
+
path: /rates/historical
|
|
143
|
+
code: 402
|
|
144
|
+
error: PAYMENT_REQUIRED
|
|
145
|
+
message: Maximum symbols per request exceeded
|
|
95
146
|
headers:
|
|
96
147
|
X-AF-Credits-Cost:
|
|
97
148
|
$ref: '#/components/headers/X-AF-Credits-Cost'
|
|
@@ -105,19 +156,22 @@ paths:
|
|
|
105
156
|
symbolNotFound:
|
|
106
157
|
summary: Symbol Not Found
|
|
107
158
|
value:
|
|
108
|
-
timestamp:
|
|
109
|
-
|
|
159
|
+
timestamp: '2026-09-14T08:44:01.978Z'
|
|
160
|
+
path: /rates/historical
|
|
161
|
+
code: 404
|
|
110
162
|
error: SYMBOL_NOT_FOUND
|
|
111
163
|
message: The symbol is not supported, please visit the documentation for a list of supported symbols
|
|
112
|
-
|
|
164
|
+
unresolved:
|
|
165
|
+
FAKESYM:
|
|
166
|
+
message: We don't support this symbol, please visit our symbols page to see supported symbols.
|
|
113
167
|
rateNotFound:
|
|
114
168
|
summary: Rate Not Found
|
|
115
169
|
value:
|
|
116
|
-
timestamp:
|
|
117
|
-
|
|
170
|
+
timestamp: '2026-09-14T08:44:02.528Z'
|
|
171
|
+
path: /rates/historical
|
|
172
|
+
code: 404
|
|
118
173
|
error: RATE_NOT_FOUND
|
|
119
174
|
message: no rates found for the specified date
|
|
120
|
-
path: /v1.0/commodity/rates/historical
|
|
121
175
|
headers:
|
|
122
176
|
X-AF-Credits-Cost:
|
|
123
177
|
$ref: '#/components/headers/X-AF-Credits-Cost'
|
|
@@ -149,6 +203,20 @@ components:
|
|
|
149
203
|
description: Date for which prices were fetched (YYYY-MM-DD).
|
|
150
204
|
rates:
|
|
151
205
|
$ref: '#/components/schemas/HistoricalCommodityRates'
|
|
206
|
+
unresolved:
|
|
207
|
+
type: object
|
|
208
|
+
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.
|
|
209
|
+
additionalProperties:
|
|
210
|
+
type: object
|
|
211
|
+
properties:
|
|
212
|
+
message:
|
|
213
|
+
type: string
|
|
214
|
+
description: Detail message explaining why this symbol was not resolved.
|
|
215
|
+
suggestions:
|
|
216
|
+
type: array
|
|
217
|
+
description: Optional list of supported symbols that closely match the unresolved symbol.
|
|
218
|
+
items:
|
|
219
|
+
type: string
|
|
152
220
|
description: Historical commodity prices response containing success status, date, and OHLC rate data.
|
|
153
221
|
HistoricalCommodityRates:
|
|
154
222
|
type: object
|
|
@@ -170,7 +238,7 @@ components:
|
|
|
170
238
|
properties:
|
|
171
239
|
date:
|
|
172
240
|
type: string
|
|
173
|
-
description: Date for which prices were fetched (YYYY-MM-DD).
|
|
241
|
+
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.
|
|
174
242
|
open:
|
|
175
243
|
type: number
|
|
176
244
|
format: float
|
|
@@ -189,29 +257,43 @@ components:
|
|
|
189
257
|
description: Closing price on the given date.
|
|
190
258
|
ErrorResponse:
|
|
191
259
|
type: object
|
|
260
|
+
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
261
|
required:
|
|
193
|
-
- timestamp
|
|
194
|
-
- status
|
|
195
|
-
- error
|
|
196
262
|
- message
|
|
197
|
-
- path
|
|
198
263
|
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
264
|
error:
|
|
206
265
|
type: string
|
|
207
|
-
description:
|
|
266
|
+
description: Short error category or exception type (e.g., Invalid Param Exception, VALIDATION_ERROR, SYMBOL_NOT_FOUND, RATE_NOT_FOUND).
|
|
208
267
|
message:
|
|
209
268
|
type: string
|
|
210
269
|
description: Human-readable error message describing the failure.
|
|
211
270
|
path:
|
|
212
271
|
type: string
|
|
213
|
-
description: API endpoint path that produced the error.
|
|
214
|
-
|
|
272
|
+
description: API endpoint path (gateway errors) or internal service path (commodity-service errors) that produced the error.
|
|
273
|
+
status:
|
|
274
|
+
type: integer
|
|
275
|
+
description: HTTP status code. Present on gateway-level errors.
|
|
276
|
+
code:
|
|
277
|
+
type: integer
|
|
278
|
+
description: HTTP status code. Present on commodity-service errors instead of status.
|
|
279
|
+
timestamp:
|
|
280
|
+
type: string
|
|
281
|
+
format: date-time
|
|
282
|
+
description: Timestamp when the error occurred (ISO 8601).
|
|
283
|
+
unresolved:
|
|
284
|
+
type: object
|
|
285
|
+
description: Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.
|
|
286
|
+
additionalProperties:
|
|
287
|
+
type: object
|
|
288
|
+
properties:
|
|
289
|
+
message:
|
|
290
|
+
type: string
|
|
291
|
+
description: Detail message explaining why this symbol was not resolved.
|
|
292
|
+
suggestions:
|
|
293
|
+
type: array
|
|
294
|
+
description: Optional list of supported symbols that closely match the unresolved symbol.
|
|
295
|
+
items:
|
|
296
|
+
type: string
|
|
215
297
|
headers:
|
|
216
298
|
X-AF-Credits-Cost:
|
|
217
299
|
description: Specifies the number of credits consumed by the current request.
|
package/package.json
CHANGED
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
|
|
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
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"openapi": "3.1.1",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Commodity Fluctuation API ",
|
|
5
|
-
"version": "
|
|
6
|
-
"description": "Calculate price change and percentage movement for any commodity over a custom date range. Returns the opening price, closing price, absolute change, and percentage change for each symbol. Accepts one or more comma-separated commodity symbols with a start and end date in YYYY-MM-DD format. Returns a 400 error for invalid dates or a date range where start is after end, and a 404 error for unsupported symbols or a date range with no available data.",
|
|
5
|
+
"version": "2.0.0",
|
|
6
|
+
"description": "Calculate price change and percentage movement for any commodity over a custom date range. Returns the opening price, closing price, absolute change, and percentage change for each symbol, rounded to 2 decimal places. For monthly-updated commodities, the fluctuation is computed between the first day of the start month and the first day of the end month. There is no limit on the date range. Accepts one or more comma-separated commodity symbols with a start and end date in YYYY-MM-DD format. If some requested symbols can't be resolved, a 206 Partial Content response is returned with the resolved rates plus an `unresolved` object. Returns a 400 error for invalid dates or a date range where start is after end, and a 404 error for unsupported symbols or a date range with no available data.",
|
|
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/
|
|
15
|
+
"url": "https://api.apifreaks.com/v2.0",
|
|
16
16
|
"description": "Commodity Fluctuation API Server"
|
|
17
17
|
}
|
|
18
18
|
],
|
|
@@ -103,6 +103,44 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
+
"206": {
|
|
107
|
+
"description": "Partial Content — Some requested symbols could not be resolved",
|
|
108
|
+
"content": {
|
|
109
|
+
"application/json": {
|
|
110
|
+
"schema": {
|
|
111
|
+
"$ref": "#/components/schemas/CommodityFluctuationResponse"
|
|
112
|
+
},
|
|
113
|
+
"examples": {
|
|
114
|
+
"partial": {
|
|
115
|
+
"summary": "One valid symbol, one unresolved symbol",
|
|
116
|
+
"value": {
|
|
117
|
+
"success": true,
|
|
118
|
+
"startDate": "2024-01-01",
|
|
119
|
+
"endDate": "2024-01-31",
|
|
120
|
+
"rates": {
|
|
121
|
+
"XAU": {
|
|
122
|
+
"startRate": 2063.63,
|
|
123
|
+
"endRate": 2039.83,
|
|
124
|
+
"change": -23.8,
|
|
125
|
+
"changePercent": -1.15
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"unresolved": {
|
|
129
|
+
"FAKESYM": {
|
|
130
|
+
"message": "We don't support this symbol, please visit our symbols page to see supported symbols."
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"headers": {
|
|
139
|
+
"X-AF-Credits-Cost": {
|
|
140
|
+
"$ref": "#/components/headers/X-AF-Credits-Cost"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
106
144
|
"400": {
|
|
107
145
|
"description": "Bad Request — Missing parameters or invalid dates",
|
|
108
146
|
"content": {
|
|
@@ -113,9 +151,9 @@
|
|
|
113
151
|
"value": {
|
|
114
152
|
"error": "Invalid Param Exception",
|
|
115
153
|
"message": "please pass correct parameters",
|
|
116
|
-
"path": "/
|
|
154
|
+
"path": "/v2.0/commodity/fluctuation",
|
|
117
155
|
"status": 400,
|
|
118
|
-
"timestamp": "2026-
|
|
156
|
+
"timestamp": "2026-09-14T08:43:46.481Z"
|
|
119
157
|
}
|
|
120
158
|
},
|
|
121
159
|
"invalidDateFormat": {
|
|
@@ -160,6 +198,33 @@
|
|
|
160
198
|
}
|
|
161
199
|
}
|
|
162
200
|
},
|
|
201
|
+
"402": {
|
|
202
|
+
"description": "Payment Required — Maximum symbols per request exceeded",
|
|
203
|
+
"content": {
|
|
204
|
+
"application/json": {
|
|
205
|
+
"schema": {
|
|
206
|
+
"$ref": "#/components/schemas/ErrorResponse"
|
|
207
|
+
},
|
|
208
|
+
"examples": {
|
|
209
|
+
"maxSymbolsExceeded": {
|
|
210
|
+
"summary": "Too many symbols requested",
|
|
211
|
+
"value": {
|
|
212
|
+
"timestamp": "2026-09-14T08:43:48.408Z",
|
|
213
|
+
"path": "/rates/fluctuation",
|
|
214
|
+
"code": 402,
|
|
215
|
+
"error": "PAYMENT_REQUIRED",
|
|
216
|
+
"message": "Maximum symbols per request exceeded"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"headers": {
|
|
223
|
+
"X-AF-Credits-Cost": {
|
|
224
|
+
"$ref": "#/components/headers/X-AF-Credits-Cost"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
163
228
|
"404": {
|
|
164
229
|
"description": "Not found - Symbol or data not available",
|
|
165
230
|
"content": {
|
|
@@ -171,17 +236,22 @@
|
|
|
171
236
|
"symbolNotFound": {
|
|
172
237
|
"summary": "Symbol Not Found",
|
|
173
238
|
"value": {
|
|
174
|
-
"timestamp": "2026-
|
|
239
|
+
"timestamp": "2026-09-14T08:43:48.408Z",
|
|
175
240
|
"path": "/rates/fluctuation",
|
|
176
241
|
"code": 404,
|
|
177
242
|
"error": "SYMBOL_NOT_FOUND",
|
|
178
|
-
"message": "The symbol is not supported, please visit the documentation for a list of supported symbols"
|
|
243
|
+
"message": "The symbol is not supported, please visit the documentation for a list of supported symbols",
|
|
244
|
+
"unresolved": {
|
|
245
|
+
"FAKESYM": {
|
|
246
|
+
"message": "We don't support this symbol, please visit our symbols page to see supported symbols."
|
|
247
|
+
}
|
|
248
|
+
}
|
|
179
249
|
}
|
|
180
250
|
},
|
|
181
251
|
"noData": {
|
|
182
252
|
"summary": "No data available for the given date range",
|
|
183
253
|
"value": {
|
|
184
|
-
"timestamp": "2026-
|
|
254
|
+
"timestamp": "2026-09-14T08:44:31.022Z",
|
|
185
255
|
"path": "/rates/fluctuation",
|
|
186
256
|
"code": 404,
|
|
187
257
|
"error": "DATA_NOT_FOUND",
|
|
@@ -235,6 +305,26 @@
|
|
|
235
305
|
},
|
|
236
306
|
"rates": {
|
|
237
307
|
"$ref": "#/components/schemas/CommodityFluctuationRates"
|
|
308
|
+
},
|
|
309
|
+
"unresolved": {
|
|
310
|
+
"type": "object",
|
|
311
|
+
"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.",
|
|
312
|
+
"additionalProperties": {
|
|
313
|
+
"type": "object",
|
|
314
|
+
"properties": {
|
|
315
|
+
"message": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"description": "Detail message explaining why this symbol was not resolved."
|
|
318
|
+
},
|
|
319
|
+
"suggestions": {
|
|
320
|
+
"type": "array",
|
|
321
|
+
"description": "Optional list of supported symbols that closely match the unresolved symbol.",
|
|
322
|
+
"items": {
|
|
323
|
+
"type": "string"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
238
328
|
}
|
|
239
329
|
},
|
|
240
330
|
"description": "Commodity fluctuation response containing price change data per symbol over a date range."
|
|
@@ -300,6 +390,26 @@
|
|
|
300
390
|
"type": "string",
|
|
301
391
|
"format": "date-time",
|
|
302
392
|
"description": "Timestamp when the error occurred (ISO 8601)."
|
|
393
|
+
},
|
|
394
|
+
"unresolved": {
|
|
395
|
+
"type": "object",
|
|
396
|
+
"description": "Present only on SYMBOL_NOT_FOUND errors. Map of each unresolved symbol to a detail message and optional close-match suggestions.",
|
|
397
|
+
"additionalProperties": {
|
|
398
|
+
"type": "object",
|
|
399
|
+
"properties": {
|
|
400
|
+
"message": {
|
|
401
|
+
"type": "string",
|
|
402
|
+
"description": "Detail message explaining why this symbol was not resolved."
|
|
403
|
+
},
|
|
404
|
+
"suggestions": {
|
|
405
|
+
"type": "array",
|
|
406
|
+
"description": "Optional list of supported symbols that closely match the unresolved symbol.",
|
|
407
|
+
"items": {
|
|
408
|
+
"type": "string"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
303
413
|
}
|
|
304
414
|
}
|
|
305
415
|
}
|