@friggframework/core 2.0.0--canary.522.cbd3d5a.0 → 2.0.0--canary.517.35ee143.0

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.
Files changed (225) hide show
  1. package/CHANGELOG.md +67 -66
  2. package/CLAUDE.md +124 -148
  3. package/README.md +130 -165
  4. package/admin-scripts/index.js +16 -30
  5. package/admin-scripts/repositories/{admin-api-key-repository-documentdb.js → admin-process-repository-documentdb.js} +5 -5
  6. package/admin-scripts/repositories/{admin-api-key-repository-factory.js → admin-process-repository-factory.js} +15 -19
  7. package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
  8. package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
  9. package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
  10. package/admin-scripts/repositories/script-schedule-repository-factory.js +2 -6
  11. package/admin-scripts/repositories/script-schedule-repository-interface.js +14 -36
  12. package/admin-scripts/repositories/script-schedule-repository-mongo.js +13 -25
  13. package/admin-scripts/repositories/script-schedule-repository-postgres.js +13 -25
  14. package/application/commands/admin-script-commands.js +102 -266
  15. package/application/commands/integration-commands.js +6 -12
  16. package/application/index.js +3 -1
  17. package/assertions/get.js +4 -1
  18. package/associations/association.js +57 -59
  19. package/associations/model.js +41 -41
  20. package/core/CLAUDE.md +156 -222
  21. package/core/Worker.js +1 -5
  22. package/credential/repositories/credential-repository-documentdb.js +1 -71
  23. package/credential/repositories/credential-repository-interface.js +2 -8
  24. package/credential/repositories/credential-repository-mongo.js +4 -45
  25. package/credential/repositories/credential-repository-postgres.js +3 -44
  26. package/credential/repositories/credential-repository.js +4 -6
  27. package/credential/use-cases/get-credential-for-user.js +3 -21
  28. package/credential/use-cases/update-authentication-status.js +2 -5
  29. package/database/MONGODB_TRANSACTION_FIX.md +52 -72
  30. package/database/adapters/lambda-invoker.js +7 -8
  31. package/database/config.js +13 -15
  32. package/database/documentdb-encryption-service.js +13 -29
  33. package/database/documentdb-utils.js +12 -21
  34. package/database/encryption/README.md +36 -53
  35. package/database/encryption/encryption-schema-registry.js +9 -21
  36. package/database/encryption/field-encryption-service.js +4 -15
  37. package/database/encryption/logger.js +2 -3
  38. package/database/encryption/prisma-encryption-extension.js +8 -5
  39. package/database/index.js +2 -4
  40. package/database/models/IndividualUser.js +15 -15
  41. package/database/models/OrganizationUser.js +4 -6
  42. package/database/models/UserModel.js +2 -2
  43. package/database/models/WebsocketConnection.js +1 -4
  44. package/database/mongoose.js +2 -2
  45. package/database/prisma.js +14 -22
  46. package/database/repositories/health-check-repository-documentdb.js +7 -22
  47. package/database/repositories/health-check-repository-factory.js +3 -9
  48. package/database/repositories/health-check-repository-interface.js +5 -15
  49. package/database/repositories/health-check-repository-mongodb.js +6 -9
  50. package/database/repositories/health-check-repository-postgres.js +1 -1
  51. package/database/repositories/migration-status-repository-s3.js +5 -10
  52. package/database/use-cases/check-database-health-use-case.js +2 -3
  53. package/database/use-cases/check-database-state-use-case.js +7 -9
  54. package/database/use-cases/get-database-state-via-worker-use-case.js +12 -15
  55. package/database/use-cases/get-migration-status-use-case.js +2 -4
  56. package/database/use-cases/run-database-migration-use-case.js +9 -41
  57. package/database/use-cases/test-encryption-use-case.js +5 -4
  58. package/database/use-cases/trigger-database-migration-use-case.js +8 -9
  59. package/database/utils/mongodb-collection-utils.js +3 -11
  60. package/database/utils/mongodb-schema-init.js +4 -10
  61. package/database/utils/prisma-runner.js +74 -144
  62. package/database/utils/prisma-schema-parser.js +2 -2
  63. package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +80 -135
  64. package/encrypt/Cryptor.js +2 -8
  65. package/errors/fetch-error.js +1 -1
  66. package/generated/prisma-mongodb/edge.js +16 -59
  67. package/generated/prisma-mongodb/index-browser.js +12 -62
  68. package/generated/prisma-mongodb/index.d.ts +4850 -8136
  69. package/generated/prisma-mongodb/index.js +16 -59
  70. package/generated/prisma-mongodb/package.json +1 -1
  71. package/generated/prisma-mongodb/schema.prisma +33 -75
  72. package/generated/prisma-mongodb/wasm.js +16 -59
  73. package/generated/prisma-postgresql/edge.js +15 -59
  74. package/generated/prisma-postgresql/index-browser.js +11 -62
  75. package/generated/prisma-postgresql/index.d.ts +5963 -8930
  76. package/generated/prisma-postgresql/index.js +15 -59
  77. package/generated/prisma-postgresql/package.json +1 -1
  78. package/generated/prisma-postgresql/schema.prisma +33 -73
  79. package/generated/prisma-postgresql/wasm.js +15 -59
  80. package/handlers/WEBHOOKS.md +81 -104
  81. package/handlers/app-definition-loader.js +1 -1
  82. package/handlers/app-handler-helpers.js +2 -14
  83. package/handlers/backend-utils.js +1 -0
  84. package/handlers/database-migration-handler.js +45 -64
  85. package/handlers/middleware/admin-auth.js +53 -0
  86. package/handlers/routers/HEALTHCHECK.md +135 -170
  87. package/handlers/routers/auth.js +2 -23
  88. package/handlers/routers/db-migration.handler.js +3 -2
  89. package/handlers/routers/db-migration.js +33 -69
  90. package/handlers/routers/health.js +8 -23
  91. package/handlers/routers/integration-defined-routers.js +4 -4
  92. package/handlers/routers/integration-webhook-routers.js +7 -17
  93. package/handlers/routers/websocket.js +3 -9
  94. package/handlers/use-cases/check-integrations-health-use-case.js +6 -13
  95. package/handlers/workers/db-migration.js +26 -54
  96. package/index.js +9 -5
  97. package/integrations/WEBHOOK-QUICKSTART.md +14 -21
  98. package/integrations/index.js +0 -4
  99. package/integrations/integration-base.js +6 -9
  100. package/integrations/integration-router.js +146 -1817
  101. package/integrations/options.js +20 -47
  102. package/integrations/repositories/integration-repository-documentdb.js +24 -53
  103. package/integrations/repositories/integration-repository-factory.js +2 -6
  104. package/integrations/repositories/integration-repository-interface.js +9 -27
  105. package/integrations/repositories/integration-repository-postgres.js +3 -3
  106. package/integrations/repositories/process-repository-factory.js +1 -0
  107. package/integrations/repositories/process-repository-interface.js +5 -9
  108. package/integrations/repositories/process-repository-mongo.js +3 -7
  109. package/integrations/repositories/process-repository-postgres.js +2 -2
  110. package/integrations/tests/doubles/config-capturing-integration.js +8 -9
  111. package/integrations/tests/doubles/dummy-integration-class.js +8 -81
  112. package/integrations/tests/doubles/test-integration-repository.js +11 -51
  113. package/integrations/use-cases/create-integration.js +32 -36
  114. package/integrations/use-cases/create-process.js +9 -20
  115. package/integrations/use-cases/delete-integration-for-user.js +4 -5
  116. package/integrations/use-cases/get-integration-for-user.js +10 -25
  117. package/integrations/use-cases/get-integration-instance-by-definition.js +7 -13
  118. package/integrations/use-cases/get-integrations-for-user.js +1 -4
  119. package/integrations/use-cases/get-possible-integrations.js +1 -1
  120. package/integrations/use-cases/get-process.js +6 -5
  121. package/integrations/use-cases/index.js +1 -3
  122. package/integrations/use-cases/load-integration-context.js +5 -1
  123. package/integrations/use-cases/update-process-state.js +8 -10
  124. package/integrations/utils/map-integration-dto.js +3 -9
  125. package/jest-setup.js +1 -1
  126. package/jest-teardown.js +1 -1
  127. package/lambda/TimeoutCatcher.js +30 -32
  128. package/lambda/index.js +1 -1
  129. package/logs/index.js +3 -3
  130. package/modules/module.js +1 -3
  131. package/modules/repositories/module-repository-documentdb.js +48 -114
  132. package/modules/repositories/module-repository-interface.js +0 -13
  133. package/modules/repositories/module-repository-mongo.js +6 -46
  134. package/modules/repositories/module-repository-postgres.js +6 -48
  135. package/modules/repositories/module-repository.js +1 -34
  136. package/modules/requester/api-key.js +2 -0
  137. package/modules/requester/basic.js +1 -0
  138. package/modules/requester/oauth-2.js +2 -3
  139. package/modules/test/mock-api/definition.js +10 -15
  140. package/modules/test/mock-api/mocks/hubspot.js +36 -36
  141. package/modules/tests/doubles/test-module-factory.js +4 -10
  142. package/modules/tests/doubles/test-module-repository.js +1 -1
  143. package/modules/use-cases/get-entities-for-user.js +1 -1
  144. package/modules/use-cases/get-entity-options-by-id.js +6 -8
  145. package/modules/use-cases/get-module.js +9 -12
  146. package/modules/use-cases/process-authorization-callback.js +6 -12
  147. package/modules/use-cases/refresh-entity-options.js +6 -8
  148. package/modules/use-cases/test-module-auth.js +6 -8
  149. package/modules/utils/map-module-dto.js +2 -2
  150. package/package.json +5 -7
  151. package/prisma-mongodb/schema.prisma +33 -75
  152. package/prisma-postgresql/schema.prisma +33 -73
  153. package/queues/queuer-util.js +1 -5
  154. package/syncs/model.js +51 -51
  155. package/syncs/repositories/sync-repository-documentdb.js +19 -39
  156. package/syncs/repositories/sync-repository-interface.js +2 -6
  157. package/syncs/repositories/sync-repository-postgres.js +13 -19
  158. package/syncs/sync.js +100 -104
  159. package/token/repositories/token-repository-factory.js +3 -1
  160. package/types/assertions/index.d.ts +72 -72
  161. package/types/associations/index.d.ts +57 -57
  162. package/types/core/index.d.ts +53 -59
  163. package/types/database/index.d.ts +2 -2
  164. package/types/encrypt/index.d.ts +3 -3
  165. package/types/errors/index.d.ts +54 -61
  166. package/types/eslint-config/index.d.ts +40 -40
  167. package/types/integrations/index.d.ts +183 -185
  168. package/types/lambda/index.d.ts +26 -26
  169. package/types/logs/index.d.ts +4 -4
  170. package/types/module-plugin/index.d.ts +237 -239
  171. package/types/prettier-config/index.d.ts +5 -5
  172. package/types/syncs/index.d.ts +108 -102
  173. package/types/test-environment/index.d.ts +14 -14
  174. package/types/tsconfig.json +93 -95
  175. package/user/tests/doubles/test-user-repository.js +2 -5
  176. package/user/use-cases/authenticate-user.js +4 -2
  177. package/user/use-cases/authenticate-with-shared-secret.js +1 -1
  178. package/user/use-cases/create-individual-user.js +7 -8
  179. package/user/use-cases/create-organization-user.js +1 -1
  180. package/user/use-cases/create-token-for-user-id.js +1 -1
  181. package/user/use-cases/get-user-from-adopter-jwt.js +2 -0
  182. package/user/use-cases/get-user-from-bearer-token.js +3 -7
  183. package/user/use-cases/get-user-from-x-frigg-headers.js +11 -14
  184. package/user/use-cases/login-user.js +8 -8
  185. package/user/user.js +4 -18
  186. package/utils/backend-path.js +2 -2
  187. package/utils/index.js +1 -4
  188. package/websocket/repositories/websocket-connection-repository-documentdb.js +8 -21
  189. package/websocket/repositories/websocket-connection-repository-mongo.js +4 -8
  190. package/websocket/repositories/websocket-connection-repository-postgres.js +4 -8
  191. package/websocket/repositories/websocket-connection-repository.js +4 -8
  192. package/admin-scripts/repositories/admin-api-key-repository-interface.js +0 -121
  193. package/admin-scripts/repositories/admin-api-key-repository-mongo.js +0 -155
  194. package/admin-scripts/repositories/admin-api-key-repository-postgres.js +0 -189
  195. package/admin-scripts/repositories/script-execution-repository-documentdb.js +0 -21
  196. package/admin-scripts/repositories/script-execution-repository-factory.js +0 -55
  197. package/admin-scripts/repositories/script-execution-repository-interface.js +0 -193
  198. package/admin-scripts/repositories/script-execution-repository-mongo.js +0 -278
  199. package/admin-scripts/repositories/script-execution-repository-postgres.js +0 -320
  200. package/credential/credential-router.js +0 -262
  201. package/credential/use-cases/delete-credential-for-user.js +0 -50
  202. package/credential/use-cases/list-credentials-for-user.js +0 -31
  203. package/credential/use-cases/reauthorize-credential.js +0 -103
  204. package/handlers/routers/admin.js +0 -450
  205. package/handlers/routers/docs.js +0 -180
  206. package/handlers/routers/middleware/loadUser.js +0 -39
  207. package/handlers/routers/middleware/requireAdmin.js +0 -41
  208. package/handlers/routers/middleware/requireLoggedInUser.js +0 -19
  209. package/integrations/use-cases/execute-proxy-request.js +0 -564
  210. package/modules/domain/entities/AuthorizationSession.js +0 -131
  211. package/modules/domain/entities/index.js +0 -10
  212. package/modules/repositories/authorization-session-repository-factory.js +0 -55
  213. package/modules/repositories/authorization-session-repository-interface.js +0 -75
  214. package/modules/repositories/authorization-session-repository-mongo.js +0 -169
  215. package/modules/repositories/authorization-session-repository-postgres.js +0 -170
  216. package/modules/use-cases/delete-module-entity.js +0 -23
  217. package/modules/use-cases/get-authorization-requirements.js +0 -110
  218. package/modules/use-cases/get-module-entity-by-id.js +0 -16
  219. package/modules/use-cases/process-authorization-step.js +0 -160
  220. package/modules/use-cases/start-authorization-session.js +0 -86
  221. package/modules/use-cases/update-module-entity.js +0 -27
  222. package/openapi/openapi-spec-generator.js +0 -370
  223. package/openapi/openapi-v1.yaml +0 -1360
  224. package/openapi/openapi-v2.yaml +0 -1535
  225. package/user/use-cases/delete-user.js +0 -47
