-
Notifications
You must be signed in to change notification settings - Fork 789
/
api.yml
587 lines (581 loc) · 18.2 KB
/
api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
# Copyright 2024 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
openapi: 3.0.1
info:
title: Outline Server Management
description: API to manage an Outline server. See [getoutline.org](https://getoutline.org).
version: '1.0'
tags:
- name: Server
description: Server-level functions
- name: Access Key
description: Access key functions
- name: Experimental
description: Experimental functions. These are unstable and may disappear. Use with care.
servers:
- url: https://myserver/SecretPath
description: Example URL. Change to your own server.
paths:
/server:
get:
tags:
- Server
description: Returns information about the server
responses:
'200':
description: Server information
content:
application/json:
schema:
$ref: "#/components/schemas/Server"
examples:
'No data limit':
value: >-
{"name":"My Server","serverId":"40f1b4a3-5c82-45f4-80a6-a25cf36734d3","metricsEnabled":true,"createdTimestampMs":1536613192052,"version":"1.0.0","portForNewAccessKeys":1234,"hostnameForAccessKeys":"example.com"}
'Per-key data limit':
value: >-
{"name":"My Server","serverId":"7fda0079-5317-4e5a-bb41-5a431dddae21","metricsEnabled":true,"createdTimestampMs":1536613192052,"version":"1.0.0","accessKeyDataLimit":{"bytes":8589934592},"portForNewAccessKeys":1234,"hostnameForAccessKeys":"example.com"}
/server/hostname-for-access-keys:
put:
tags:
- Server
description: Changes the hostname for access keys. Must be a valid hostname or IP address. If it's a hostname, DNS must be set up independently of this API.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
hostname:
type: string
examples:
'hostname':
value: '{"hostname": "www.example.org"}'
'IP address':
value: '{"hostname": "127.0.0.1"}'
responses:
'204':
description: The hostname was successfully changed.
'400':
description: An invalid hostname or IP address was provided.
'500':
description: An internal error occurred. This could be thrown if there were network errors while validating the hostname
/server/port-for-new-access-keys:
put:
description: Changes the default port for newly created access keys. This can be a port already used for access keys.
tags:
- Access Key
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
port:
type: number
examples:
'0':
value: '{"port": 12345}'
responses:
'204':
description: The default port was successfully changed.
'400':
description: The requested port wasn't an integer from 1 through 65535, or the request had no port parameter.
'409':
description: The requested port was already in use by another service.
/server/access-key-data-limit:
put:
description: Sets a data transfer limit for all access keys
tags:
- Access Key
- Limit
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DataLimit"
examples:
'0':
value: '{"limit": {"bytes": 10000}}'
responses:
'204':
description: Access key data limit set successfully
'400':
description: Invalid data limit
delete:
description: Removes the access key data limit, lifting data transfer restrictions on all access keys.
tags:
- Access Key
- Limit
responses:
'204':
description: Access key limit deleted successfully.
/experimental/server/metrics:
get:
tags:
- Experimental
parameters:
- in: query
name: since
description: the range of time to return data for
schema:
type: string
responses:
'200':
description: Display server metric information
content:
application/json:
schema:
type: object
properties:
server:
type: array
items:
type: object
properties:
location:
type: string
asn:
type: number
asOrg:
type: string
tunnelTime:
type: object
properties:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
type: number
accessKeys:
type: array
items:
type: object
properties:
accessKeyId:
type: string
tunnelTime:
type: object
properties:
seconds:
type: number
dataTransferred:
type: object
properties:
bytes:
type: number
examples:
'0':
value: '{"server":[{"location":"US","asn":null,"asOrg":null,"tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100}}],"accessKeys":[{"accessKeyId":"0","tunnelTime":{"seconds":100},"dataTransferred":{"bytes":100}}]}'
/name:
put:
description: Renames the server
tags:
- Server
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
examples:
'0':
value: '{"name":"My Server"}'
responses:
'204':
description: Server renamed successfully
'400':
description: Invalid name
/access-keys:
post:
description: Creates a new access key
tags:
- Access Key
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
method:
type: string
password:
type: string
port:
type: integer
limit:
$ref: "#/components/schemas/DataLimit"
examples:
'No params specified':
value: '{"method":"aes-192-gcm"}'
'Provide params':
value: '{"method":"aes-192-gcm","name":"First","password":"8iu8V8EeoFVpwQvQeS9wiD","port": 12345,"limit":{"bytes":10000}}'
responses:
'201':
description: The newly created access key
content:
application/json:
schema:
$ref: "#/components/schemas/AccessKey"
examples:
'0':
value: >-
{"id":"0","name":"First","password":"XxXxXx","port":9795,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:9795/?outline=1"}
'1':
value: >-
{"id":"1","name":"Second","password":"xXxXxX","port":9795,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:9795/?outline=1"}
get:
description: Lists the access keys
tags:
- Access Key
responses:
'200':
description: List of access keys
content:
application/json:
schema:
type: object
properties:
accessKeys:
type: array
items:
$ref: "#/components/schemas/AccessKey"
examples:
'0':
value: >-
{"accessKeys":[
{"id":"0","name":"Admin","password":"XxXxXx","port":18162,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:18162/?outline=1"},
{"id":"1","name":"First","password":"xXxXxX","port":4410,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:4410/?outline=1"},
{"id":"2","name":"SecondWithCustomDataLimit","password":"XxXxXx","port":25424,"method":"chacha20-ietf-poly1305","dataLimit":{"bytes":8589934592},"accessUrl":"ss://[email protected]:25424/?outline=1"}]}
/access-keys/{id}:
put:
description: Creates a new access key with a specific identifer
tags:
- Access Key
parameters:
- name: id
in: path
required: true
description: The id for which to create an access key
schema:
type: string
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
method:
type: string
password:
type: string
port:
type: integer
limit:
$ref: "#/components/schemas/DataLimit"
examples:
'0':
value: '{"method":"aes-192-gcm","name":"First","password":"8iu8V8EeoFVpwQvQeS9wiD","port": 12345,"limit":{"bytes":10000}}'
responses:
'201':
description: The newly created access key
content:
application/json:
schema:
$ref: "#/components/schemas/AccessKey"
examples:
'0':
value: >-
{"id":"my-identifier","name":"First","password":"XxXxXx","port":9795,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:9795/?outline=1"}
get:
description: Get an access key
tags:
- Access Key
parameters:
- name: id
in: path
required: true
description: The id to get the access key
schema:
type: string
responses:
'200':
description: The access key
content:
application/json:
schema:
$ref: "#/components/schemas/AccessKey"
examples:
'0':
value: '{"id":"0","name":"Admin","password":"XxXxXx","port":18162,"method":"chacha20-ietf-poly1305","accessUrl":"ss://[email protected]:18162/?outline=1"}'
'404':
description: Access key inexistent
content:
application/json:
schema:
type: object
properties:
code:
type: string
message:
type: string
examples:
'0':
value: >-
{"code":"NotFoundError","message":"No access key found"}
delete:
description: Deletes an access key
tags:
- Access Key
parameters:
- name: id
in: path
required: true
description: The id of the access key to delete
schema:
type: string
responses:
'204':
description: Access key deleted successfully
'404':
description: Access key inexistent
content:
application/json:
schema:
type: object
properties:
code:
type: string
message:
type: string
examples:
'0':
value: >-
{"code":"NotFoundError","message":"No access key found with
id 9"}
/access-keys/{id}/name:
put:
description: Renames an access key
tags:
- Access Key
parameters:
- name: id
in: path
required: true
description: The id of the access key to rename
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
examples:
'0':
value: '{"name": "New Key Name"}'
responses:
'204':
description: Access key renamed successfully
'404':
description: Access key inexistent
/access-keys/{id}/data-limit:
put:
description: Sets a data limit for the given access key
tags:
- Access Key
- Limit
parameters:
- name: id
in: path
required: true
description: The id of the access key
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DataLimit"
examples:
'0':
value: '{"limit": {"bytes": 10000}}'
responses:
'204':
description: Access key limit set successfully
'400':
description: Invalid data limit
'404':
description: Access key inexistent
delete:
description: Removes the data limit on the given access key.
tags:
- Access Key
- Limit
parameters:
- name: id
in: path
required: true
description: The id of the access key
schema:
type: string
responses:
'204':
description: Access key limit deleted successfully.
'404':
description: Access key inexistent
/metrics/transfer:
get:
description: Returns the data transferred per access key
tags:
- Access Key
responses:
'200':
description: The data transferred by each access key
content:
application/json:
schema:
type: object
properties:
bytesTransferredByUserId:
type: object
additionalProperties:
type: integer
examples:
'0':
value: '{"bytesTransferredByUserId":{"1":1008040941,"2":5958113497,"3":752221577}}'
/metrics/enabled:
get:
description: Returns whether metrics is being shared
tags:
- Server
responses:
'200':
description: The metrics enabled setting
content:
application/json:
schema:
type: object
properties:
metricsEnabled:
type: boolean
examples:
'0':
value: '{"metricsEnabled":true}'
put:
description: Enables or disables sharing of metrics
tags:
- Server
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
metricsEnabled:
type: boolean
examples:
'0':
value: '{"metricsEnabled": true}'
responses:
'204':
description: Setting successful
'400':
description: Invalid request
/experimental/access-key-data-limit:
put:
deprecated: true
description: (Deprecated) Sets a data transfer limit for all access keys
tags:
- Access Key
- Limit
- Experimental
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/DataLimit"
examples:
'0':
value: '{"limit": {"bytes": 10000}}'
responses:
'204':
description: Access key data limit set successfully
'400':
description: Invalid data limit
delete:
deprecated: true
description: (Deprecated) Removes the access key data limit, lifting data transfer restrictions on all access keys.
tags:
- Access Key
- Limit
- Experimental
responses:
'204':
description: Access key limit deleted successfully.
components:
schemas:
Server:
properties:
name:
type: string
serverId:
type: string
metricsEnabled:
type: boolean
createdTimestampMs:
type: number
portForNewAccessKeys:
type: integer
DataLimit:
properties:
bytes:
type: integer
minimum: 0
AccessKey:
required:
- id
properties:
id:
type: string
name:
type: string
password:
type: string
port:
type: integer
method:
type: string
accessUrl:
type: string