-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi_schema.json
More file actions
159 lines (159 loc) · 5.22 KB
/
openapi_schema.json
File metadata and controls
159 lines (159 loc) · 5.22 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
{
"openapi": "3.1.0",
"info": {
"title": "0x API Analytics Proxy",
"description": "Secure proxy for ChatGPT to query 0x API metrics from Metabase",
"version": "1.0.0"
},
"servers": [
{
"url": "https://mb-gpt-2025-hackathon.onrender.com",
"description": "Production"
}
],
"paths": {
"/answer": {
"post": {
"summary": "Query Metabase Data",
"description": "Execute an allowlisted Metabase query with optional parameters",
"operationId": "queryMetabase",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnswerReq"
},
"examples": {
"llm_totals": {
"summary": "0x API Monthly Totals",
"value": {
"question": "llm_totals"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response with query results",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AnswerResp"
}
}
}
},
"401": {
"description": "Unauthorized - invalid bearer token"
},
"400": {
"description": "Bad request - invalid parameters or question name"
},
"500": {
"description": "Server error - Metabase connection or query error"
}
},
"security": [
{
"BearerAuth": []
}
]
}
}
},
"components": {
"schemas": {
"AnswerReq": {
"type": "object",
"required": ["question"],
"properties": {
"question": {
"type": "string",
"enum": ["llm_totals"],
"description": "The name of the allowlisted Metabase query to execute. Use 'llm_totals' to retrieve all 0x API metrics (no parameters required)."
}
}
},
"AnswerResp": {
"type": "object",
"required": ["summary", "columns", "rows"],
"properties": {
"summary": {
"type": "string",
"description": "Human-readable summary of the query results",
"example": "Returned 12 months of data with 33 metrics including volume, fees, margin, transaction counts across API, Swap, RFQ, Gasless, and Matcha products."
},
"columns": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of column names from the query results",
"example": ["timestamp", "volume", "fees", "margin", "api_txs", "swap_volume", "swap_fees", "rfq_volume", "rfq_fees", "gasless_volume", "matcha_volume"]
},
"rows": {
"type": "array",
"items": {
"type": "array",
"items": {}
},
"description": "Array of data rows, each row is an array of values corresponding to columns",
"example": [
["2025-09-01", 4768076878.66, 1145587.23, 2.40, 18019020, 370213255.87, 295505.80, 345748030.35, 244450.08, 275850244.76, 991447970.90]
]
},
"truncated": {
"type": "boolean",
"description": "Whether the results were truncated due to row limit",
"example": false,
"default": false
},
"meta": {
"type": "object",
"description": "Metadata about the query execution and current date context",
"properties": {
"card_id": {
"type": "integer",
"description": "The Metabase card ID that was queried"
},
"cached": {
"type": "boolean",
"description": "Whether this response was served from cache"
},
"query_date": {
"type": "string",
"description": "Current date when the query was executed (YYYY-MM-DD)",
"example": "2025-10-14"
},
"query_time_utc": {
"type": "string",
"description": "Current date and time when the query was executed (UTC)",
"example": "2025-10-14 15:30:45 UTC"
},
"current_day_of_month": {
"type": "integer",
"description": "Current day of the month (1-31). Use this to understand if monthly data is partial.",
"example": 14
},
"is_partial_month": {
"type": "boolean",
"description": "True if we're early in the month (before day 28), indicating current month data is incomplete",
"example": true
}
}
}
}
}
},
"securitySchemes": {
"BearerAuth": {
"type": "http",
"scheme": "bearer",
"description": "Bearer token authentication. Use the ACTION_BEARER token configured in your deployment."
}
}
}
}