@@ -1,1535 +0,0 @@
1
- openapi: 3.0.3
2
- info:
3
- title: Frigg Framework API (v2)
4
- version: 2.0.0
5
- description: |
6
- Enterprise-grade serverless integration framework API for managing integrations,
7
- entities, credentials, and proxying requests to external systems.
8
-
9
- ## API Version: v2 (Current)
10
-
11
- This is the **v2 API** with clean, well-separated endpoints and response structures.
12
- All v2 endpoints are prefixed with `/api/v2/`.
13
-
14
- ### Key v2 Improvements
15
-
16
- - **Clean responses**: Each endpoint returns only the relevant data
17
- - **Separation of concerns**: Integrations, entities, and options are separate endpoints
18
- - **Consistent structure**: All list endpoints return `{ <resource>: [...] }`
19
- - **Better REST semantics**: Resources are properly organized
20
-
21
- ### Migration from v1
22
-
23
- | v1 Endpoint | v2 Equivalent | Change |
24
- |-------------|---------------|--------|
25
- | `GET /api/integrations` (combined) | `GET /api/v2/integrations` | Returns only `{ integrations }` |
26
- | (from v1 combined response) | `GET /api/v2/integrations/options` | Separate endpoint for options |
27
- | (from v1 combined response) | `GET /api/v2/entities` | Separate endpoint for entities |
28
-
29
- ## Overview
30
- The Frigg Framework enables direct/native integrations between products and external
31
- software partners through a standardized API that handles authentication, authorization,
32
- and data synchronization.
33
-
34
- ## Key Concepts
35
- - **Entities**: Connected accounts representing external integrations (e.g., a HubSpot account)
36
- - **Credentials**: Authentication data for external systems (OAuth tokens, API keys)
37
- - **Integrations**: Configured bidirectional sync relationships between entities
38
- - **Proxy**: Secure API forwarding to external systems using stored credentials
39
-
40
- ## Authentication
41
- All API endpoints require Bearer token authentication unless otherwise noted.
42
- contact:
43
- name: Frigg Framework
44
- url: https://friggframework.org
45
- license:
46
- name: MIT
47
-
48
- servers:
49
- - url: http://localhost:3000
50
- description: Local development server
51
- - url: https://api.{stage}.friggframework.org
52
- description: Production environments
53
- variables:
54
- stage:
55
- default: prod
56
- enum:
57
- - dev
58
- - staging
59
- - prod
60
-
61
- security:
62
- - bearerAuth: []
63
-
64
- tags:
65
- - name: Integrations
66
- description: Integration configuration and management
67
- - name: Authorization
68
- description: OAuth and authentication flows for connecting external systems
69
- - name: Entities
70
- description: Connected accounts and entity management
71
- - name: Credentials
72
- description: Credential management and reauthorization
73
- - name: Health
74
- description: Service health and readiness checks
75
-
76
- paths:
77
- # Integration Endpoints (v2 clean response)
78
- /api/v2/integrations:
79
- get:
80
- tags:
81
- - Integrations
82
- summary: List user's integrations
83
- description: |
84
- Retrieve all integrations owned by the authenticated user.
85
-
86
- **v2 Response Format**: Returns only the integrations array.
87
- For integration options, use `GET /api/v2/integrations/options`.
88
- For authorized entities, use `GET /api/v2/entities`.
89
- operationId: listIntegrationsV2
90
- responses:
91
- '200':
92
- description: List of integrations
93
- content:
94
- application/json:
95
- schema:
96
- $ref: '#/components/schemas/ListIntegrationsResponse'
97
- example:
98
- integrations:
99
- - id: int-456
100
- userId: user-789
101
- config:
102
- type: hubspot-salesforce
103
- status: ENABLED
104
- entities:
105
- - entity-123
106
- - entity-456
107
- dateCreated: '2024-01-15T10:30:00Z'
108
- dateUpdated: '2024-01-15T10:30:00Z'
109
- '401':
110
- $ref: '#/components/responses/Unauthorized'
111
-
112
- post:
113
- tags:
114
- - Integrations
115
- summary: Create integration
116
- description: Create a new integration between two or more entities
117
- operationId: createIntegrationV2
118
- requestBody:
119
- required: true
120
- content:
121
- application/json:
122
- schema:
123
- $ref: '#/components/schemas/CreateIntegrationRequest'
124
- example:
125
- entities:
126
- - entity-123
127
- - entity-456
128
- config:
129
- syncDirection: bidirectional
130
- syncInterval: 3600
131
- responses:
132
- '201':
133
- description: Integration created successfully
134
- content:
135
- application/json:
136
- schema:
137
- $ref: '#/components/schemas/Integration'
138
- '400':
139
- $ref: '#/components/responses/BadRequest'
140
- '401':
141
- $ref: '#/components/responses/Unauthorized'
142
-
143
- /api/v2/integrations/options:
144
- get:
145
- tags:
146
- - Integrations
147
- summary: List available integration types
148
- description: |
149
- Get available integration types that can be configured.
150
- This replaces the `entities.options` field from the v1 combined response.
151
- operationId: listIntegrationOptionsV2
152
- responses:
153
- '200':
154
- description: List of available integration types
155
- content:
156
- application/json:
157
- schema:
158
- $ref: '#/components/schemas/ListIntegrationOptionsResponse'
159
- example:
160
- integrations:
161
- - type: hubspot
162
- name: HubSpot
163
- description: HubSpot CRM integration
164
- hasAuth: true
165
- modules:
166
- - name: hubspot
167
- authType: oauth2
168
- stepCount: 1
169
- - type: salesforce
170
- name: Salesforce
171
- description: Salesforce CRM integration
172
- hasAuth: true
173
- modules:
174
- - name: salesforce
175
- authType: oauth2
176
- stepCount: 1
177
- '401':
178
- $ref: '#/components/responses/Unauthorized'
179
-
180
- /api/v2/integrations/{integrationId}:
181
- get:
182
- tags:
183
- - Integrations
184
- summary: Get integration
185
- description: Retrieve detailed information about a specific integration
186
- operationId: getIntegrationV2
187
- parameters:
188
- - $ref: '#/components/parameters/IntegrationId'
189
- responses:
190
- '200':
191
- description: Integration retrieved successfully
192
- content:
193
- application/json:
194
- schema:
195
- $ref: '#/components/schemas/Integration'
196
- '401':
197
- $ref: '#/components/responses/Unauthorized'
198
- '404':
199
- $ref: '#/components/responses/NotFound'
200
-
201
- patch:
202
- tags:
203
- - Integrations
204
- summary: Update integration
205
- description: Update integration configuration
206
- operationId: updateIntegrationV2
207
- parameters:
208
- - $ref: '#/components/parameters/IntegrationId'
209
- requestBody:
210
- required: true
211
- content:
212
- application/json:
213
- schema:
214
- $ref: '#/components/schemas/UpdateIntegrationRequest'
215
- responses:
216
- '200':
217
- description: Integration updated successfully
218
- content:
219
- application/json:
220
- schema:
221
- $ref: '#/components/schemas/Integration'
222
- '400':
223
- $ref: '#/components/responses/BadRequest'
224
- '401':
225
- $ref: '#/components/responses/Unauthorized'
226
- '404':
227
- $ref: '#/components/responses/NotFound'
228
-
229
- delete:
230
- tags:
231
- - Integrations
232
- summary: Delete integration
233
- description: Delete an integration (entities and credentials remain)
234
- operationId: deleteIntegrationV2
235
- parameters:
236
- - $ref: '#/components/parameters/IntegrationId'
237
- responses:
238
- '200':
239
- description: Integration deleted successfully
240
- content:
241
- application/json:
242
- schema:
243
- $ref: '#/components/schemas/DeleteResponse'
244
- '401':
245
- $ref: '#/components/responses/Unauthorized'
246
- '404':
247
- $ref: '#/components/responses/NotFound'
248
-
249
- # Authorization Endpoints
250
- /api/v2/authorize:
251
- get:
252
- tags:
253
- - Authorization
254
- summary: Get authorization requirements
255
- description: |
256
- Retrieve the authentication requirements for a given module type and step.
257
- Used to start or continue a multi-step authorization flow.
258
- operationId: getAuthorizationRequirementsV2
259
- parameters:
260
- - name: moduleType
261
- in: query
262
- required: true
263
- schema:
264
- type: string
265
- description: Module type to authorize (e.g., 'hubspot', 'salesforce')
266
- - name: step
267
- in: query
268
- schema:
269
- type: integer
270
- minimum: 1
271
- default: 1
272
- description: Current step number (for multi-step flows)
273
- - name: sessionId
274
- in: query
275
- schema:
276
- type: string
277
- description: Session ID from previous step (required for step > 1)
278
- responses:
279
- '200':
280
- description: Authorization requirements retrieved successfully
281
- content:
282
- application/json:
283
- schema:
284
- $ref: '#/components/schemas/AuthorizationRequirements'
285
- example:
286
- type: oauth2
287
- step: 1
288
- totalSteps: 1
289
- isMultiStep: false
290
- data:
291
- url: https://app.hubspot.com/oauth/authorize?client_id=xxx&redirect_uri=xxx&scope=contacts
292
- scopes:
293
- - contacts
294
- - crm.objects.contacts.read
295
- '400':
296
- $ref: '#/components/responses/BadRequest'
297
- '401':
298
- $ref: '#/components/responses/Unauthorized'
299
- '404':
300
- $ref: '#/components/responses/NotFound'
301
-
302
- post:
303
- tags:
304
- - Authorization
305
- summary: Submit authorization data
306
- description: |
307
- Submit authentication data to authorize an entity. This may complete the
308
- authorization or return next step requirements for multi-step flows.
309
- operationId: submitAuthorizationV2
310
- requestBody:
311
- required: true
312
- content:
313
- application/json:
314
- schema:
315
- $ref: '#/components/schemas/AuthorizationRequest'
316
- example:
317
- moduleType: hubspot
318
- data:
319
- code: oauth_authorization_code_here
320
- redirect_uri: https://app.example.com/oauth/callback
321
- responses:
322
- '200':
323
- description: Authorization completed or next step returned
324
- content:
325
- application/json:
326
- schema:
327
- $ref: '#/components/schemas/AuthorizationResponse'
328
- '400':
329
- $ref: '#/components/responses/BadRequest'
330
- '401':
331
- $ref: '#/components/responses/Unauthorized'
332
- '422':
333
- $ref: '#/components/responses/ValidationError'
334
-
335
- # Entity Endpoints
336
- /api/v2/entities:
337
- get:
338
- tags:
339
- - Entities
340
- summary: List user's entities
341
- description: |
342
- Retrieve all entities owned by the authenticated user.
343
- This replaces the `entities.authorized` field from the v1 combined response.
344
- operationId: listEntitiesV2
345
- responses:
346
- '200':
347
- description: List of entities retrieved successfully
348
- content:
349
- application/json:
350
- schema:
351
- $ref: '#/components/schemas/ListEntitiesResponse'
352
- example:
353
- entities:
354
- - id: entity-123
355
- type: hubspot
356
- name: My HubSpot Account
357
- externalId: hub-12345
358
- credentialId: cred-abc
359
- userId: user-789
360
- dateCreated: '2024-01-15T10:30:00Z'
361
- '401':
362
- $ref: '#/components/responses/Unauthorized'
363
-
364
- post:
365
- tags:
366
- - Entities
367
- summary: Create entity from credential
368
- description: Create a new entity linked to an existing credential
369
- operationId: createEntityV2
370
- requestBody:
371
- required: true
372
- content:
373
- application/json:
374
- schema:
375
- $ref: '#/components/schemas/CreateEntityRequest'
376
- responses:
377
- '201':
378
- description: Entity created successfully
379
- content:
380
- application/json:
381
- schema:
382
- $ref: '#/components/schemas/CreateEntityResponse'
383
- '400':
384
- $ref: '#/components/responses/BadRequest'
385
- '401':
386
- $ref: '#/components/responses/Unauthorized'
387
- '422':
388
- $ref: '#/components/responses/ValidationError'
389
-
390
- /api/v2/entities/types:
391
- get:
392
- tags:
393
- - Entities
394
- summary: List available entity types
395
- description: Get a list of all available entity types (API modules) that can be integrated
396
- operationId: listEntityTypesV2
397
- responses:
398
- '200':
399
- description: List of available entity types
400
- content:
401
- application/json:
402
- schema:
403
- $ref: '#/components/schemas/ListEntityTypesResponse'
404
- example:
405
- types:
406
- - type: hubspot
407
- name: HubSpot
408
- description: HubSpot CRM and Marketing
409
- authType: oauth2
410
- isMultiStep: false
411
- stepCount: 1
412
- capabilities:
413
- - contacts
414
- - companies
415
- - deals
416
- - type: salesforce
417
- name: Salesforce
418
- description: Salesforce CRM
419
- authType: oauth2
420
- isMultiStep: false
421
- stepCount: 1
422
- '401':
423
- $ref: '#/components/responses/Unauthorized'
424
-
425
- /api/v2/entities/types/{typeName}:
426
- get:
427
- tags:
428
- - Entities
429
- summary: Get entity type metadata
430
- description: Retrieve detailed information about a specific entity type
431
- operationId: getEntityTypeV2
432
- parameters:
433
- - $ref: '#/components/parameters/TypeName'
434
- responses:
435
- '200':
436
- description: Entity type metadata retrieved successfully
437
- content:
438
- application/json:
439
- schema:
440
- $ref: '#/components/schemas/EntityType'
441
- '401':
442
- $ref: '#/components/responses/Unauthorized'
443
- '404':
444
- $ref: '#/components/responses/NotFound'
445
-
446
- /api/v2/entities/types/{typeName}/requirements:
447
- get:
448
- tags:
449
- - Entities
450
- summary: Get authentication requirements for entity type
451
- description: |
452
- Get the authentication requirements (OAuth URLs, form schemas, etc.)
453
- needed to authorize this entity type
454
- operationId: getEntityTypeRequirementsV2
455
- parameters:
456
- - $ref: '#/components/parameters/TypeName'
457
- - name: step
458
- in: query
459
- schema:
460
- type: integer
461
- minimum: 1
462
- default: 1
463
- description: Step number for multi-step auth flows
464
- responses:
465
- '200':
466
- description: Authentication requirements retrieved successfully
467
- content:
468
- application/json:
469
- schema:
470
- $ref: '#/components/schemas/AuthorizationRequirements'
471
- '401':
472
- $ref: '#/components/responses/Unauthorized'
473
- '404':
474
- $ref: '#/components/responses/NotFound'
475
-
476
- /api/v2/entities/{entityId}:
477
- get:
478
- tags:
479
- - Entities
480
- summary: Get specific entity
481
- description: Retrieve detailed information about a specific entity
482
- operationId: getEntityV2
483
- parameters:
484
- - $ref: '#/components/parameters/EntityId'
485
- responses:
486
- '200':
487
- description: Entity retrieved successfully
488
- content:
489
- application/json:
490
- schema:
491
- $ref: '#/components/schemas/Entity'
492
- '401':
493
- $ref: '#/components/responses/Unauthorized'
494
- '404':
495
- $ref: '#/components/responses/NotFound'
496
-
497
- delete:
498
- tags:
499
- - Entities
500
- summary: Delete entity
501
- description: Delete an entity (credential remains unless orphaned)
502
- operationId: deleteEntityV2
503
- parameters:
504
- - $ref: '#/components/parameters/EntityId'
505
- responses:
506
- '200':
507
- description: Entity deleted successfully
508
- content:
509
- application/json:
510
- schema:
511
- $ref: '#/components/schemas/DeleteResponse'
512
- '401':
513
- $ref: '#/components/responses/Unauthorized'
514
- '404':
515
- $ref: '#/components/responses/NotFound'
516
-
517
- /api/v2/entities/{entityId}/test-auth:
518
- get:
519
- tags:
520
- - Entities
521
- summary: Test entity authentication
522
- description: Verify that the entity's credentials are valid and working
523
- operationId: testEntityAuthV2
524
- parameters:
525
- - $ref: '#/components/parameters/EntityId'
526
- responses:
527
- '200':
528
- description: Authentication test result
529
- content:
530
- application/json:
531
- schema:
532
- $ref: '#/components/schemas/TestAuthResponse'
533
- example:
534
- valid: true
535
- message: Authentication successful
536
- '401':
537
- $ref: '#/components/responses/Unauthorized'
538
- '404':
539
- $ref: '#/components/responses/NotFound'
540
-
541
- /api/v2/entities/{entityId}/reauthorize:
542
- get:
543
- tags:
544
- - Entities
545
- summary: Get entity reauthorization requirements
546
- description: Get authentication requirements to reauthorize an existing entity
547
- operationId: getEntityReauthorizationRequirementsV2
548
- parameters:
549
- - $ref: '#/components/parameters/EntityId'
550
- - name: step
551
- in: query
552
- schema:
553
- type: integer
554
- minimum: 1
555
- default: 1
556
- responses:
557
- '200':
558
- description: Reauthorization requirements retrieved
559
- content:
560
- application/json:
561
- schema:
562
- $ref: '#/components/schemas/AuthorizationRequirements'
563
- '401':
564
- $ref: '#/components/responses/Unauthorized'
565
- '404':
566
- $ref: '#/components/responses/NotFound'
567
-
568
- post:
569
- tags:
570
- - Entities
571
- summary: Submit entity reauthorization
572
- description: Reauthorize an existing entity with new credentials
573
- operationId: reauthorizeEntityV2
574
- parameters:
575
- - $ref: '#/components/parameters/EntityId'
576
- requestBody:
577
- required: true
578
- content:
579
- application/json:
580
- schema:
581
- $ref: '#/components/schemas/ReauthorizeRequest'
582
- responses:
583
- '200':
584
- description: Reauthorization completed or next step returned
585
- content:
586
- application/json:
587
- schema:
588
- $ref: '#/components/schemas/ReauthorizeResponse'
589
- '400':
590
- $ref: '#/components/responses/BadRequest'
591
- '401':
592
- $ref: '#/components/responses/Unauthorized'
593
- '404':
594
- $ref: '#/components/responses/NotFound'
595
- '422':
596
- $ref: '#/components/responses/ValidationError'
597
-
598
- /api/v2/entities/{entityId}/proxy:
599
- post:
600
- tags:
601
- - Entities
602
- summary: Proxy API request through entity
603
- description: |
604
- Forward an API request to the external system using the entity's credentials.
605
- Automatically handles authentication headers and token refresh.
606
-
607
- **Example**: To call HubSpot's contacts API:
608
- ```json
609
- {
610
- "method": "GET",
611
- "path": "/crm/v3/objects/contacts",
612
- "query": { "limit": 10 }
613
- }
614
- ```
615
- operationId: proxyEntityRequestV2
616
- parameters:
617
- - $ref: '#/components/parameters/EntityId'
618
- requestBody:
619
- required: true
620
- content:
621
- application/json:
622
- schema:
623
- $ref: '#/components/schemas/ProxyRequest'
624
- example:
625
- method: GET
626
- path: /crm/v3/objects/contacts
627
- query:
628
- limit: 10
629
- properties: firstname,lastname,email
630
- responses:
631
- '200':
632
- description: Request proxied successfully
633
- content:
634
- application/json:
635
- schema:
636
- $ref: '#/components/schemas/ProxyResponse'
637
- '400':
638
- $ref: '#/components/responses/BadRequest'
639
- '401':
640
- $ref: '#/components/responses/Unauthorized'
641
- '404':
642
- $ref: '#/components/responses/NotFound'
643
- '502':
644
- description: Upstream API error
645
- content:
646
- application/json:
647
- schema:
648
- $ref: '#/components/schemas/ProxyErrorResponse'
649
-
650
- # Credential Endpoints
651
- /api/v2/credentials:
652
- get:
653
- tags:
654
- - Credentials
655
- summary: List user's credentials
656
- description: Retrieve all credentials owned by the authenticated user (tokens masked)
657
- operationId: listCredentialsV2
658
- responses:
659
- '200':
660
- description: List of credentials retrieved successfully
661
- content:
662
- application/json:
663
- schema:
664
- $ref: '#/components/schemas/ListCredentialsResponse'
665
- example:
666
- credentials:
667
- - id: cred-abc
668
- type: hubspot
669
- externalId: hub-12345
670
- userId: user-789
671
- entityCount: 1
672
- dateCreated: '2024-01-15T10:30:00Z'
673
- '401':
674
- $ref: '#/components/responses/Unauthorized'
675
-
676
- /api/v2/credentials/{credentialId}:
677
- get:
678
- tags:
679
- - Credentials
680
- summary: Get specific credential
681
- description: Retrieve detailed information about a specific credential (tokens masked)
682
- operationId: getCredentialV2
683
- parameters:
684
- - $ref: '#/components/parameters/CredentialId'
685
- responses:
686
- '200':
687
- description: Credential retrieved successfully
688
- content:
689
- application/json:
690
- schema:
691
- $ref: '#/components/schemas/Credential'
692
- '401':
693
- $ref: '#/components/responses/Unauthorized'
694
- '404':
695
- $ref: '#/components/responses/NotFound'
696
-
697
- delete:
698
- tags:
699
- - Credentials
700
- summary: Delete credential
701
- description: Delete a credential and all associated entities
702
- operationId: deleteCredentialV2
703
- parameters:
704
- - $ref: '#/components/parameters/CredentialId'
705
- responses:
706
- '200':
707
- description: Credential deleted successfully
708
- content:
709
- application/json:
710
- schema:
711
- $ref: '#/components/schemas/DeleteResponse'
712
- '401':
713
- $ref: '#/components/responses/Unauthorized'
714
- '404':
715
- $ref: '#/components/responses/NotFound'
716
-
717
- /api/v2/credentials/{credentialId}/reauthorize:
718
- get:
719
- tags:
720
- - Credentials
721
- summary: Get credential reauthorization requirements
722
- description: Get authentication requirements to reauthorize an existing credential
723
- operationId: getCredentialReauthorizationRequirementsV2
724
- parameters:
725
- - $ref: '#/components/parameters/CredentialId'
726
- - name: step
727
- in: query
728
- schema:
729
- type: integer
730
- minimum: 1
731
- default: 1
732
- responses:
733
- '200':
734
- description: Reauthorization requirements retrieved
735
- content:
736
- application/json:
737
- schema:
738
- $ref: '#/components/schemas/AuthorizationRequirements'
739
- '401':
740
- $ref: '#/components/responses/Unauthorized'
741
- '404':
742
- $ref: '#/components/responses/NotFound'
743
-
744
- post:
745
- tags:
746
- - Credentials
747
- summary: Submit credential reauthorization
748
- description: Reauthorize an existing credential with new authentication data
749
- operationId: reauthorizeCredentialV2
750
- parameters:
751
- - $ref: '#/components/parameters/CredentialId'
752
- requestBody:
753
- required: true
754
- content:
755
- application/json:
756
- schema:
757
- $ref: '#/components/schemas/ReauthorizeRequest'
758
- responses:
759
- '200':
760
- description: Reauthorization completed or next step returned
761
- content:
762
- application/json:
763
- schema:
764
- $ref: '#/components/schemas/ReauthorizeResponse'
765
- '400':
766
- $ref: '#/components/responses/BadRequest'
767
- '401':
768
- $ref: '#/components/responses/Unauthorized'
769
- '404':
770
- $ref: '#/components/responses/NotFound'
771
- '422':
772
- $ref: '#/components/responses/ValidationError'
773
-
774
- /api/v2/credentials/{credentialId}/proxy:
775
- post:
776
- tags:
777
- - Credentials
778
- summary: Proxy API request through credential
779
- description: |
780
- Forward an API request to the external system using this credential.
781
- Similar to entity proxy but doesn't require an entity to be created.
782
- operationId: proxyCredentialRequestV2
783
- parameters:
784
- - $ref: '#/components/parameters/CredentialId'
785
- requestBody:
786
- required: true
787
- content:
788
- application/json:
789
- schema:
790
- $ref: '#/components/schemas/ProxyRequest'
791
- responses:
792
- '200':
793
- description: Request proxied successfully
794
- content:
795
- application/json:
796
- schema:
797
- $ref: '#/components/schemas/ProxyResponse'
798
- '400':
799
- $ref: '#/components/responses/BadRequest'
800
- '401':
801
- $ref: '#/components/responses/Unauthorized'
802
- '404':
803
- $ref: '#/components/responses/NotFound'
804
- '502':
805
- description: Upstream API error
806
- content:
807
- application/json:
808
- schema:
809
- $ref: '#/components/schemas/ProxyErrorResponse'
810
-
811
- # Health Endpoints (same as v1 - not versioned)
812
- /health:
813
- get:
814
- tags:
815
- - Health
816
- summary: Basic health check
817
- description: Simple health check endpoint that returns service status
818
- operationId: healthCheck
819
- security: []
820
- responses:
821
- '200':
822
- description: Service is healthy
823
- content:
824
- application/json:
825
- schema:
826
- $ref: '#/components/schemas/HealthResponse'
827
-
828
- /health/ready:
829
- get:
830
- tags:
831
- - Health
832
- summary: Readiness check
833
- description: |
834
- Detailed readiness check that validates database connectivity,
835
- module loading, and encryption system status
836
- operationId: readinessCheck
837
- security: []
838
- responses:
839
- '200':
840
- description: Service is ready
841
- content:
842
- application/json:
843
- schema:
844
- $ref: '#/components/schemas/ReadinessResponse'
845
- '503':
846
- description: Service not ready
847
- content:
848
- application/json:
849
- schema:
850
- $ref: '#/components/schemas/ReadinessResponse'
851
-
852
- components:
853
- securitySchemes:
854
- bearerAuth:
855
- type: http
856
- scheme: bearer
857
- bearerFormat: JWT
858
- description: JWT token obtained from authentication
859
-
860
- parameters:
861
- EntityId:
862
- name: entityId
863
- in: path
864
- required: true
865
- schema:
866
- type: string
867
- description: Unique entity identifier
868
-
869
- CredentialId:
870
- name: credentialId
871
- in: path
872
- required: true
873
- schema:
874
- type: string
875
- description: Unique credential identifier
876
-
877
- IntegrationId:
878
- name: integrationId
879
- in: path
880
- required: true
881
- schema:
882
- type: string
883
- description: Unique integration identifier
884
-
885
- TypeName:
886
- name: typeName
887
- in: path
888
- required: true
889
- schema:
890
- type: string
891
- description: Entity type name (e.g., 'hubspot', 'salesforce')
892
-
893
- schemas:
894
- # v2 clean responses
895
- ListIntegrationsResponse:
896
- type: object
897
- description: |
898
- **v2 Clean Response Format**
899
-
900
- Returns only the integrations array. For integration options and entities,
901
- use the dedicated endpoints.
902
- required:
903
- - integrations
904
- properties:
905
- integrations:
906
- type: array
907
- description: User's active integrations
908
- items:
909
- $ref: '#/components/schemas/Integration'
910
-
911
- ListIntegrationOptionsResponse:
912
- type: object
913
- required:
914
- - integrations
915
- properties:
916
- integrations:
917
- type: array
918
- items:
919
- $ref: '#/components/schemas/IntegrationOption'
920
-
921
- IntegrationOption:
922
- type: object
923
- description: An available integration type
924
- required:
925
- - type
926
- - name
927
- properties:
928
- type:
929
- type: string
930
- description: Integration type identifier
931
- name:
932
- type: string
933
- description: Display name
934
- description:
935
- type: string
936
- description: Integration description
937
- hasAuth:
938
- type: boolean
939
- description: Whether this integration requires authentication
940
- modules:
941
- type: array
942
- description: List of modules included in this integration
943
- items:
944
- type: object
945
- properties:
946
- name:
947
- type: string
948
- authType:
949
- type: string
950
- enum: [oauth2, form, api-key, basic]
951
- stepCount:
952
- type: integer
953
-
954
- Integration:
955
- type: object
956
- required:
957
- - id
958
- - userId
959
- properties:
960
- id:
961
- type: string
962
- userId:
963
- type: string
964
- config:
965
- type: object
966
- description: Integration configuration
967
- status:
968
- type: string
969
- enum: [ENABLED, DISABLED, PAUSED, ERROR]
970
- entities:
971
- type: array
972
- items:
973
- type: string
974
- description: Array of entity IDs
975
- dateCreated:
976
- type: string
977
- format: date-time
978
- dateUpdated:
979
- type: string
980
- format: date-time
981
-
982
- CreateIntegrationRequest:
983
- type: object
984
- required:
985
- - entities
986
- properties:
987
- entities:
988
- type: array
989
- items:
990
- type: string
991
- description: Array of entity IDs to integrate
992
- minItems: 1
993
- config:
994
- type: object
995
- description: Integration configuration
996
-
997
- UpdateIntegrationRequest:
998
- type: object
999
- properties:
1000
- config:
1001
- type: object
1002
- enabled:
1003
- type: boolean
1004
- status:
1005
- type: string
1006
- enum: [ENABLED, DISABLED, PAUSED]
1007
-
1008
- Entity:
1009
- type: object
1010
- description: A connected account/entity representing an external integration
1011
- required:
1012
- - id
1013
- - type
1014
- properties:
1015
- id:
1016
- type: string
1017
- description: Unique entity identifier
1018
- type:
1019
- type: string
1020
- description: Module/entity type name (e.g., 'hubspot', 'salesforce')
1021
- name:
1022
- type: string
1023
- description: Display name for the entity
1024
- externalId:
1025
- type: string
1026
- description: ID from the external system (e.g., HubSpot portal ID)
1027
- credentialId:
1028
- type: string
1029
- description: ID of the linked credential
1030
- userId:
1031
- type: string
1032
- description: ID of the user who owns this entity
1033
- dateCreated:
1034
- type: string
1035
- format: date-time
1036
- dateUpdated:
1037
- type: string
1038
- format: date-time
1039
-
1040
- ListEntitiesResponse:
1041
- type: object
1042
- required:
1043
- - entities
1044
- properties:
1045
- entities:
1046
- type: array
1047
- items:
1048
- $ref: '#/components/schemas/Entity'
1049
-
1050
- CreateEntityRequest:
1051
- type: object
1052
- required:
1053
- - moduleType
1054
- - credentialId
1055
- properties:
1056
- moduleType:
1057
- type: string
1058
- description: Type of entity to create (module name)
1059
- credentialId:
1060
- type: string
1061
- description: ID of the credential to link to this entity
1062
- options:
1063
- type: object
1064
- description: Additional entity options
1065
- additionalProperties: true
1066
-
1067
- CreateEntityResponse:
1068
- type: object
1069
- required:
1070
- - entityId
1071
- - credentialId
1072
- - type
1073
- properties:
1074
- entityId:
1075
- type: string
1076
- credentialId:
1077
- type: string
1078
- type:
1079
- type: string
1080
-
1081
- EntityType:
1082
- type: object
1083
- required:
1084
- - type
1085
- - name
1086
- properties:
1087
- type:
1088
- type: string
1089
- description: Module name (e.g., 'hubspot', 'salesforce')
1090
- name:
1091
- type: string
1092
- description: Display name
1093
- description:
1094
- type: string
1095
- authType:
1096
- type: string
1097
- enum: [oauth2, form, api-key, basic]
1098
- isMultiStep:
1099
- type: boolean
1100
- stepCount:
1101
- type: integer
1102
- minimum: 1
1103
- capabilities:
1104
- type: array
1105
- items:
1106
- type: string
1107
-
1108
- ListEntityTypesResponse:
1109
- type: object
1110
- required:
1111
- - types
1112
- properties:
1113
- types:
1114
- type: array
1115
- items:
1116
- $ref: '#/components/schemas/EntityType'
1117
-
1118
- TestAuthResponse:
1119
- type: object
1120
- properties:
1121
- valid:
1122
- type: boolean
1123
- message:
1124
- type: string
1125
-
1126
- Credential:
1127
- type: object
1128
- description: A credential object (tokens are masked in responses)
1129
- required:
1130
- - id
1131
- - type
1132
- properties:
1133
- id:
1134
- type: string
1135
- type:
1136
- type: string
1137
- description: Module type (e.g., 'hubspot', 'salesforce')
1138
- externalId:
1139
- type: string
1140
- userId:
1141
- type: string
1142
- entityCount:
1143
- type: integer
1144
- description: Number of entities using this credential
1145
- dateCreated:
1146
- type: string
1147
- format: date-time
1148
- dateUpdated:
1149
- type: string
1150
- format: date-time
1151
-
1152
- ListCredentialsResponse:
1153
- type: object
1154
- required:
1155
- - credentials
1156
- properties:
1157
- credentials:
1158
- type: array
1159
- items:
1160
- $ref: '#/components/schemas/Credential'
1161
-
1162
- AuthorizationRequirements:
1163
- type: object
1164
- required:
1165
- - type
1166
- - step
1167
- - totalSteps
1168
- properties:
1169
- type:
1170
- type: string
1171
- enum: [oauth2, form, api-key, basic]
1172
- step:
1173
- type: integer
1174
- minimum: 1
1175
- totalSteps:
1176
- type: integer
1177
- minimum: 1
1178
- isMultiStep:
1179
- type: boolean
1180
- sessionId:
1181
- type: string
1182
- data:
1183
- oneOf:
1184
- - $ref: '#/components/schemas/OAuth2Requirements'
1185
- - $ref: '#/components/schemas/FormRequirements'
1186
- - $ref: '#/components/schemas/ApiKeyRequirements'
1187
-
1188
- OAuth2Requirements:
1189
- type: object
1190
- required:
1191
- - url
1192
- properties:
1193
- url:
1194
- type: string
1195
- format: uri
1196
- description: OAuth2 authorization URL
1197
- scopes:
1198
- type: array
1199
- items:
1200
- type: string
1201
-
1202
- FormRequirements:
1203
- type: object
1204
- required:
1205
- - jsonSchema
1206
- properties:
1207
- jsonSchema:
1208
- type: object
1209
- description: JSON Schema for form fields
1210
- uiSchema:
1211
- type: object
1212
- description: UI hints for form rendering
1213
-
1214
- ApiKeyRequirements:
1215
- type: object
1216
- required:
1217
- - fields
1218
- properties:
1219
- fields:
1220
- type: array
1221
- items:
1222
- type: object
1223
- properties:
1224
- name:
1225
- type: string
1226
- type:
1227
- type: string
1228
- enum: [api_key, secret, token]
1229
- label:
1230
- type: string
1231
- required:
1232
- type: boolean
1233
-
1234
- AuthorizationRequest:
1235
- type: object
1236
- required:
1237
- - moduleType
1238
- properties:
1239
- moduleType:
1240
- type: string
1241
- description: Module type to authorize
1242
- data:
1243
- type: object
1244
- description: Authentication data (OAuth code, form fields, API keys)
1245
- additionalProperties: true
1246
- step:
1247
- type: integer
1248
- minimum: 1
1249
- default: 1
1250
- sessionId:
1251
- type: string
1252
-
1253
- AuthorizationResponse:
1254
- oneOf:
1255
- - $ref: '#/components/schemas/AuthorizationSuccess'
1256
- - $ref: '#/components/schemas/AuthorizationNextStep'
1257
-
1258
- AuthorizationSuccess:
1259
- type: object
1260
- required:
1261
- - entityId
1262
- - credentialId
1263
- - type
1264
- properties:
1265
- entityId:
1266
- type: string
1267
- credentialId:
1268
- type: string
1269
- type:
1270
- type: string
1271
- name:
1272
- type: string
1273
- description: Display name of the connected account
1274
-
1275
- AuthorizationNextStep:
1276
- type: object
1277
- required:
1278
- - nextStep
1279
- - sessionId
1280
- - requirements
1281
- properties:
1282
- nextStep:
1283
- type: integer
1284
- minimum: 2
1285
- sessionId:
1286
- type: string
1287
- requirements:
1288
- $ref: '#/components/schemas/AuthorizationRequirements'
1289
- message:
1290
- type: string
1291
-
1292
- ReauthorizeRequest:
1293
- type: object
1294
- required:
1295
- - data
1296
- properties:
1297
- data:
1298
- type: object
1299
- additionalProperties: true
1300
- step:
1301
- type: integer
1302
- minimum: 1
1303
- default: 1
1304
- sessionId:
1305
- type: string
1306
-
1307
- ReauthorizeResponse:
1308
- oneOf:
1309
- - $ref: '#/components/schemas/ReauthorizeSuccess'
1310
- - $ref: '#/components/schemas/ReauthorizeNextStep'
1311
-
1312
- ReauthorizeSuccess:
1313
- type: object
1314
- required:
1315
- - success
1316
- - credentialId
1317
- properties:
1318
- success:
1319
- type: boolean
1320
- credentialId:
1321
- type: string
1322
- entityId:
1323
- type: string
1324
- message:
1325
- type: string
1326
-
1327
- ReauthorizeNextStep:
1328
- type: object
1329
- required:
1330
- - step
1331
- - totalSteps
1332
- - sessionId
1333
- - requirements
1334
- properties:
1335
- step:
1336
- type: integer
1337
- totalSteps:
1338
- type: integer
1339
- sessionId:
1340
- type: string
1341
- requirements:
1342
- type: object
1343
-
1344
- ProxyRequest:
1345
- type: object
1346
- required:
1347
- - method
1348
- - path
1349
- properties:
1350
- method:
1351
- type: string
1352
- enum: [GET, POST, PUT, PATCH, DELETE]
1353
- description: HTTP method for the upstream request
1354
- path:
1355
- type: string
1356
- pattern: ^/
1357
- description: API path on the upstream service
1358
- query:
1359
- type: object
1360
- description: Query parameters
1361
- additionalProperties: true
1362
- headers:
1363
- type: object
1364
- description: Additional headers (auth added automatically)
1365
- additionalProperties:
1366
- type: string
1367
- body:
1368
- description: Request body for POST/PUT/PATCH
1369
- oneOf:
1370
- - type: object
1371
- - type: array
1372
- - type: string
1373
- - type: 'null'
1374
-
1375
- ProxyResponse:
1376
- type: object
1377
- required:
1378
- - success
1379
- - status
1380
- - data
1381
- properties:
1382
- success:
1383
- type: boolean
1384
- status:
1385
- type: integer
1386
- description: HTTP status from upstream
1387
- headers:
1388
- type: object
1389
- additionalProperties:
1390
- type: string
1391
- data:
1392
- description: Response body from upstream API
1393
-
1394
- ProxyErrorResponse:
1395
- type: object
1396
- required:
1397
- - success
1398
- - status
1399
- - error
1400
- properties:
1401
- success:
1402
- type: boolean
1403
- enum: [false]
1404
- status:
1405
- type: integer
1406
- error:
1407
- type: object
1408
- required:
1409
- - code
1410
- - message
1411
- properties:
1412
- code:
1413
- type: string
1414
- enum:
1415
- - INVALID_AUTH
1416
- - EXPIRED_TOKEN
1417
- - UPSTREAM_ERROR
1418
- - TIMEOUT
1419
- - NETWORK_ERROR
1420
- - RATE_LIMITED
1421
- - INVALID_REQUEST
1422
- - NOT_FOUND
1423
- - PERMISSION_DENIED
1424
- message:
1425
- type: string
1426
- details:
1427
- type: object
1428
- upstreamStatus:
1429
- type: integer
1430
-
1431
- DeleteResponse:
1432
- type: object
1433
- required:
1434
- - success
1435
- properties:
1436
- success:
1437
- type: boolean
1438
- message:
1439
- type: string
1440
-
1441
- HealthResponse:
1442
- type: object
1443
- properties:
1444
- status:
1445
- type: string
1446
- example: ok
1447
- timestamp:
1448
- type: string
1449
- format: date-time
1450
-
1451
- ReadinessResponse:
1452
- type: object
1453
- properties:
1454
- ready:
1455
- type: boolean
1456
- timestamp:
1457
- type: string
1458
- format: date-time
1459
- checks:
1460
- type: object
1461
- properties:
1462
- database:
1463
- type: boolean
1464
- modules:
1465
- type: boolean
1466
- encryption:
1467
- type: object
1468
- properties:
1469
- status:
1470
- type: string
1471
- testResult:
1472
- type: string
1473
-
1474
- Error:
1475
- type: object
1476
- required:
1477
- - error
1478
- properties:
1479
- error:
1480
- type: object
1481
- required:
1482
- - code
1483
- - message
1484
- properties:
1485
- code:
1486
- type: string
1487
- message:
1488
- type: string
1489
- details:
1490
- type: object
1491
-
1492
- responses:
1493
- BadRequest:
1494
- description: Bad request - invalid input
1495
- content:
1496
- application/json:
1497
- schema:
1498
- $ref: '#/components/schemas/Error'
1499
- example:
1500
- error:
1501
- code: BAD_REQUEST
1502
- message: Invalid request parameters
1503
-
1504
- Unauthorized:
1505
- description: Unauthorized - missing or invalid authentication
1506
- content:
1507
- application/json:
1508
- schema:
1509
- $ref: '#/components/schemas/Error'
1510
- example:
1511
- error:
1512
- code: UNAUTHORIZED
1513
- message: Authentication required
1514
-
1515
- NotFound:
1516
- description: Resource not found
1517
- content:
1518
- application/json:
1519
- schema:
1520
- $ref: '#/components/schemas/Error'
1521
- example:
1522
- error:
1523
- code: NOT_FOUND
1524
- message: Resource not found
1525
-
1526
- ValidationError:
1527
- description: Validation error - invalid data
1528
- content:
1529
- application/json:
1530
- schema:
1531
- $ref: '#/components/schemas/Error'
1532
- example:
1533
- error:
1534
- code: VALIDATION_ERROR
1535
- message: Data validation failed