api.swagger.json 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456
  1. {
  2. "openapi": "3.0.0",
  3. "info": {
  4. "title": "Nginx Proxy Manager API",
  5. "version": "2.x.x"
  6. },
  7. "servers": [
  8. {
  9. "url": "http://127.0.0.1:81/api"
  10. }
  11. ],
  12. "paths": {
  13. "/": {
  14. "get": {
  15. "operationId": "health",
  16. "summary": "Returns the API health status",
  17. "responses": {
  18. "200": {
  19. "description": "200 response",
  20. "content": {
  21. "application/json": {
  22. "examples": {
  23. "default": {
  24. "value": {
  25. "status": "OK",
  26. "version": {
  27. "major": 2,
  28. "minor": 1,
  29. "revision": 0
  30. }
  31. }
  32. }
  33. },
  34. "schema": {
  35. "$ref": "#/components/schemas/HealthObject"
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. },
  43. "/nginx/proxy-hosts": {
  44. "get": {
  45. "operationId": "getProxyHosts",
  46. "summary": "Get all proxy hosts",
  47. "tags": ["Proxy Hosts"],
  48. "security": [
  49. {
  50. "BearerAuth": ["users"]
  51. }
  52. ],
  53. "parameters": [
  54. {
  55. "in": "query",
  56. "name": "expand",
  57. "description": "Expansions",
  58. "schema": {
  59. "type": "string",
  60. "enum": ["access_list", "owner", "certificate"]
  61. }
  62. }
  63. ],
  64. "responses": {
  65. "200": {
  66. "description": "200 response",
  67. "content": {
  68. "application/json": {
  69. "examples": {
  70. "default": {
  71. "value": [
  72. {
  73. "id": 1,
  74. "created_on": "2023-03-30T01:12:23.000Z",
  75. "modified_on": "2023-03-30T02:15:40.000Z",
  76. "owner_user_id": 1,
  77. "domain_names": ["aasdasdad"],
  78. "forward_host": "asdasd",
  79. "forward_port": 80,
  80. "access_list_id": 0,
  81. "certificate_id": 0,
  82. "ssl_forced": 0,
  83. "caching_enabled": 0,
  84. "block_exploits": 0,
  85. "advanced_config": "sdfsdfsdf",
  86. "meta": {
  87. "letsencrypt_agree": false,
  88. "dns_challenge": false,
  89. "nginx_online": false,
  90. "nginx_err": "Command failed: /usr/sbin/nginx -t -g \"error_log off;\"\nnginx: [emerg] unknown directive \"sdfsdfsdf\" in /data/nginx/proxy_host/1.conf:37\nnginx: configuration file /etc/nginx/nginx.conf test failed\n"
  91. },
  92. "allow_websocket_upgrade": 0,
  93. "http2_support": 0,
  94. "forward_scheme": "http",
  95. "enabled": 1,
  96. "locations": [],
  97. "hsts_enabled": 0,
  98. "hsts_subdomains": 0,
  99. "owner": {
  100. "id": 1,
  101. "created_on": "2023-03-30T01:11:50.000Z",
  102. "modified_on": "2023-03-30T01:11:50.000Z",
  103. "is_deleted": 0,
  104. "is_disabled": 0,
  105. "email": "[email protected]",
  106. "name": "Administrator",
  107. "nickname": "Admin",
  108. "avatar": "",
  109. "roles": ["admin"]
  110. },
  111. "access_list": null,
  112. "certificate": null
  113. },
  114. {
  115. "id": 2,
  116. "created_on": "2023-03-30T02:11:49.000Z",
  117. "modified_on": "2023-03-30T02:11:49.000Z",
  118. "owner_user_id": 1,
  119. "domain_names": ["test.example.com"],
  120. "forward_host": "1.1.1.1",
  121. "forward_port": 80,
  122. "access_list_id": 0,
  123. "certificate_id": 0,
  124. "ssl_forced": 0,
  125. "caching_enabled": 0,
  126. "block_exploits": 0,
  127. "advanced_config": "",
  128. "meta": {
  129. "letsencrypt_agree": false,
  130. "dns_challenge": false,
  131. "nginx_online": true,
  132. "nginx_err": null
  133. },
  134. "allow_websocket_upgrade": 0,
  135. "http2_support": 0,
  136. "forward_scheme": "http",
  137. "enabled": 1,
  138. "locations": [],
  139. "hsts_enabled": 0,
  140. "hsts_subdomains": 0,
  141. "owner": {
  142. "id": 1,
  143. "created_on": "2023-03-30T01:11:50.000Z",
  144. "modified_on": "2023-03-30T01:11:50.000Z",
  145. "is_deleted": 0,
  146. "is_disabled": 0,
  147. "email": "[email protected]",
  148. "name": "Administrator",
  149. "nickname": "Admin",
  150. "avatar": "",
  151. "roles": ["admin"]
  152. },
  153. "access_list": null,
  154. "certificate": null
  155. }
  156. ]
  157. }
  158. },
  159. "schema": {
  160. "$ref": "#/components/schemas/ProxyHostsList"
  161. }
  162. }
  163. }
  164. }
  165. }
  166. },
  167. "post": {
  168. "operationId": "createProxyHost",
  169. "summary": "Create a Proxy Host",
  170. "tags": ["Proxy Hosts"],
  171. "security": [
  172. {
  173. "BearerAuth": ["users"]
  174. }
  175. ],
  176. "parameters": [
  177. {
  178. "in": "body",
  179. "name": "proxyhost",
  180. "description": "Proxy Host Payload",
  181. "required": true,
  182. "schema": {
  183. "$ref": "#/components/schemas/ProxyHostObject"
  184. }
  185. }
  186. ],
  187. "responses": {
  188. "201": {
  189. "description": "201 response",
  190. "content": {
  191. "application/json": {
  192. "examples": {
  193. "default": {
  194. "value": {
  195. "id": 3,
  196. "created_on": "2023-03-30T02:31:27.000Z",
  197. "modified_on": "2023-03-30T02:31:27.000Z",
  198. "owner_user_id": 1,
  199. "domain_names": ["test2.example.com"],
  200. "forward_host": "1.1.1.1",
  201. "forward_port": 80,
  202. "access_list_id": 0,
  203. "certificate_id": 0,
  204. "ssl_forced": 0,
  205. "caching_enabled": 0,
  206. "block_exploits": 0,
  207. "advanced_config": "",
  208. "meta": {
  209. "letsencrypt_agree": false,
  210. "dns_challenge": false
  211. },
  212. "allow_websocket_upgrade": 0,
  213. "http2_support": 0,
  214. "forward_scheme": "http",
  215. "enabled": 1,
  216. "locations": [],
  217. "hsts_enabled": 0,
  218. "hsts_subdomains": 0,
  219. "certificate": null,
  220. "owner": {
  221. "id": 1,
  222. "created_on": "2023-03-30T01:11:50.000Z",
  223. "modified_on": "2023-03-30T01:11:50.000Z",
  224. "is_deleted": 0,
  225. "is_disabled": 0,
  226. "email": "[email protected]",
  227. "name": "Administrator",
  228. "nickname": "Admin",
  229. "avatar": "",
  230. "roles": ["admin"]
  231. },
  232. "access_list": null,
  233. "use_default_location": true,
  234. "ipv6": true
  235. }
  236. }
  237. },
  238. "schema": {
  239. "$ref": "#/components/schemas/ProxyHostObject"
  240. }
  241. }
  242. }
  243. }
  244. }
  245. }
  246. },
  247. "/schema": {
  248. "get": {
  249. "operationId": "schema",
  250. "responses": {
  251. "200": {
  252. "description": "200 response"
  253. }
  254. },
  255. "summary": "Returns this swagger API schema"
  256. }
  257. },
  258. "/tokens": {
  259. "get": {
  260. "operationId": "refreshToken",
  261. "summary": "Refresh your access token",
  262. "tags": ["Tokens"],
  263. "security": [
  264. {
  265. "BearerAuth": ["tokens"]
  266. }
  267. ],
  268. "responses": {
  269. "200": {
  270. "description": "200 response",
  271. "content": {
  272. "application/json": {
  273. "examples": {
  274. "default": {
  275. "value": {
  276. "expires": 1566540510,
  277. "token": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4"
  278. }
  279. }
  280. },
  281. "schema": {
  282. "$ref": "#/components/schemas/TokenObject"
  283. }
  284. }
  285. }
  286. }
  287. }
  288. },
  289. "post": {
  290. "operationId": "requestToken",
  291. "parameters": [
  292. {
  293. "description": "Credentials Payload",
  294. "in": "body",
  295. "name": "credentials",
  296. "required": true,
  297. "schema": {
  298. "additionalProperties": false,
  299. "properties": {
  300. "identity": {
  301. "minLength": 1,
  302. "type": "string"
  303. },
  304. "scope": {
  305. "minLength": 1,
  306. "type": "string",
  307. "enum": ["user"]
  308. },
  309. "secret": {
  310. "minLength": 1,
  311. "type": "string"
  312. }
  313. },
  314. "required": ["identity", "secret"],
  315. "type": "object"
  316. }
  317. }
  318. ],
  319. "responses": {
  320. "200": {
  321. "content": {
  322. "application/json": {
  323. "examples": {
  324. "default": {
  325. "value": {
  326. "result": {
  327. "expires": 1566540510,
  328. "token": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4"
  329. }
  330. }
  331. }
  332. },
  333. "schema": {
  334. "$ref": "#/components/schemas/TokenObject"
  335. }
  336. }
  337. },
  338. "description": "200 response"
  339. }
  340. },
  341. "summary": "Request a new access token from credentials",
  342. "tags": ["Tokens"]
  343. }
  344. },
  345. "/settings": {
  346. "get": {
  347. "operationId": "getSettings",
  348. "summary": "Get all settings",
  349. "tags": ["Settings"],
  350. "security": [
  351. {
  352. "BearerAuth": ["settings"]
  353. }
  354. ],
  355. "responses": {
  356. "200": {
  357. "description": "200 response",
  358. "content": {
  359. "application/json": {
  360. "examples": {
  361. "default": {
  362. "value": [
  363. {
  364. "id": "default-site",
  365. "name": "Default Site",
  366. "description": "What to show when Nginx is hit with an unknown Host",
  367. "value": "congratulations",
  368. "meta": {}
  369. }
  370. ]
  371. }
  372. },
  373. "schema": {
  374. "$ref": "#/components/schemas/SettingsList"
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. },
  382. "/settings/{settingID}": {
  383. "get": {
  384. "operationId": "getSetting",
  385. "summary": "Get a setting",
  386. "tags": ["Settings"],
  387. "security": [
  388. {
  389. "BearerAuth": ["settings"]
  390. }
  391. ],
  392. "parameters": [
  393. {
  394. "in": "path",
  395. "name": "settingID",
  396. "schema": {
  397. "type": "string",
  398. "minLength": 1
  399. },
  400. "required": true,
  401. "description": "Setting ID",
  402. "example": "default-site"
  403. }
  404. ],
  405. "responses": {
  406. "200": {
  407. "description": "200 response",
  408. "content": {
  409. "application/json": {
  410. "examples": {
  411. "default": {
  412. "value": {
  413. "id": "default-site",
  414. "name": "Default Site",
  415. "description": "What to show when Nginx is hit with an unknown Host",
  416. "value": "congratulations",
  417. "meta": {}
  418. }
  419. }
  420. },
  421. "schema": {
  422. "$ref": "#/components/schemas/SettingObject"
  423. }
  424. }
  425. }
  426. }
  427. }
  428. },
  429. "put": {
  430. "operationId": "updateSetting",
  431. "summary": "Update a setting",
  432. "tags": ["Settings"],
  433. "security": [
  434. {
  435. "BearerAuth": ["settings"]
  436. }
  437. ],
  438. "parameters": [
  439. {
  440. "in": "path",
  441. "name": "settingID",
  442. "schema": {
  443. "type": "string",
  444. "minLength": 1
  445. },
  446. "required": true,
  447. "description": "Setting ID",
  448. "example": "default-site"
  449. },
  450. {
  451. "in": "body",
  452. "name": "setting",
  453. "description": "Setting Payload",
  454. "required": true,
  455. "schema": {
  456. "$ref": "#/components/schemas/SettingObject"
  457. }
  458. }
  459. ],
  460. "responses": {
  461. "200": {
  462. "description": "200 response",
  463. "content": {
  464. "application/json": {
  465. "examples": {
  466. "default": {
  467. "value": {
  468. "id": "default-site",
  469. "name": "Default Site",
  470. "description": "What to show when Nginx is hit with an unknown Host",
  471. "value": "congratulations",
  472. "meta": {}
  473. }
  474. }
  475. },
  476. "schema": {
  477. "$ref": "#/components/schemas/SettingObject"
  478. }
  479. }
  480. }
  481. }
  482. }
  483. }
  484. },
  485. "/users": {
  486. "get": {
  487. "operationId": "getUsers",
  488. "summary": "Get all users",
  489. "tags": ["Users"],
  490. "security": [
  491. {
  492. "BearerAuth": ["users"]
  493. }
  494. ],
  495. "parameters": [
  496. {
  497. "in": "query",
  498. "name": "expand",
  499. "description": "Expansions",
  500. "schema": {
  501. "type": "string",
  502. "enum": ["permissions"]
  503. }
  504. }
  505. ],
  506. "responses": {
  507. "200": {
  508. "description": "200 response",
  509. "content": {
  510. "application/json": {
  511. "examples": {
  512. "default": {
  513. "value": [
  514. {
  515. "id": 1,
  516. "created_on": "2020-01-30T09:36:08.000Z",
  517. "modified_on": "2020-01-30T09:41:04.000Z",
  518. "is_disabled": 0,
  519. "email": "[email protected]",
  520. "name": "Jamie Curnow",
  521. "nickname": "James",
  522. "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
  523. "roles": ["admin"]
  524. }
  525. ]
  526. },
  527. "withPermissions": {
  528. "value": [
  529. {
  530. "id": 1,
  531. "created_on": "2020-01-30T09:36:08.000Z",
  532. "modified_on": "2020-01-30T09:41:04.000Z",
  533. "is_disabled": 0,
  534. "email": "[email protected]",
  535. "name": "Jamie Curnow",
  536. "nickname": "James",
  537. "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
  538. "roles": ["admin"],
  539. "permissions": {
  540. "visibility": "all",
  541. "proxy_hosts": "manage",
  542. "redirection_hosts": "manage",
  543. "dead_hosts": "manage",
  544. "streams": "manage",
  545. "access_lists": "manage",
  546. "certificates": "manage"
  547. }
  548. }
  549. ]
  550. }
  551. },
  552. "schema": {
  553. "$ref": "#/components/schemas/UsersList"
  554. }
  555. }
  556. }
  557. }
  558. }
  559. },
  560. "post": {
  561. "operationId": "createUser",
  562. "summary": "Create a User",
  563. "tags": ["Users"],
  564. "security": [
  565. {
  566. "BearerAuth": ["users"]
  567. }
  568. ],
  569. "parameters": [
  570. {
  571. "in": "body",
  572. "name": "user",
  573. "description": "User Payload",
  574. "required": true,
  575. "schema": {
  576. "$ref": "#/components/schemas/UserObject"
  577. }
  578. }
  579. ],
  580. "responses": {
  581. "201": {
  582. "description": "201 response",
  583. "content": {
  584. "application/json": {
  585. "examples": {
  586. "default": {
  587. "value": {
  588. "id": 2,
  589. "created_on": "2020-01-30T09:36:08.000Z",
  590. "modified_on": "2020-01-30T09:41:04.000Z",
  591. "is_disabled": 0,
  592. "email": "[email protected]",
  593. "name": "Jamie Curnow",
  594. "nickname": "James",
  595. "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
  596. "roles": ["admin"],
  597. "permissions": {
  598. "visibility": "all",
  599. "proxy_hosts": "manage",
  600. "redirection_hosts": "manage",
  601. "dead_hosts": "manage",
  602. "streams": "manage",
  603. "access_lists": "manage",
  604. "certificates": "manage"
  605. }
  606. }
  607. }
  608. },
  609. "schema": {
  610. "$ref": "#/components/schemas/UserObject"
  611. }
  612. }
  613. }
  614. }
  615. }
  616. }
  617. },
  618. "/users/{userID}": {
  619. "get": {
  620. "operationId": "getUser",
  621. "summary": "Get a user",
  622. "tags": ["Users"],
  623. "security": [
  624. {
  625. "BearerAuth": ["users"]
  626. }
  627. ],
  628. "parameters": [
  629. {
  630. "in": "path",
  631. "name": "userID",
  632. "schema": {
  633. "oneOf": [
  634. {
  635. "type": "string",
  636. "pattern": "^me$"
  637. },
  638. {
  639. "type": "integer",
  640. "minimum": 1
  641. }
  642. ]
  643. },
  644. "required": true,
  645. "description": "User ID or 'me' for yourself",
  646. "example": 1
  647. }
  648. ],
  649. "responses": {
  650. "200": {
  651. "description": "200 response",
  652. "content": {
  653. "application/json": {
  654. "examples": {
  655. "default": {
  656. "value": {
  657. "id": 1,
  658. "created_on": "2020-01-30T09:36:08.000Z",
  659. "modified_on": "2020-01-30T09:41:04.000Z",
  660. "is_disabled": 0,
  661. "email": "[email protected]",
  662. "name": "Jamie Curnow",
  663. "nickname": "James",
  664. "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
  665. "roles": ["admin"]
  666. }
  667. }
  668. },
  669. "schema": {
  670. "$ref": "#/components/schemas/UserObject"
  671. }
  672. }
  673. }
  674. }
  675. }
  676. },
  677. "put": {
  678. "operationId": "updateUser",
  679. "summary": "Update a User",
  680. "tags": ["Users"],
  681. "security": [
  682. {
  683. "BearerAuth": ["users"]
  684. }
  685. ],
  686. "parameters": [
  687. {
  688. "in": "path",
  689. "name": "userID",
  690. "schema": {
  691. "oneOf": [
  692. {
  693. "type": "string",
  694. "pattern": "^me$"
  695. },
  696. {
  697. "type": "integer",
  698. "minimum": 1
  699. }
  700. ]
  701. },
  702. "required": true,
  703. "description": "User ID or 'me' for yourself",
  704. "example": 2
  705. },
  706. {
  707. "in": "body",
  708. "name": "user",
  709. "description": "User Payload",
  710. "required": true,
  711. "schema": {
  712. "$ref": "#/components/schemas/UserObject"
  713. }
  714. }
  715. ],
  716. "responses": {
  717. "200": {
  718. "description": "200 response",
  719. "content": {
  720. "application/json": {
  721. "examples": {
  722. "default": {
  723. "value": {
  724. "id": 2,
  725. "created_on": "2020-01-30T09:36:08.000Z",
  726. "modified_on": "2020-01-30T09:41:04.000Z",
  727. "is_disabled": 0,
  728. "email": "[email protected]",
  729. "name": "Jamie Curnow",
  730. "nickname": "James",
  731. "avatar": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm",
  732. "roles": ["admin"]
  733. }
  734. }
  735. },
  736. "schema": {
  737. "$ref": "#/components/schemas/UserObject"
  738. }
  739. }
  740. }
  741. }
  742. }
  743. },
  744. "delete": {
  745. "operationId": "deleteUser",
  746. "summary": "Delete a User",
  747. "tags": ["Users"],
  748. "security": [
  749. {
  750. "BearerAuth": ["users"]
  751. }
  752. ],
  753. "parameters": [
  754. {
  755. "in": "path",
  756. "name": "userID",
  757. "schema": {
  758. "type": "integer",
  759. "minimum": 1
  760. },
  761. "required": true,
  762. "description": "User ID",
  763. "example": 2
  764. }
  765. ],
  766. "responses": {
  767. "200": {
  768. "description": "200 response",
  769. "content": {
  770. "application/json": {
  771. "examples": {
  772. "default": {
  773. "value": true
  774. }
  775. },
  776. "schema": {
  777. "type": "boolean"
  778. }
  779. }
  780. }
  781. }
  782. }
  783. }
  784. },
  785. "/users/{userID}/auth": {
  786. "put": {
  787. "operationId": "updateUserAuth",
  788. "summary": "Update a User's Authentication",
  789. "tags": ["Users"],
  790. "security": [
  791. {
  792. "BearerAuth": ["users"]
  793. }
  794. ],
  795. "parameters": [
  796. {
  797. "in": "path",
  798. "name": "userID",
  799. "schema": {
  800. "oneOf": [
  801. {
  802. "type": "string",
  803. "pattern": "^me$"
  804. },
  805. {
  806. "type": "integer",
  807. "minimum": 1
  808. }
  809. ]
  810. },
  811. "required": true,
  812. "description": "User ID or 'me' for yourself",
  813. "example": 2
  814. },
  815. {
  816. "in": "body",
  817. "name": "user",
  818. "description": "User Payload",
  819. "required": true,
  820. "schema": {
  821. "$ref": "#/components/schemas/AuthObject"
  822. }
  823. }
  824. ],
  825. "responses": {
  826. "200": {
  827. "description": "200 response",
  828. "content": {
  829. "application/json": {
  830. "examples": {
  831. "default": {
  832. "value": true
  833. }
  834. },
  835. "schema": {
  836. "type": "boolean"
  837. }
  838. }
  839. }
  840. }
  841. }
  842. }
  843. },
  844. "/users/{userID}/permissions": {
  845. "put": {
  846. "operationId": "updateUserPermissions",
  847. "summary": "Update a User's Permissions",
  848. "tags": ["Users"],
  849. "security": [
  850. {
  851. "BearerAuth": ["users"]
  852. }
  853. ],
  854. "parameters": [
  855. {
  856. "in": "path",
  857. "name": "userID",
  858. "schema": {
  859. "type": "integer",
  860. "minimum": 1
  861. },
  862. "required": true,
  863. "description": "User ID",
  864. "example": 2
  865. },
  866. {
  867. "in": "body",
  868. "name": "user",
  869. "description": "Permissions Payload",
  870. "required": true,
  871. "schema": {
  872. "$ref": "#/components/schemas/PermissionsObject"
  873. }
  874. }
  875. ],
  876. "responses": {
  877. "200": {
  878. "description": "200 response",
  879. "content": {
  880. "application/json": {
  881. "examples": {
  882. "default": {
  883. "value": true
  884. }
  885. },
  886. "schema": {
  887. "type": "boolean"
  888. }
  889. }
  890. }
  891. }
  892. }
  893. }
  894. },
  895. "/users/{userID}/login": {
  896. "put": {
  897. "operationId": "loginAsUser",
  898. "summary": "Login as this user",
  899. "tags": ["Users"],
  900. "security": [
  901. {
  902. "BearerAuth": ["users"]
  903. }
  904. ],
  905. "parameters": [
  906. {
  907. "in": "path",
  908. "name": "userID",
  909. "schema": {
  910. "type": "integer",
  911. "minimum": 1
  912. },
  913. "required": true,
  914. "description": "User ID",
  915. "example": 2
  916. }
  917. ],
  918. "responses": {
  919. "200": {
  920. "description": "200 response",
  921. "content": {
  922. "application/json": {
  923. "examples": {
  924. "default": {
  925. "value": {
  926. "token": "eyJhbGciOiJSUzI1NiIsInR...16OjT8B3NLyXg",
  927. "expires": "2020-01-31T10:56:23.239Z",
  928. "user": {
  929. "id": 1,
  930. "created_on": "2020-01-30T10:43:44.000Z",
  931. "modified_on": "2020-01-30T10:43:44.000Z",
  932. "is_disabled": 0,
  933. "email": "[email protected]",
  934. "name": "Jamie Curnow",
  935. "nickname": "James",
  936. "avatar": "//www.gravatar.com/avatar/3c8d73f45fd8763f827b964c76e6032a?default=mm",
  937. "roles": ["admin"]
  938. }
  939. }
  940. }
  941. },
  942. "schema": {
  943. "type": "object",
  944. "description": "Login object",
  945. "required": ["expires", "token", "user"],
  946. "additionalProperties": false,
  947. "properties": {
  948. "expires": {
  949. "description": "Token Expiry Unix Time",
  950. "example": 1566540249,
  951. "minimum": 1,
  952. "type": "number"
  953. },
  954. "token": {
  955. "description": "JWT Token",
  956. "example": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4",
  957. "type": "string"
  958. },
  959. "user": {
  960. "$ref": "#/components/schemas/UserObject"
  961. }
  962. }
  963. }
  964. }
  965. }
  966. }
  967. }
  968. }
  969. },
  970. "/reports/hosts": {
  971. "get": {
  972. "operationId": "reportsHosts",
  973. "summary": "Report on Host Statistics",
  974. "tags": ["Reports"],
  975. "security": [
  976. {
  977. "BearerAuth": ["reports"]
  978. }
  979. ],
  980. "responses": {
  981. "200": {
  982. "description": "200 response",
  983. "content": {
  984. "application/json": {
  985. "examples": {
  986. "default": {
  987. "value": {
  988. "proxy": 20,
  989. "redirection": 1,
  990. "stream": 0,
  991. "dead": 1
  992. }
  993. }
  994. },
  995. "schema": {
  996. "$ref": "#/components/schemas/HostReportObject"
  997. }
  998. }
  999. }
  1000. }
  1001. }
  1002. }
  1003. },
  1004. "/audit-log": {
  1005. "get": {
  1006. "operationId": "getAuditLog",
  1007. "summary": "Get Audit Log",
  1008. "tags": ["Audit Log"],
  1009. "security": [
  1010. {
  1011. "BearerAuth": ["audit-log"]
  1012. }
  1013. ],
  1014. "responses": {
  1015. "200": {
  1016. "description": "200 response",
  1017. "content": {
  1018. "application/json": {
  1019. "examples": {
  1020. "default": {
  1021. "value": {
  1022. "proxy": 20,
  1023. "redirection": 1,
  1024. "stream": 0,
  1025. "dead": 1
  1026. }
  1027. }
  1028. },
  1029. "schema": {
  1030. "$ref": "#/components/schemas/HostReportObject"
  1031. }
  1032. }
  1033. }
  1034. }
  1035. }
  1036. }
  1037. }
  1038. },
  1039. "components": {
  1040. "securitySchemes": {
  1041. "BearerAuth": {
  1042. "type": "http",
  1043. "scheme": "bearer"
  1044. }
  1045. },
  1046. "schemas": {
  1047. "HealthObject": {
  1048. "type": "object",
  1049. "description": "Health object",
  1050. "additionalProperties": false,
  1051. "required": ["status", "version"],
  1052. "properties": {
  1053. "status": {
  1054. "type": "string",
  1055. "description": "Healthy",
  1056. "example": "OK"
  1057. },
  1058. "version": {
  1059. "type": "object",
  1060. "description": "The version object",
  1061. "example": {
  1062. "major": 2,
  1063. "minor": 0,
  1064. "revision": 0
  1065. },
  1066. "additionalProperties": false,
  1067. "required": ["major", "minor", "revision"],
  1068. "properties": {
  1069. "major": {
  1070. "type": "integer",
  1071. "minimum": 0
  1072. },
  1073. "minor": {
  1074. "type": "integer",
  1075. "minimum": 0
  1076. },
  1077. "revision": {
  1078. "type": "integer",
  1079. "minimum": 0
  1080. }
  1081. }
  1082. }
  1083. }
  1084. },
  1085. "TokenObject": {
  1086. "type": "object",
  1087. "description": "Token object",
  1088. "required": ["expires", "token"],
  1089. "additionalProperties": false,
  1090. "properties": {
  1091. "expires": {
  1092. "description": "Token Expiry Unix Time",
  1093. "example": 1566540249,
  1094. "minimum": 1,
  1095. "type": "number"
  1096. },
  1097. "token": {
  1098. "description": "JWT Token",
  1099. "example": "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.ey...xaHKYr3Kk6MvkUjcC4",
  1100. "type": "string"
  1101. }
  1102. }
  1103. },
  1104. "ProxyHostObject": {
  1105. "type": "object",
  1106. "description": "Proxy Host object",
  1107. "required": [
  1108. "id",
  1109. "created_on",
  1110. "modified_on",
  1111. "owner_user_id",
  1112. "domain_names",
  1113. "forward_host",
  1114. "forward_port",
  1115. "access_list_id",
  1116. "certificate_id",
  1117. "ssl_forced",
  1118. "caching_enabled",
  1119. "block_exploits",
  1120. "advanced_config",
  1121. "meta",
  1122. "allow_websocket_upgrade",
  1123. "http2_support",
  1124. "forward_scheme",
  1125. "enabled",
  1126. "locations",
  1127. "hsts_enabled",
  1128. "hsts_subdomains",
  1129. "certificate",
  1130. "use_default_location",
  1131. "ipv6"
  1132. ],
  1133. "additionalProperties": false,
  1134. "properties": {
  1135. "id": {
  1136. "type": "integer",
  1137. "description": "Proxy Host ID",
  1138. "minimum": 1,
  1139. "example": 1
  1140. },
  1141. "created_on": {
  1142. "type": "string",
  1143. "description": "Created Date",
  1144. "example": "2020-01-30T09:36:08.000Z"
  1145. },
  1146. "modified_on": {
  1147. "type": "string",
  1148. "description": "Modified Date",
  1149. "example": "2020-01-30T09:41:04.000Z"
  1150. },
  1151. "owner_user_id": {
  1152. "type": "integer",
  1153. "minimum": 1,
  1154. "example": 1
  1155. },
  1156. "domain_names": {
  1157. "type": "array",
  1158. "minItems": 1,
  1159. "items": {
  1160. "type": "string",
  1161. "minLength": 1
  1162. }
  1163. },
  1164. "forward_host": {
  1165. "type": "string",
  1166. "minLength": 1
  1167. },
  1168. "forward_port": {
  1169. "type": "integer",
  1170. "minimum": 1
  1171. },
  1172. "access_list_id": {
  1173. "type": "integer"
  1174. },
  1175. "certificate_id": {
  1176. "type": "integer"
  1177. },
  1178. "ssl_forced": {
  1179. "type": "integer"
  1180. },
  1181. "caching_enabled": {
  1182. "type": "integer"
  1183. },
  1184. "block_exploits": {
  1185. "type": "integer"
  1186. },
  1187. "advanced_config": {
  1188. "type": "string"
  1189. },
  1190. "meta": {
  1191. "type": "object"
  1192. },
  1193. "allow_websocket_upgrade": {
  1194. "type": "integer"
  1195. },
  1196. "http2_support": {
  1197. "type": "integer"
  1198. },
  1199. "forward_scheme": {
  1200. "type": "string"
  1201. },
  1202. "enabled": {
  1203. "type": "integer"
  1204. },
  1205. "locations": {
  1206. "type": "array"
  1207. },
  1208. "hsts_enabled": {
  1209. "type": "integer"
  1210. },
  1211. "hsts_subdomains": {
  1212. "type": "integer"
  1213. },
  1214. "certificate": {
  1215. "type": "object",
  1216. "nullable": true
  1217. },
  1218. "owner": {
  1219. "type": "object",
  1220. "nullable": true
  1221. },
  1222. "access_list": {
  1223. "type": "object",
  1224. "nullable": true
  1225. },
  1226. "use_default_location": {
  1227. "type": "boolean"
  1228. },
  1229. "ipv6": {
  1230. "type": "boolean"
  1231. }
  1232. }
  1233. },
  1234. "ProxyHostsList": {
  1235. "type": "array",
  1236. "description": "Proxyn Hosts list",
  1237. "items": {
  1238. "$ref": "#/components/schemas/ProxyHostObject"
  1239. }
  1240. },
  1241. "SettingObject": {
  1242. "type": "object",
  1243. "description": "Setting object",
  1244. "required": ["id", "name", "description", "value", "meta"],
  1245. "additionalProperties": false,
  1246. "properties": {
  1247. "id": {
  1248. "type": "string",
  1249. "description": "Setting ID",
  1250. "minLength": 1,
  1251. "example": "default-site"
  1252. },
  1253. "name": {
  1254. "type": "string",
  1255. "description": "Setting Display Name",
  1256. "minLength": 1,
  1257. "example": "Default Site"
  1258. },
  1259. "description": {
  1260. "type": "string",
  1261. "description": "Meaningful description",
  1262. "minLength": 1,
  1263. "example": "What to show when Nginx is hit with an unknown Host"
  1264. },
  1265. "value": {
  1266. "description": "Value in almost any form",
  1267. "example": "congratulations",
  1268. "oneOf": [
  1269. {
  1270. "type": "string",
  1271. "minLength": 1
  1272. },
  1273. {
  1274. "type": "integer"
  1275. },
  1276. {
  1277. "type": "object"
  1278. },
  1279. {
  1280. "type": "number"
  1281. },
  1282. {
  1283. "type": "array"
  1284. }
  1285. ]
  1286. },
  1287. "meta": {
  1288. "description": "Extra metadata",
  1289. "example": {},
  1290. "type": "object"
  1291. }
  1292. }
  1293. },
  1294. "SettingsList": {
  1295. "type": "array",
  1296. "description": "Setting list",
  1297. "items": {
  1298. "$ref": "#/components/schemas/SettingObject"
  1299. }
  1300. },
  1301. "UserObject": {
  1302. "type": "object",
  1303. "description": "User object",
  1304. "required": ["id", "created_on", "modified_on", "is_disabled", "email", "name", "nickname", "avatar", "roles"],
  1305. "additionalProperties": false,
  1306. "properties": {
  1307. "id": {
  1308. "type": "integer",
  1309. "description": "User ID",
  1310. "minimum": 1,
  1311. "example": 1
  1312. },
  1313. "created_on": {
  1314. "type": "string",
  1315. "description": "Created Date",
  1316. "example": "2020-01-30T09:36:08.000Z"
  1317. },
  1318. "modified_on": {
  1319. "type": "string",
  1320. "description": "Modified Date",
  1321. "example": "2020-01-30T09:41:04.000Z"
  1322. },
  1323. "is_disabled": {
  1324. "type": "integer",
  1325. "minimum": 0,
  1326. "maximum": 1,
  1327. "description": "Is user Disabled (0 = false, 1 = true)",
  1328. "example": 0
  1329. },
  1330. "email": {
  1331. "type": "string",
  1332. "description": "Email",
  1333. "minLength": 3,
  1334. "example": "[email protected]"
  1335. },
  1336. "name": {
  1337. "type": "string",
  1338. "description": "Name",
  1339. "minLength": 1,
  1340. "example": "Jamie Curnow"
  1341. },
  1342. "nickname": {
  1343. "type": "string",
  1344. "description": "Nickname",
  1345. "example": "James"
  1346. },
  1347. "avatar": {
  1348. "type": "string",
  1349. "description": "Gravatar URL based on email, without scheme",
  1350. "example": "//www.gravatar.com/avatar/6193176330f8d38747f038c170ddb193?default=mm"
  1351. },
  1352. "roles": {
  1353. "description": "Roles applied",
  1354. "example": ["admin"],
  1355. "type": "array",
  1356. "items": {
  1357. "type": "string"
  1358. }
  1359. }
  1360. }
  1361. },
  1362. "UsersList": {
  1363. "type": "array",
  1364. "description": "User list",
  1365. "items": {
  1366. "$ref": "#/components/schemas/UserObject"
  1367. }
  1368. },
  1369. "AuthObject": {
  1370. "type": "object",
  1371. "description": "Authentication Object",
  1372. "required": ["type", "secret"],
  1373. "properties": {
  1374. "type": {
  1375. "type": "string",
  1376. "pattern": "^password$",
  1377. "example": "password"
  1378. },
  1379. "current": {
  1380. "type": "string",
  1381. "minLength": 1,
  1382. "maxLength": 64,
  1383. "example": "changeme"
  1384. },
  1385. "secret": {
  1386. "type": "string",
  1387. "minLength": 8,
  1388. "maxLength": 64,
  1389. "example": "mySuperN3wP@ssword!"
  1390. }
  1391. }
  1392. },
  1393. "PermissionsObject": {
  1394. "type": "object",
  1395. "properties": {
  1396. "visibility": {
  1397. "type": "string",
  1398. "description": "Visibility Type",
  1399. "enum": ["all", "user"]
  1400. },
  1401. "access_lists": {
  1402. "type": "string",
  1403. "description": "Access Lists Permissions",
  1404. "enum": ["hidden", "view", "manage"]
  1405. },
  1406. "dead_hosts": {
  1407. "type": "string",
  1408. "description": "404 Hosts Permissions",
  1409. "enum": ["hidden", "view", "manage"]
  1410. },
  1411. "proxy_hosts": {
  1412. "type": "string",
  1413. "description": "Proxy Hosts Permissions",
  1414. "enum": ["hidden", "view", "manage"]
  1415. },
  1416. "redirection_hosts": {
  1417. "type": "string",
  1418. "description": "Redirection Permissions",
  1419. "enum": ["hidden", "view", "manage"]
  1420. },
  1421. "streams": {
  1422. "type": "string",
  1423. "description": "Streams Permissions",
  1424. "enum": ["hidden", "view", "manage"]
  1425. },
  1426. "certificates": {
  1427. "type": "string",
  1428. "description": "Certificates Permissions",
  1429. "enum": ["hidden", "view", "manage"]
  1430. }
  1431. }
  1432. },
  1433. "HostReportObject": {
  1434. "type": "object",
  1435. "properties": {
  1436. "proxy": {
  1437. "type": "integer",
  1438. "description": "Proxy Hosts Count"
  1439. },
  1440. "redirection": {
  1441. "type": "integer",
  1442. "description": "Redirection Hosts Count"
  1443. },
  1444. "stream": {
  1445. "type": "integer",
  1446. "description": "Streams Count"
  1447. },
  1448. "dead": {
  1449. "type": "integer",
  1450. "description": "404 Hosts Count"
  1451. }
  1452. }
  1453. }
  1454. }
  1455. }
  1456. }