1
0

openapi.yaml 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836
  1. openapi: '3.0.3'
  2. info:
  3. title: IRDB — IP Reputation Database
  4. version: '1.0.0'
  5. description: |
  6. Self-hosted IP reputation service: ingest abuse reports, distribute tailored block lists.
  7. ## Versioning
  8. Single major version `v1`. Changes within `v1` are additive only — new endpoints, new optional fields, new optional query params. Breaking changes ship as `v2`.
  9. ## Endpoint groups
  10. - **Public**: machine clients (reporters, consumers).
  11. - **Admin**: UI BFF + admin-kind tokens. RBAC enforced server-side.
  12. - **Auth**: UI BFF only — bridges browser auth to user records. Marked `x-internal: true`.
  13. - **Internal jobs**: not in this spec. Scheduler-only, network-restricted.
  14. ## Authentication
  15. Bearer token in the `Authorization` header. Four token kinds: `reporter`, `consumer`, `admin`, `service`. See `doc/auth-flows.md`.
  16. ## Errors
  17. Uniform envelope: `{"error":"<code>","details":{...}}`. Validation errors include `details`. Authentication failures return `401` `unauthorized`. Authorization failures return `403`.
  18. ## Rate limiting
  19. Public endpoints: 60 req/s/token (configurable). On exhaustion: `429` with `Retry-After: 1`.
  20. license:
  21. name: TBD
  22. servers:
  23. - url: http://localhost:8081
  24. description: Default compose deployment
  25. - url: https://reputation-api.example.com
  26. description: Production (replace hostname)
  27. tags:
  28. - name: Public
  29. description: 'Machine clients: reporters and blocklist consumers.'
  30. - name: Admin
  31. description: UI BFF + admin-kind tokens.
  32. - name: Auth
  33. description: UI BFF only. Service token required, no impersonation.
  34. security:
  35. - BearerAuth: []
  36. paths:
  37. '/api/v1/report':
  38. post:
  39. tags:
  40. - Public
  41. summary: Submit an abuse report
  42. description: |
  43. Token kind: `reporter`. Rate limit: 60 req/s per token (configurable).
  44. Returns `202 Accepted` on success.
  45. security:
  46. - BearerAuth: []
  47. requestBody:
  48. required: true
  49. content:
  50. 'application/json':
  51. schema:
  52. '$ref': '#/components/schemas/ReportRequest'
  53. responses:
  54. '202':
  55. description: Report accepted
  56. content:
  57. 'application/json':
  58. schema:
  59. '$ref': '#/components/schemas/ReportResponse'
  60. '400':
  61. description: Validation failed
  62. content:
  63. 'application/json':
  64. schema:
  65. '$ref': '#/components/schemas/Error'
  66. '401':
  67. description: Bad / wrong-kind token
  68. content:
  69. 'application/json':
  70. schema:
  71. '$ref': '#/components/schemas/Error'
  72. '429':
  73. description: Rate limited
  74. headers:
  75. Retry-After:
  76. schema:
  77. type: integer
  78. description: Seconds to wait before retrying.
  79. content:
  80. 'application/json':
  81. schema:
  82. '$ref': '#/components/schemas/Error'
  83. '/api/v1/blocklist':
  84. get:
  85. tags:
  86. - Public
  87. summary: Pull a tailored blocklist
  88. description: |
  89. Token kind: `consumer`. The consumer's bound policy decides which IPs/CIDRs land in the output.
  90. Cached internally for 30 s per consumer. Honour `If-None-Match` to skip retransfer.
  91. `?format=json` returns structured rows; default is `text/plain`, one entry per line.
  92. security:
  93. - BearerAuth: []
  94. parameters:
  95. - name: format
  96. in: query
  97. schema:
  98. type: string
  99. enum:
  100. - text
  101. - json
  102. default: text
  103. - name: If-None-Match
  104. in: header
  105. schema:
  106. type: string
  107. responses:
  108. '200':
  109. description: Current blocklist
  110. headers:
  111. ETag:
  112. schema:
  113. type: string
  114. X-Blocklist-Generated-At:
  115. schema:
  116. type: string
  117. format: date-time
  118. X-Blocklist-Entries:
  119. schema:
  120. type: integer
  121. X-Blocklist-Policy:
  122. schema:
  123. type: string
  124. content:
  125. 'text/plain':
  126. schema:
  127. type: string
  128. example: |
  129. 203.0.113.42
  130. 198.51.100.0/24
  131. 'application/json':
  132. schema:
  133. '$ref': '#/components/schemas/BlocklistJson'
  134. '304':
  135. description: Not modified — body matches `If-None-Match`
  136. '401':
  137. description: Bad / wrong-kind token
  138. '/api/v1/admin/me':
  139. get:
  140. tags:
  141. - Admin
  142. summary: Current acting identity
  143. security:
  144. - BearerAuth: []
  145. parameters:
  146. - '$ref': '#/components/parameters/ActingUserId'
  147. responses:
  148. '200':
  149. description: Identity info
  150. content:
  151. 'application/json':
  152. schema:
  153. '$ref': '#/components/schemas/User'
  154. '/api/v1/admin/ips':
  155. get:
  156. tags:
  157. - Admin
  158. summary: Search IPs
  159. security:
  160. - BearerAuth: []
  161. parameters:
  162. - '$ref': '#/components/parameters/ActingUserId'
  163. - name: q
  164. in: query
  165. schema:
  166. type: string
  167. - name: category
  168. in: query
  169. schema:
  170. type: string
  171. - name: min_score
  172. in: query
  173. schema:
  174. type: number
  175. format: float
  176. - name: max_score
  177. in: query
  178. schema:
  179. type: number
  180. format: float
  181. - name: country
  182. in: query
  183. schema:
  184. type: string
  185. - name: asn
  186. in: query
  187. schema:
  188. type: integer
  189. - name: status
  190. in: query
  191. schema:
  192. type: string
  193. enum:
  194. - scored
  195. - manual
  196. - allowlisted
  197. - clean
  198. - '$ref': '#/components/parameters/Page'
  199. - '$ref': '#/components/parameters/PageSize'
  200. responses:
  201. '200':
  202. description: Page of IPs
  203. content:
  204. 'application/json':
  205. schema:
  206. type: object
  207. properties:
  208. page:
  209. type: integer
  210. minimum: 1
  211. example: 1
  212. page_size:
  213. type: integer
  214. minimum: 1
  215. maximum: 200
  216. example: 50
  217. total:
  218. type: integer
  219. minimum: 0
  220. example: 1284
  221. items:
  222. type: array
  223. items:
  224. type: object
  225. '/api/v1/admin/ips/countries':
  226. get:
  227. tags:
  228. - Admin
  229. summary: Country code dropdown source
  230. security:
  231. - BearerAuth: []
  232. parameters:
  233. - '$ref': '#/components/parameters/ActingUserId'
  234. responses:
  235. '200':
  236. description: '`[{code, count}]`'
  237. content:
  238. 'application/json':
  239. schema:
  240. type: object
  241. properties:
  242. items:
  243. type: array
  244. items:
  245. type: object
  246. properties:
  247. code:
  248. type: string
  249. count:
  250. type: integer
  251. '/api/v1/admin/ips/{ip}':
  252. get:
  253. tags:
  254. - Admin
  255. summary: IP detail
  256. security:
  257. - BearerAuth: []
  258. parameters:
  259. - '$ref': '#/components/parameters/ActingUserId'
  260. - name: ip
  261. in: path
  262. required: true
  263. schema:
  264. type: string
  265. responses:
  266. '200':
  267. description: IP detail
  268. content:
  269. 'application/json':
  270. schema:
  271. '$ref': '#/components/schemas/IpDetail'
  272. '404':
  273. description: Invalid IP / not found
  274. '/api/v1/admin/stats/dashboard':
  275. get:
  276. tags:
  277. - Admin
  278. summary: Dashboard stats (30s cached)
  279. security:
  280. - BearerAuth: []
  281. parameters:
  282. - '$ref': '#/components/parameters/ActingUserId'
  283. responses:
  284. '200':
  285. description: Dashboard payload
  286. content:
  287. 'application/json':
  288. schema:
  289. type: object
  290. '/api/v1/admin/manual-blocks':
  291. get:
  292. tags:
  293. - Admin
  294. summary: List manual blocks
  295. security:
  296. - BearerAuth: []
  297. parameters:
  298. - '$ref': '#/components/parameters/ActingUserId'
  299. responses:
  300. '200':
  301. description: list
  302. post:
  303. tags:
  304. - Admin
  305. summary: Create manual block
  306. description: Operator+ role required. `kind=ip` requires `ip`; `kind=subnet` requires `cidr`.
  307. security:
  308. - BearerAuth: []
  309. parameters:
  310. - '$ref': '#/components/parameters/ActingUserId'
  311. requestBody:
  312. required: true
  313. content:
  314. 'application/json':
  315. schema:
  316. type: object
  317. properties:
  318. kind:
  319. type: string
  320. enum:
  321. - ip
  322. - subnet
  323. ip:
  324. type: string
  325. cidr:
  326. type: string
  327. reason:
  328. type: string
  329. expires_at:
  330. type: string
  331. format: date-time
  332. responses:
  333. '201':
  334. description: Created
  335. content:
  336. 'application/json':
  337. schema:
  338. '$ref': '#/components/schemas/ManualBlock'
  339. '/api/v1/admin/manual-blocks/{id}':
  340. get:
  341. tags:
  342. - Admin
  343. summary: Show manual block
  344. security:
  345. - BearerAuth: []
  346. parameters:
  347. - '$ref': '#/components/parameters/ActingUserId'
  348. - name: id
  349. in: path
  350. required: true
  351. schema:
  352. type: integer
  353. responses:
  354. '200':
  355. description: manual block
  356. content:
  357. 'application/json':
  358. schema:
  359. '$ref': '#/components/schemas/ManualBlock'
  360. delete:
  361. tags:
  362. - Admin
  363. summary: Delete manual block
  364. security:
  365. - BearerAuth: []
  366. parameters:
  367. - '$ref': '#/components/parameters/ActingUserId'
  368. - name: id
  369. in: path
  370. required: true
  371. schema:
  372. type: integer
  373. responses:
  374. '204':
  375. description: Deleted
  376. '/api/v1/admin/allowlist':
  377. get:
  378. tags:
  379. - Admin
  380. summary: List allowlist
  381. security:
  382. - BearerAuth: []
  383. parameters:
  384. - '$ref': '#/components/parameters/ActingUserId'
  385. responses:
  386. '200':
  387. description: list
  388. post:
  389. tags:
  390. - Admin
  391. summary: Create allowlist entry
  392. security:
  393. - BearerAuth: []
  394. parameters:
  395. - '$ref': '#/components/parameters/ActingUserId'
  396. requestBody:
  397. required: true
  398. content:
  399. 'application/json':
  400. schema:
  401. type: object
  402. properties:
  403. kind:
  404. type: string
  405. enum:
  406. - ip
  407. - subnet
  408. ip:
  409. type: string
  410. cidr:
  411. type: string
  412. reason:
  413. type: string
  414. responses:
  415. '201':
  416. description: Created
  417. content:
  418. 'application/json':
  419. schema:
  420. '$ref': '#/components/schemas/AllowlistEntry'
  421. '/api/v1/admin/allowlist/{id}':
  422. get:
  423. tags:
  424. - Admin
  425. summary: Show allowlist entry
  426. security:
  427. - BearerAuth: []
  428. parameters:
  429. - '$ref': '#/components/parameters/ActingUserId'
  430. - name: id
  431. in: path
  432. required: true
  433. schema:
  434. type: integer
  435. responses:
  436. '200':
  437. description: allowlist entry
  438. content:
  439. 'application/json':
  440. schema:
  441. '$ref': '#/components/schemas/AllowlistEntry'
  442. delete:
  443. tags:
  444. - Admin
  445. summary: Delete allowlist entry
  446. security:
  447. - BearerAuth: []
  448. parameters:
  449. - '$ref': '#/components/parameters/ActingUserId'
  450. - name: id
  451. in: path
  452. required: true
  453. schema:
  454. type: integer
  455. responses:
  456. '204':
  457. description: Deleted
  458. '/api/v1/admin/reporters':
  459. get:
  460. tags:
  461. - Admin
  462. summary: List reporters
  463. security:
  464. - BearerAuth: []
  465. parameters:
  466. - '$ref': '#/components/parameters/ActingUserId'
  467. responses:
  468. '200':
  469. description: list
  470. post:
  471. tags:
  472. - Admin
  473. summary: Create reporter
  474. security:
  475. - BearerAuth: []
  476. parameters:
  477. - '$ref': '#/components/parameters/ActingUserId'
  478. requestBody:
  479. required: true
  480. content:
  481. 'application/json':
  482. schema:
  483. '$ref': '#/components/schemas/Reporter'
  484. responses:
  485. '201':
  486. description: Created
  487. content:
  488. 'application/json':
  489. schema:
  490. '$ref': '#/components/schemas/Reporter'
  491. '/api/v1/admin/reporters/{id}':
  492. get:
  493. tags:
  494. - Admin
  495. summary: Show reporter
  496. security:
  497. - BearerAuth: []
  498. parameters:
  499. - '$ref': '#/components/parameters/ActingUserId'
  500. - name: id
  501. in: path
  502. required: true
  503. schema:
  504. type: integer
  505. responses:
  506. '200':
  507. description: reporter
  508. content:
  509. 'application/json':
  510. schema:
  511. '$ref': '#/components/schemas/Reporter'
  512. patch:
  513. tags:
  514. - Admin
  515. summary: Update reporter
  516. security:
  517. - BearerAuth: []
  518. parameters:
  519. - '$ref': '#/components/parameters/ActingUserId'
  520. - name: id
  521. in: path
  522. required: true
  523. schema:
  524. type: integer
  525. requestBody:
  526. content:
  527. 'application/json':
  528. schema:
  529. '$ref': '#/components/schemas/Reporter'
  530. responses:
  531. '200':
  532. description: Updated
  533. content:
  534. 'application/json':
  535. schema:
  536. '$ref': '#/components/schemas/Reporter'
  537. delete:
  538. tags:
  539. - Admin
  540. summary: Soft-delete reporter
  541. security:
  542. - BearerAuth: []
  543. parameters:
  544. - '$ref': '#/components/parameters/ActingUserId'
  545. - name: id
  546. in: path
  547. required: true
  548. schema:
  549. type: integer
  550. responses:
  551. '204':
  552. description: Deleted
  553. '409':
  554. description: Has reports — flagged inactive instead.
  555. '/api/v1/admin/consumers':
  556. get:
  557. tags:
  558. - Admin
  559. summary: List consumers
  560. security:
  561. - BearerAuth: []
  562. parameters:
  563. - '$ref': '#/components/parameters/ActingUserId'
  564. responses:
  565. '200':
  566. description: list
  567. post:
  568. tags:
  569. - Admin
  570. summary: Create consumer
  571. security:
  572. - BearerAuth: []
  573. parameters:
  574. - '$ref': '#/components/parameters/ActingUserId'
  575. requestBody:
  576. required: true
  577. content:
  578. 'application/json':
  579. schema:
  580. '$ref': '#/components/schemas/Consumer'
  581. responses:
  582. '201':
  583. description: Created
  584. content:
  585. 'application/json':
  586. schema:
  587. '$ref': '#/components/schemas/Consumer'
  588. '/api/v1/admin/consumers/{id}':
  589. get:
  590. tags:
  591. - Admin
  592. summary: Show consumer
  593. security:
  594. - BearerAuth: []
  595. parameters:
  596. - '$ref': '#/components/parameters/ActingUserId'
  597. - name: id
  598. in: path
  599. required: true
  600. schema:
  601. type: integer
  602. responses:
  603. '200':
  604. description: consumer
  605. content:
  606. 'application/json':
  607. schema:
  608. '$ref': '#/components/schemas/Consumer'
  609. patch:
  610. tags:
  611. - Admin
  612. summary: Update consumer
  613. security:
  614. - BearerAuth: []
  615. parameters:
  616. - '$ref': '#/components/parameters/ActingUserId'
  617. - name: id
  618. in: path
  619. required: true
  620. schema:
  621. type: integer
  622. requestBody:
  623. content:
  624. 'application/json':
  625. schema:
  626. '$ref': '#/components/schemas/Consumer'
  627. responses:
  628. '200':
  629. description: Updated
  630. delete:
  631. tags:
  632. - Admin
  633. summary: Soft-delete consumer
  634. security:
  635. - BearerAuth: []
  636. parameters:
  637. - '$ref': '#/components/parameters/ActingUserId'
  638. - name: id
  639. in: path
  640. required: true
  641. schema:
  642. type: integer
  643. responses:
  644. '204':
  645. description: Deleted
  646. '/api/v1/admin/tokens':
  647. get:
  648. tags:
  649. - Admin
  650. summary: List tokens
  651. description: Service tokens are filtered out unconditionally.
  652. security:
  653. - BearerAuth: []
  654. parameters:
  655. - '$ref': '#/components/parameters/ActingUserId'
  656. responses:
  657. '200':
  658. description: list
  659. post:
  660. tags:
  661. - Admin
  662. summary: Create token
  663. description: Returns the raw token ONCE in `raw_token`. Service tokens are not creatable here.
  664. security:
  665. - BearerAuth: []
  666. parameters:
  667. - '$ref': '#/components/parameters/ActingUserId'
  668. requestBody:
  669. required: true
  670. content:
  671. 'application/json':
  672. schema:
  673. type: object
  674. properties:
  675. kind:
  676. type: string
  677. enum:
  678. - reporter
  679. - consumer
  680. - admin
  681. reporter_id:
  682. type: integer
  683. consumer_id:
  684. type: integer
  685. role:
  686. type: string
  687. enum:
  688. - viewer
  689. - operator
  690. - admin
  691. expires_at:
  692. type: string
  693. format: date-time
  694. responses:
  695. '201':
  696. description: Created
  697. content:
  698. 'application/json':
  699. schema:
  700. '$ref': '#/components/schemas/TokenCreated'
  701. '/api/v1/admin/tokens/{id}':
  702. delete:
  703. tags:
  704. - Admin
  705. summary: Revoke token
  706. security:
  707. - BearerAuth: []
  708. parameters:
  709. - '$ref': '#/components/parameters/ActingUserId'
  710. - name: id
  711. in: path
  712. required: true
  713. schema:
  714. type: integer
  715. responses:
  716. '204':
  717. description: Revoked
  718. '/api/v1/admin/tokens/{id}/purge':
  719. delete:
  720. tags:
  721. - Admin
  722. summary: Permanently delete a revoked token
  723. description: |
  724. Hard-deletes the row. Requires the token to be already revoked
  725. (`revoked_at` set); active tokens return 409 to keep "revoke first,
  726. then prune" the only path that removes data. Service tokens cannot
  727. be deleted.
  728. security:
  729. - BearerAuth: []
  730. parameters:
  731. - '$ref': '#/components/parameters/ActingUserId'
  732. - name: id
  733. in: path
  734. required: true
  735. schema:
  736. type: integer
  737. responses:
  738. '204':
  739. description: Deleted
  740. '403':
  741. description: Service token; not deletable via API
  742. '404':
  743. description: Not found
  744. '409':
  745. description: Token still active; revoke it first
  746. '/api/v1/admin/categories':
  747. get:
  748. tags:
  749. - Admin
  750. summary: List categories
  751. security:
  752. - BearerAuth: []
  753. parameters:
  754. - '$ref': '#/components/parameters/ActingUserId'
  755. responses:
  756. '200':
  757. description: list
  758. post:
  759. tags:
  760. - Admin
  761. summary: Create category
  762. security:
  763. - BearerAuth: []
  764. parameters:
  765. - '$ref': '#/components/parameters/ActingUserId'
  766. requestBody:
  767. required: true
  768. content:
  769. 'application/json':
  770. schema:
  771. '$ref': '#/components/schemas/Category'
  772. responses:
  773. '201':
  774. description: Created
  775. content:
  776. 'application/json':
  777. schema:
  778. '$ref': '#/components/schemas/Category'
  779. '/api/v1/admin/categories/{id}':
  780. get:
  781. tags:
  782. - Admin
  783. summary: Show category
  784. security:
  785. - BearerAuth: []
  786. parameters:
  787. - '$ref': '#/components/parameters/ActingUserId'
  788. - name: id
  789. in: path
  790. required: true
  791. schema:
  792. type: integer
  793. responses:
  794. '200':
  795. description: category
  796. content:
  797. 'application/json':
  798. schema:
  799. '$ref': '#/components/schemas/Category'
  800. patch:
  801. tags:
  802. - Admin
  803. summary: Update category
  804. security:
  805. - BearerAuth: []
  806. parameters:
  807. - '$ref': '#/components/parameters/ActingUserId'
  808. - name: id
  809. in: path
  810. required: true
  811. schema:
  812. type: integer
  813. requestBody:
  814. content:
  815. 'application/json':
  816. schema:
  817. '$ref': '#/components/schemas/Category'
  818. responses:
  819. '200':
  820. description: Updated
  821. delete:
  822. tags:
  823. - Admin
  824. summary: Hard-delete category (refused if in use)
  825. security:
  826. - BearerAuth: []
  827. parameters:
  828. - '$ref': '#/components/parameters/ActingUserId'
  829. - name: id
  830. in: path
  831. required: true
  832. schema:
  833. type: integer
  834. responses:
  835. '204':
  836. description: Deleted
  837. '409':
  838. description: Category in use; soft-delete via PATCH `is_active=false`.
  839. '/api/v1/admin/policies':
  840. get:
  841. tags:
  842. - Admin
  843. summary: List policies
  844. security:
  845. - BearerAuth: []
  846. parameters:
  847. - '$ref': '#/components/parameters/ActingUserId'
  848. responses:
  849. '200':
  850. description: list
  851. post:
  852. tags:
  853. - Admin
  854. summary: Create policy
  855. security:
  856. - BearerAuth: []
  857. parameters:
  858. - '$ref': '#/components/parameters/ActingUserId'
  859. requestBody:
  860. required: true
  861. content:
  862. 'application/json':
  863. schema:
  864. '$ref': '#/components/schemas/Policy'
  865. responses:
  866. '201':
  867. description: Created
  868. content:
  869. 'application/json':
  870. schema:
  871. '$ref': '#/components/schemas/Policy'
  872. '/api/v1/admin/policies/{id}':
  873. get:
  874. tags:
  875. - Admin
  876. summary: Show policy
  877. security:
  878. - BearerAuth: []
  879. parameters:
  880. - '$ref': '#/components/parameters/ActingUserId'
  881. - name: id
  882. in: path
  883. required: true
  884. schema:
  885. type: integer
  886. responses:
  887. '200':
  888. description: policy
  889. content:
  890. 'application/json':
  891. schema:
  892. '$ref': '#/components/schemas/Policy'
  893. patch:
  894. tags:
  895. - Admin
  896. summary: Update policy (replaces thresholds wholesale when present)
  897. security:
  898. - BearerAuth: []
  899. parameters:
  900. - '$ref': '#/components/parameters/ActingUserId'
  901. - name: id
  902. in: path
  903. required: true
  904. schema:
  905. type: integer
  906. requestBody:
  907. content:
  908. 'application/json':
  909. schema:
  910. '$ref': '#/components/schemas/Policy'
  911. responses:
  912. '200':
  913. description: Updated
  914. delete:
  915. tags:
  916. - Admin
  917. summary: Delete policy (refused if used by consumers)
  918. security:
  919. - BearerAuth: []
  920. parameters:
  921. - '$ref': '#/components/parameters/ActingUserId'
  922. - name: id
  923. in: path
  924. required: true
  925. schema:
  926. type: integer
  927. responses:
  928. '204':
  929. description: Deleted
  930. '409':
  931. description: Policy in use
  932. '/api/v1/admin/policies/{id}/preview':
  933. get:
  934. tags:
  935. - Admin
  936. summary: Preview policy (count + sample)
  937. security:
  938. - BearerAuth: []
  939. parameters:
  940. - '$ref': '#/components/parameters/ActingUserId'
  941. - name: id
  942. in: path
  943. required: true
  944. schema:
  945. type: integer
  946. responses:
  947. '200':
  948. description: Preview
  949. '/api/v1/admin/audit-log':
  950. get:
  951. tags:
  952. - Admin
  953. summary: Filtered audit log
  954. security:
  955. - BearerAuth: []
  956. parameters:
  957. - '$ref': '#/components/parameters/ActingUserId'
  958. - name: actor_kind
  959. in: query
  960. schema:
  961. type: string
  962. enum:
  963. - user
  964. - admin-token
  965. - reporter
  966. - consumer
  967. - system
  968. - name: actor_id
  969. in: query
  970. schema:
  971. type: integer
  972. - name: action
  973. in: query
  974. schema:
  975. type: string
  976. - name: entity_type
  977. in: query
  978. schema:
  979. type: string
  980. - name: entity_id
  981. in: query
  982. schema:
  983. type: string
  984. - name: subject_kind
  985. in: query
  986. description: |
  987. With `subject_id`, returns rows where the (kind, id) pair matches
  988. either the audit row's target OR its actor. Useful for per-entity
  989. detail pages that want both admin actions on the entity and
  990. events emitted by it (`report.received`, `blocklist.requested`).
  991. Both halves must be supplied together; otherwise 400.
  992. schema:
  993. type: string
  994. - name: subject_id
  995. in: query
  996. schema:
  997. type: string
  998. - name: from
  999. in: query
  1000. schema:
  1001. type: string
  1002. format: date-time
  1003. - name: to
  1004. in: query
  1005. schema:
  1006. type: string
  1007. format: date-time
  1008. - '$ref': '#/components/parameters/Page'
  1009. - '$ref': '#/components/parameters/PageSize'
  1010. responses:
  1011. '200':
  1012. description: Audit page
  1013. content:
  1014. 'application/json':
  1015. schema:
  1016. type: object
  1017. properties:
  1018. page:
  1019. type: integer
  1020. minimum: 1
  1021. example: 1
  1022. page_size:
  1023. type: integer
  1024. minimum: 1
  1025. maximum: 200
  1026. example: 50
  1027. total:
  1028. type: integer
  1029. minimum: 0
  1030. example: 1284
  1031. items:
  1032. type: array
  1033. items:
  1034. '$ref': '#/components/schemas/AuditEntry'
  1035. '/api/v1/admin/jobs/status':
  1036. get:
  1037. tags:
  1038. - Admin
  1039. summary: Jobs status (Viewer)
  1040. security:
  1041. - BearerAuth: []
  1042. parameters:
  1043. - '$ref': '#/components/parameters/ActingUserId'
  1044. responses:
  1045. '200':
  1046. description: Jobs status
  1047. content:
  1048. 'application/json':
  1049. schema:
  1050. type: object
  1051. properties:
  1052. now:
  1053. type: string
  1054. format: date-time
  1055. jobs:
  1056. type: object
  1057. additionalProperties:
  1058. '$ref': '#/components/schemas/JobStatus'
  1059. '/api/v1/admin/jobs/trigger/{name}':
  1060. post:
  1061. tags:
  1062. - Admin
  1063. summary: Manually trigger a job (Admin)
  1064. description: 'Whitelisted params: `full`, `max_rows`, `reenrich`. Other body fields are dropped.'
  1065. security:
  1066. - BearerAuth: []
  1067. parameters:
  1068. - '$ref': '#/components/parameters/ActingUserId'
  1069. - name: name
  1070. in: path
  1071. required: true
  1072. schema:
  1073. type: string
  1074. requestBody:
  1075. content:
  1076. 'application/json':
  1077. schema:
  1078. type: object
  1079. properties:
  1080. full:
  1081. type: boolean
  1082. max_rows:
  1083. type: integer
  1084. reenrich:
  1085. type: boolean
  1086. responses:
  1087. '200':
  1088. description: Job ran
  1089. content:
  1090. 'application/json':
  1091. schema:
  1092. '$ref': '#/components/schemas/JobOutcome'
  1093. '404':
  1094. description: Unknown job
  1095. '409':
  1096. description: Lock held; status=`skipped_locked`
  1097. '412':
  1098. description: refresh-geoip without credential
  1099. '/api/v1/admin/config':
  1100. get:
  1101. tags:
  1102. - Admin
  1103. summary: Effective config (secrets masked)
  1104. description: Admin only.
  1105. security:
  1106. - BearerAuth: []
  1107. parameters:
  1108. - '$ref': '#/components/parameters/ActingUserId'
  1109. responses:
  1110. '200':
  1111. description: Config sections
  1112. content:
  1113. 'application/json':
  1114. schema:
  1115. type: object
  1116. properties:
  1117. sections:
  1118. type: object
  1119. additionalProperties:
  1120. type: object
  1121. '/api/v1/admin/app-settings':
  1122. get:
  1123. tags:
  1124. - Admin
  1125. summary: Runtime feature flags (Admin)
  1126. description: |
  1127. Returns the runtime-mutable feature flags. Currently exposes the
  1128. audit-emission toggles for high-volume public endpoints
  1129. (`audit_report_received_enabled`, `audit_blocklist_request_enabled`).
  1130. security:
  1131. - BearerAuth: []
  1132. parameters:
  1133. - '$ref': '#/components/parameters/ActingUserId'
  1134. responses:
  1135. '200':
  1136. description: Current toggle state
  1137. content:
  1138. 'application/json':
  1139. schema:
  1140. type: object
  1141. additionalProperties:
  1142. type: boolean
  1143. patch:
  1144. tags:
  1145. - Admin
  1146. summary: Update runtime feature flags (Admin)
  1147. description: |
  1148. Updates one or more runtime feature flags. Body keys not listed are left
  1149. untouched. Returns the post-update snapshot.
  1150. security:
  1151. - BearerAuth: []
  1152. parameters:
  1153. - '$ref': '#/components/parameters/ActingUserId'
  1154. requestBody:
  1155. required: true
  1156. content:
  1157. 'application/json':
  1158. schema:
  1159. type: object
  1160. properties:
  1161. audit_report_received_enabled:
  1162. type: boolean
  1163. audit_blocklist_request_enabled:
  1164. type: boolean
  1165. responses:
  1166. '200':
  1167. description: Updated snapshot
  1168. content:
  1169. 'application/json':
  1170. schema:
  1171. type: object
  1172. additionalProperties:
  1173. type: boolean
  1174. '400':
  1175. description: Validation error
  1176. '/api/v1/admin/maintenance/purge':
  1177. post:
  1178. tags:
  1179. - Admin
  1180. summary: Wipe operational data (Admin)
  1181. description: |
  1182. Deletes reports, scores, enrichment, manual blocks, allowlist, audit log, job history, reporters, consumers, policies, and non-service tokens. Preserves users, OIDC role mappings, abuse categories, and the `service`-kind token.
  1183. Requires `confirm: "PURGE"` in the body — any other value returns 400.
  1184. security:
  1185. - BearerAuth: []
  1186. parameters:
  1187. - '$ref': '#/components/parameters/ActingUserId'
  1188. requestBody:
  1189. required: true
  1190. content:
  1191. 'application/json':
  1192. schema:
  1193. type: object
  1194. required:
  1195. - confirm
  1196. properties:
  1197. confirm:
  1198. type: string
  1199. enum:
  1200. - PURGE
  1201. responses:
  1202. '200':
  1203. description: Purge succeeded
  1204. content:
  1205. 'application/json':
  1206. schema:
  1207. type: object
  1208. properties:
  1209. status:
  1210. type: string
  1211. example: purged
  1212. deleted:
  1213. type: object
  1214. additionalProperties:
  1215. type: integer
  1216. '400':
  1217. description: Missing or wrong `confirm` value
  1218. '/api/v1/admin/maintenance/seed-demo':
  1219. post:
  1220. tags:
  1221. - Admin
  1222. summary: Load demo dataset (Admin)
  1223. description: 'Populates reporters, consumers, IPs, reports, manual blocks, allowlist, and synthetic GeoIP for demos and screenshots. Triggers a full score recompute on completion. Idempotent: returns 409 if demo data is already present.'
  1224. security:
  1225. - BearerAuth: []
  1226. parameters:
  1227. - '$ref': '#/components/parameters/ActingUserId'
  1228. responses:
  1229. '200':
  1230. description: Demo data inserted
  1231. content:
  1232. 'application/json':
  1233. schema:
  1234. type: object
  1235. properties:
  1236. status:
  1237. type: string
  1238. example: seeded
  1239. summary:
  1240. type: object
  1241. additionalProperties:
  1242. type: integer
  1243. recompute:
  1244. '$ref': '#/components/schemas/JobOutcome'
  1245. '409':
  1246. description: Demo data already present
  1247. '412':
  1248. description: No categories configured
  1249. '/api/v1/auth/users/upsert-oidc':
  1250. post:
  1251. tags:
  1252. - Auth
  1253. summary: Upsert an OIDC-authenticated user
  1254. description: |
  1255. **UI BFF only.** Service-token-required, no impersonation header.
  1256. Resolves the user record + role (via `oidc_role_mappings`) for a freshly-validated ID token.
  1257. x-internal: true
  1258. security:
  1259. - BearerAuth: []
  1260. requestBody:
  1261. required: true
  1262. content:
  1263. 'application/json':
  1264. schema:
  1265. type: object
  1266. properties:
  1267. subject:
  1268. type: string
  1269. email:
  1270. type: string
  1271. display_name:
  1272. type: string
  1273. groups:
  1274. type: array
  1275. items:
  1276. type: string
  1277. responses:
  1278. '200':
  1279. description: User record
  1280. content:
  1281. 'application/json':
  1282. schema:
  1283. '$ref': '#/components/schemas/User'
  1284. '/api/v1/auth/users/upsert-local':
  1285. post:
  1286. tags:
  1287. - Auth
  1288. summary: Upsert the local-admin user
  1289. description: '**UI BFF only.** Called after the UI validates the local-admin password.'
  1290. x-internal: true
  1291. security:
  1292. - BearerAuth: []
  1293. requestBody:
  1294. required: true
  1295. content:
  1296. 'application/json':
  1297. schema:
  1298. type: object
  1299. properties:
  1300. username:
  1301. type: string
  1302. responses:
  1303. '200':
  1304. description: User record
  1305. content:
  1306. 'application/json':
  1307. schema:
  1308. '$ref': '#/components/schemas/User'
  1309. '/api/v1/auth/users/{id}':
  1310. get:
  1311. tags:
  1312. - Auth
  1313. summary: Refetch a user record
  1314. description: '**UI BFF only.** Used to refresh role / display_name during a session.'
  1315. x-internal: true
  1316. security:
  1317. - BearerAuth: []
  1318. parameters:
  1319. - name: id
  1320. in: path
  1321. required: true
  1322. schema:
  1323. type: integer
  1324. responses:
  1325. '200':
  1326. description: User record
  1327. content:
  1328. 'application/json':
  1329. schema:
  1330. '$ref': '#/components/schemas/User'
  1331. components:
  1332. securitySchemes:
  1333. BearerAuth:
  1334. type: http
  1335. scheme: bearer
  1336. description: |
  1337. Token in the form `irdb_<kind>_<32 base32 chars>`.
  1338. See `doc/auth-flows.md` for the four token kinds.
  1339. parameters:
  1340. Page:
  1341. name: page
  1342. in: query
  1343. schema:
  1344. type: integer
  1345. minimum: 1
  1346. default: 1
  1347. PageSize:
  1348. name: page_size
  1349. in: query
  1350. schema:
  1351. type: integer
  1352. minimum: 1
  1353. maximum: 200
  1354. default: 50
  1355. ActingUserId:
  1356. name: X-Acting-User-Id
  1357. in: header
  1358. description: |
  1359. Required when authenticating with a `service` token.
  1360. The api applies RBAC for the named user. Ignored on other token kinds.
  1361. schema:
  1362. type: integer
  1363. schemas:
  1364. Error:
  1365. type: object
  1366. required:
  1367. - error
  1368. properties:
  1369. error:
  1370. type: string
  1371. example: unauthorized
  1372. details:
  1373. type: object
  1374. description: Field-level errors for `validation_failed`.
  1375. additionalProperties:
  1376. type: string
  1377. ReportRequest:
  1378. type: object
  1379. required:
  1380. - ip
  1381. - category
  1382. properties:
  1383. ip:
  1384. type: string
  1385. example: '203.0.113.42'
  1386. category:
  1387. type: string
  1388. example: brute_force
  1389. metadata:
  1390. type: object
  1391. description: Free-form per-report data, max 4 KB after json_encode.
  1392. additionalProperties: true
  1393. ReportResponse:
  1394. type: object
  1395. properties:
  1396. report_id:
  1397. type: integer
  1398. example: 12345
  1399. ip:
  1400. type: string
  1401. example: '203.0.113.42'
  1402. received_at:
  1403. type: string
  1404. format: date-time
  1405. BlocklistEntry:
  1406. type: object
  1407. properties:
  1408. ip_or_cidr:
  1409. type: string
  1410. example: '203.0.113.42'
  1411. categories:
  1412. type: array
  1413. items:
  1414. type: string
  1415. score:
  1416. type: number
  1417. format: float
  1418. example: 1.42
  1419. reason:
  1420. type: string
  1421. enum:
  1422. - scored
  1423. - manual
  1424. example: scored
  1425. BlocklistJson:
  1426. type: object
  1427. properties:
  1428. count:
  1429. type: integer
  1430. example: 42
  1431. generated_at:
  1432. type: string
  1433. format: date-time
  1434. policy:
  1435. type: string
  1436. example: moderate
  1437. entries:
  1438. type: array
  1439. items:
  1440. '$ref': '#/components/schemas/BlocklistEntry'
  1441. Token:
  1442. type: object
  1443. properties:
  1444. id:
  1445. type: integer
  1446. kind:
  1447. type: string
  1448. enum:
  1449. - reporter
  1450. - consumer
  1451. - admin
  1452. prefix:
  1453. type: string
  1454. example: irdb_adm
  1455. reporter_id:
  1456. type: integer
  1457. nullable: true
  1458. consumer_id:
  1459. type: integer
  1460. nullable: true
  1461. role:
  1462. type: string
  1463. nullable: true
  1464. enum:
  1465. - viewer
  1466. - operator
  1467. - admin
  1468. - null
  1469. expires_at:
  1470. type: string
  1471. format: date-time
  1472. nullable: true
  1473. revoked_at:
  1474. type: string
  1475. format: date-time
  1476. nullable: true
  1477. last_used_at:
  1478. type: string
  1479. format: date-time
  1480. nullable: true
  1481. TokenCreated:
  1482. allOf:
  1483. - '$ref': '#/components/schemas/Token'
  1484. - type: object
  1485. properties:
  1486. raw_token:
  1487. type: string
  1488. description: Returned ONCE on creation — copy it now, never displayed again.
  1489. example: irdb_adm_AAAAAAAABBBBBBBBCCCCCCCCDDDDDDDD
  1490. Reporter:
  1491. type: object
  1492. properties:
  1493. id:
  1494. type: integer
  1495. name:
  1496. type: string
  1497. example: web-prod-01
  1498. description:
  1499. type: string
  1500. nullable: true
  1501. trust_weight:
  1502. type: number
  1503. format: float
  1504. minimum: 0
  1505. maximum: 2
  1506. is_active:
  1507. type: boolean
  1508. audit_enabled:
  1509. type: boolean
  1510. description: When false, suppresses `report.received` audit rows for this reporter even if the global toggle is on.
  1511. Consumer:
  1512. type: object
  1513. properties:
  1514. id:
  1515. type: integer
  1516. name:
  1517. type: string
  1518. example: edge-fw-01
  1519. description:
  1520. type: string
  1521. nullable: true
  1522. policy_id:
  1523. type: integer
  1524. is_active:
  1525. type: boolean
  1526. audit_enabled:
  1527. type: boolean
  1528. description: When false, suppresses `blocklist.requested` audit rows for this consumer even if the global toggle is on.
  1529. last_pulled_at:
  1530. type: string
  1531. format: date-time
  1532. nullable: true
  1533. Category:
  1534. type: object
  1535. properties:
  1536. id:
  1537. type: integer
  1538. slug:
  1539. type: string
  1540. example: brute_force
  1541. name:
  1542. type: string
  1543. description:
  1544. type: string
  1545. nullable: true
  1546. decay_function:
  1547. type: string
  1548. enum:
  1549. - linear
  1550. - exponential
  1551. decay_param:
  1552. type: number
  1553. format: float
  1554. is_active:
  1555. type: boolean
  1556. Policy:
  1557. type: object
  1558. properties:
  1559. id:
  1560. type: integer
  1561. name:
  1562. type: string
  1563. example: moderate
  1564. description:
  1565. type: string
  1566. nullable: true
  1567. include_manual_blocks:
  1568. type: boolean
  1569. thresholds:
  1570. type: object
  1571. description: '`{category_slug: threshold}`'
  1572. additionalProperties:
  1573. type: number
  1574. format: float
  1575. ManualBlock:
  1576. type: object
  1577. properties:
  1578. id:
  1579. type: integer
  1580. kind:
  1581. type: string
  1582. enum:
  1583. - ip
  1584. - subnet
  1585. ip:
  1586. type: string
  1587. nullable: true
  1588. cidr:
  1589. type: string
  1590. nullable: true
  1591. reason:
  1592. type: string
  1593. nullable: true
  1594. expires_at:
  1595. type: string
  1596. format: date-time
  1597. nullable: true
  1598. created_at:
  1599. type: string
  1600. format: date-time
  1601. AllowlistEntry:
  1602. type: object
  1603. properties:
  1604. id:
  1605. type: integer
  1606. kind:
  1607. type: string
  1608. enum:
  1609. - ip
  1610. - subnet
  1611. ip:
  1612. type: string
  1613. nullable: true
  1614. cidr:
  1615. type: string
  1616. nullable: true
  1617. reason:
  1618. type: string
  1619. nullable: true
  1620. created_at:
  1621. type: string
  1622. format: date-time
  1623. IpDetail:
  1624. type: object
  1625. properties:
  1626. ip:
  1627. type: string
  1628. is_ipv4:
  1629. type: boolean
  1630. scores:
  1631. type: array
  1632. items:
  1633. type: object
  1634. properties:
  1635. category:
  1636. type: string
  1637. score:
  1638. type: number
  1639. format: float
  1640. last_report_at:
  1641. type: string
  1642. format: date-time
  1643. nullable: true
  1644. report_count_30d:
  1645. type: integer
  1646. enrichment:
  1647. type: object
  1648. properties:
  1649. country_code:
  1650. type: string
  1651. nullable: true
  1652. asn:
  1653. type: integer
  1654. nullable: true
  1655. as_org:
  1656. type: string
  1657. nullable: true
  1658. enriched_at:
  1659. type: string
  1660. format: date-time
  1661. nullable: true
  1662. status:
  1663. type: string
  1664. enum:
  1665. - scored
  1666. - manually_blocked
  1667. - allowlisted
  1668. - clean
  1669. manual_block:
  1670. type: object
  1671. nullable: true
  1672. allowlist:
  1673. type: object
  1674. nullable: true
  1675. history:
  1676. type: array
  1677. items:
  1678. type: object
  1679. has_more:
  1680. type: boolean
  1681. AuditEntry:
  1682. type: object
  1683. properties:
  1684. id:
  1685. type: integer
  1686. occurred_at:
  1687. type: string
  1688. format: date-time
  1689. actor_kind:
  1690. type: string
  1691. enum:
  1692. - user
  1693. - admin-token
  1694. - reporter
  1695. - consumer
  1696. - system
  1697. actor_id:
  1698. type: string
  1699. nullable: true
  1700. action:
  1701. type: string
  1702. example: manual_block.created
  1703. entity_type:
  1704. type: string
  1705. nullable: true
  1706. entity_id:
  1707. type: string
  1708. nullable: true
  1709. entity_label:
  1710. type: string
  1711. nullable: true
  1712. description: Human-readable identifier for the target (name, slug, IP, CIDR, prefix). Frozen at write time.
  1713. details:
  1714. type: object
  1715. nullable: true
  1716. additionalProperties: true
  1717. description: 'For update events, contains a `changes` map of `{field: {from, to}}` for every modified field.'
  1718. source_ip:
  1719. type: string
  1720. nullable: true
  1721. JobStatus:
  1722. type: object
  1723. properties:
  1724. name:
  1725. type: string
  1726. default_interval_seconds:
  1727. type: integer
  1728. max_runtime_seconds:
  1729. type: integer
  1730. overdue:
  1731. type: boolean
  1732. last_run:
  1733. type: object
  1734. nullable: true
  1735. properties:
  1736. id:
  1737. type: integer
  1738. status:
  1739. type: string
  1740. enum:
  1741. - success
  1742. - failure
  1743. - skipped_locked
  1744. - running
  1745. items_processed:
  1746. type: integer
  1747. triggered_by:
  1748. type: string
  1749. enum:
  1750. - schedule
  1751. - manual
  1752. - api
  1753. started_at:
  1754. type: string
  1755. format: date-time
  1756. nullable: true
  1757. finished_at:
  1758. type: string
  1759. format: date-time
  1760. nullable: true
  1761. error_message:
  1762. type: string
  1763. nullable: true
  1764. JobOutcome:
  1765. type: object
  1766. properties:
  1767. job:
  1768. type: string
  1769. status:
  1770. type: string
  1771. enum:
  1772. - success
  1773. - failure
  1774. - skipped_locked
  1775. - running
  1776. items_processed:
  1777. type: integer
  1778. duration_ms:
  1779. type: integer
  1780. run_id:
  1781. type: integer
  1782. nullable: true
  1783. error:
  1784. type: string
  1785. nullable: true
  1786. User:
  1787. type: object
  1788. properties:
  1789. id:
  1790. type: integer
  1791. email:
  1792. type: string
  1793. nullable: true
  1794. display_name:
  1795. type: string
  1796. role:
  1797. type: string
  1798. enum:
  1799. - viewer
  1800. - operator
  1801. - admin
  1802. source:
  1803. type: string
  1804. enum:
  1805. - oidc
  1806. - local
  1807. - admin-token
  1808. is_local:
  1809. type: boolean
  1810. Pagination:
  1811. type: object
  1812. properties:
  1813. page:
  1814. type: integer
  1815. minimum: 1
  1816. example: 1
  1817. page_size:
  1818. type: integer
  1819. minimum: 1
  1820. maximum: 200
  1821. example: 50
  1822. total:
  1823. type: integer
  1824. minimum: 0
  1825. example: 1284