forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yml
3867 lines (3803 loc) · 122 KB
/
swagger.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
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Tyk Gateway API
version: 5.0.0
description: |-
The Tyk Gateway API is the primary means for integrating your application with the Tyk API Gateway system. This API is very small, and has no granular permissions system. It is intended to be used purely for internal automation and integration.
**Warning: Under no circumstances should outside parties be granted access to this API.**
The Tyk Gateway API is capable of:
* Managing session objects (key generation)
* Managing and listing policies
* Managing and listing API Definitions (only when not using the Dashboard)
* Hot reloads / reloading a cluster configuration
* OAuth client creation (only when not using the Dashboard)
In order to use the Gateway API, you'll need to set the `secret` parameter in your tyk.conf file.
The shared secret you set should then be sent along as a header with each Gateway API Request in order for it to be successful:
```
x-tyk-authorization: <your-secret>
```
<br/>
<b>The Tyk Gateway API is subsumed by the Tyk Dashboard API in Pro installations.</b>
servers:
- url: 'http://localhost/'
- url: 'https://localhost/'
tags:
- name: Keys
description: |-
All keys that are used to access services via Tyk correspond to a session object that informs Tyk about the context of this particular token, like access rules and rate/quota allowance.
- name: Policies
description: |-
A Tyk security policy incorporates several security options that can be applied to an API key. It acts as a template that can override individual sections of an API key (or identity) in Tyk.
- name: OAuth
description: |-
Manage OAuth clients, and manage their tokens
- name: Cache Invalidation
description: |-
Sometimes a cache might contain stale data, or it may just need to be cleared because of an invalid configuration. This call will purge all keys associated with a cache on an API-by-API basis.
- name: Hot Reload
description:
Force restart of the Gateway or whole cluster
- name: Health Checking
description: Check health check of the Gateway and loaded APIs
- name: Organisation Quotas
description: |-
It is possible to force API quota and rate limit across all keys that belong to a specific organisation ID. Rate limiting at an organisation level is useful for creating tiered access levels and trial accounts.
The Organisation rate limiting middleware works with both Quotas and Rate Limiters. In order to manage this functionality, a simple API has been put in place to manage these sessions.
Although the Organisation session-limiter uses the same session object, all other security keys are optional as they are not used.
<h3>Managing active status</h3>
To disallow access to an entire group of keys without rate limiting the organisation, create a session object with the "is_inactive" key set to true. This will block access before any other middleware is executed. It is useful when managing subscriptions for an organisation group and access needs to be blocked because of non-payment.
- name: Batch requests
description: |-
Tyk supports batch requests, so a client makes a single request to the API but gets a compound response object back.
This is especially handy if clients have complex requests that have multiple synchronous dependencies and do not wish to have the entire request / response cycle running for each event.
To enable batch request support, set the `enable_batch_request_support` value to `true`
This is especially handy if clients have complex requests that have multiple synchronous dependencies and do not wish to have the entire request / response cycle running for each event.
Batch requests that come into Tyk are *run through the whole Tyk machinery* and *use a relative path to prevent spamming*. This means that a batch request to Tyk for three resources with the same API key will have three requests applied to their session quota and request limiting could become active if they are being throttled.
Tyk reconstructs the API request based on the data in the batch request. This is to ensure that Tyk is not being used to proxy requests to other hosts outside of the upstream API being accessed.
Batch requests are created by POSTing to the `/{listen_path}/tyk/batch/` endpoint. These requests **do not require a valid key**, but their request list does.
<h3>Sample Request</h3>
```{json}
{
"requests": [
{
"method": "GET",
"headers": {
"x-tyk-test": "1",
"x-tyk-version": "1.2",
"authorization": "1dbc83b9c431649d7698faa9797e2900f"
},
"body": "",
"relative_url": "get"
},
{
"method": "GET",
"headers": {
"x-tyk-test": "2",
"x-tyk-version": "1.2",
"authorization": "1dbc83b9c431649d7698faa9797e2900f"
},
"body": "",
"relative_url": "get"
}
],
"suppress_parallel_execution": false
}
```
The response will will be a structured reply that encapsulates the responses for each of the outbound requests. If `suppress_parallel_execution` is set to `true`, requests will be made synchronously. If set to `false` then they will run in parallel and the response order is not guaranteed.
<h3>Sample Response</h3>
```
[
{
"relative_url": "get",
"code": 200,
"headers": {
"Access-Control-Allow-Credentials": [
"true"
],
"Access-Control-Allow-Origin": [
"*"
],
"Content-Length": [
"497"
],
"Content-Type": [
"application/json"
],
"Date": [
"Wed, 12 Nov 2014 15:32:43 GMT"
],
"Server": [
"gunicorn/18.0"
],
"Via": [
"1.1 vegur"
]
},
"body": "{
"args": {},
"headers": {
"Accept-Encoding": "gzip",
"Authorization": "1dbc83b9c431649d7698faa9797e2900f",
"Connect-Time": "2",
"Connection": "close",
"Host": "httpbin.org",
"Total-Route-Time": "0",
"User-Agent": "Go 1.1 package http",
"Via": "1.1 vegur",
"X-Request-Id": "6a22499a-2776-4aa1-80c0-686581a8be4d",
"X-Tyk-Test": "2",
"X-Tyk-Version": "1.2"
},
"origin": "127.0.0.1, 62.232.114.250",
"url": "http://httpbin.org/get"
}"
},
{
"relative_url": "get",
"code": 200,
"headers": {
"Access-Control-Allow-Credentials": [
"true"
],
"Access-Control-Allow-Origin": [
"*"
],
"Content-Length": [
"497"
],
"Content-Type": [
"application/json"
],
"Date": [
"Wed, 12 Nov 2014 15:32:43 GMT"
],
"Server": [
"gunicorn/18.0"
],
"Via": [
"1.1 vegur"
]
},
"body": "{
"args": {},
"headers": {
"Accept-Encoding": "gzip",
"Authorization": "1dbc83b9c431649d7698faa9797e2900f",
"Connect-Time": "7",
"Connection": "close",
"Host": "httpbin.org",
"Total-Route-Time": "0",
"User-Agent": "Go 1.1 package http",
"Via": "1.1 vegur",
"X-Request-Id": "1ab61f50-51ff-4828-a7e2-17240385a6d2",
"X-Tyk-Test": "1",
"X-Tyk-Version": "1.2"
},
"origin": "127.0.0.1, 62.232.114.250",
"url": "http://httpbin.org/get"
}"
}
]
```
With the body for each request string encoded in the `body` field.
* `expire_analytics_after`: If you are running a busy API, you may want to ensure that your MongoDB database does not overflow with old data. Set the `expire_analytics_after` value to the number of seconds you would like the data to last for. Setting this flag to anything above `0` will set an `expireAt` field for each record that is written to the database.
**Important:** Tyk will not create the expiry index for you. In order to implement data expiry for your analytics data, ensure that the index is created This is easily achieved using the [MongoDB command line interface](https://docs.mongodb.com/getting-started/shell/client/).
* `dont_set_quota_on_create`: This setting defaults to `false`, but if set to `true`, when the API is used to edit, create or add keys, the quota cache in Redis will not be re-set. By default, all updates or creates to Keys that have Quotas set will re-set the quota (This has been the default behaviour since 1.0).
This behaviour can be bypassed on a case-by-case basis by using the `suppress_reset` parameter when making a REST API request. This is the advised mode of operation as it allows for manual, granular control over key quotas and reset timings.
* `cache_options`: This section enables you to configure the caching behaviour of Tyk and to enable or disable the caching middleware for your API.
* `cache_options.enable_cache`: Set this value to `true` if the cache should be enabled for this endpoint, setting it to false will stop all caching behaviour.
* `cache_options.cache_timeout`: The amount of time, in seconds, to keep cached objects, defaults to `60` seconds.
* `cache_options.cache_all_safe_requests`: Set this to `true` if you want all *safe* requests (GET, HEAD, OPTIONS) to be cached. This is a blanket setting for APIs where caching is required but you don't want to set individual paths up in the definition.
* `cache_options.enable_upstream_cache_control`: Set this to `true` if you want your application to control the cache options for Tyk (TTL and whether to cache or not). See [Caching](/docs/basic-config-and-security/reduce-latency/caching/) for more details.
* `response_processors`: Response processors need to be specifically defined so they are loaded on API creation, otherwise the middleware will not fire. In order to have the two main response middleware components fire, the following configuration object should be supplied.
```{json}
"response_processors": [
{
"name": "header_injector",
"options": {
"add_headers": {"name": "value"},
"remove_headers": ["name"]
}
},
{
"name": "response_body_transform",
"options": {}
}
]
```
The options for the `header_injector` are global, and will apply to all outbound requests.
- name: APIs
description: |-
**Note: Applies only to Tyk Gateway Community Edition**
API Management is very simple using the Tyk REST API: each update only affects the underlying file, and this endpoint will only work with disk based installations, not Database-backed ones.
APIs that are added this way are flushed to to disk into the app_path folder using the format: `{api-id}.json`. Updating existing APIs that use a different naming convention will cause those APIs to be added, which could subsequently lead to a loading error and crash if they use the same listen_path.
These methods only work on a single API node. If updating a cluster, it is important to ensure that all nodes are updated before initiating a reload.
paths:
'/tyk/apis':
get:
description: |-
List APIs
Only if used without the Tyk Dashboard
tags:
- APIs
operationId: listApis
responses:
'200':
description: List of API definitions
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/APIDefinition'
example:
- name: "TestAPI"
use_keyless: true
active: true
proxy:
listen_path: "/test"
post:
description: |-
Create API
A single Tyk node can have its API Definitions queried, deleted and updated remotely. This functionality enables you to remotely update your Tyk definitions without having to manage the files manually.
tags:
- APIs
operationId: createApi
parameters:
- name: base_api_id
in: query
required: false
schema:
type: string
description: The base API which the new version will be linked to.
- name: base_api_version_name
in: query
required: false
schema:
type: string
description: The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.
- name: new_version_name
in: query
required: false
schema:
type: string
description: The version name of the created version.
- name: set_default
in: query
required: false
schema:
type: boolean
description: If true, the new version is set as default version.
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/APIDefinition"
example:
name: "TestAPI"
use_keyless: true
active: true
proxy:
listen_path: "/test"
responses:
'200':
description: API created
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "created"
key: "{...API JSON definition...}"
'400':
description: Malformed data
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
status: "error"
message: "Malformed API data"
/tyk/apis/oas:
get:
description: |-
List all OAS format APIs, when used without the Tyk Dashboard.
tags:
- OAS APIs
operationId: listApisOAS
parameters:
- description: |-
Mode of OAS get, by default mode could be empty which means to get OAS spec including OAS Tyk extension.
When mode=public, OAS spec excluding Tyk extension will be returned in the response
name: mode
in: query
schema:
type: string
example: public
responses:
'200':
description: List of API definitions in OAS format
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OASSchemaResponse'
post:
description: |-
Create API with OAS format
A single Tyk node can have its API Definitions queried, deleted and updated remotely. This functionality enables you to remotely update your Tyk definitions without having to manage the files manually.
tags:
- OAS APIs
operationId: createApiOAS
parameters:
- name: base_api_id
in: query
required: false
schema:
type: string
description: The base API which the new version will be linked to.
- name: base_api_version_name
in: query
required: false
schema:
type: string
description: The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.
- name: new_version_name
in: query
required: false
schema:
type: string
description: The version name of the created version.
- name: set_default
in: query
required: false
schema:
type: boolean
description: If true, the new version is set as default version.
requestBody:
content:
application/json:
schema:
$ref: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json"
responses:
'200':
description: API created
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "created"
key: "{...API JSON definition...}"
'400':
description: Malformed data
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
status: "error"
message: "Malformed API data"
'/tyk/apis/{apiID}':
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
get:
description: |-
Get API definition
Only if used without the Tyk Dashboard
tags:
- APIs
operationId: getApi
responses:
'200':
description: API definition
content:
application/json:
schema:
$ref: "#/components/schemas/APIDefinition"
example:
name: "TestAPI"
use_keyless: true
active: true
proxy:
listen_path: "/test"
headers:
x-tyk-base-api-id:
schema:
type: string
description: ID of the base API if the requested API is a version.
put:
description: |
Updating an API definition uses the same signature an object as a `POST`, however it will first ensure that the API ID that is being updated is the same as the one in the object being `PUT`.
Updating will completely replace the file descriptor and will not change an API Definition that has already been loaded, the hot-reload endpoint will need to be called to push the new definition to live.
tags:
- APIs
operationId: updateApi
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/APIDefinition"
example:
name: "TestAPI"
use_keyless: true
active: true
proxy:
listen_path: "/test"
responses:
'200':
description: API updated
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "updated"
key: "{...API JSON definition...}"
'400':
description: Malformed data
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
status: "error"
message: "Malformed API data"
delete:
description: |-
Deleting an API definition will remove the file from the file store, the API definition will NOT be unloaded, a separate reload request will need to be made to disable the API endpoint.
tags:
- APIs
operationId: deleteApi
responses:
'200':
description: API deleted
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
message: API deleted
status: ok
'400':
description: No API ID specified
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
message: API ID not specified
status: error
/tyk/apis/{apiID}/versions:
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
get:
description: |-
Listing versions of an OAS API
tags:
- APIs
operationId: listApiVersions
parameters:
- $ref: '#/components/parameters/SearchText'
- $ref: '#/components/parameters/AccessType'
responses:
'200':
description: API version metas
content:
application/json:
schema:
properties:
apis:
type: array
items:
$ref: '#/components/schemas/APIVersionMeta'
'/tyk/apis/oas/{apiID}':
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
get:
description: |-
Get API definition in OAS format
Only if used without the Tyk Dashboard
tags:
- OAS APIs
parameters:
- description: |-
Mode of OAS get, by default mode could be empty which means to get OAS spec including OAS Tyk extension.
When mode=public, OAS spec excluding Tyk extension will be returned in the response
name: mode
in: query
schema:
type: string
example: public
operationId: listApiOAS
responses:
'200':
description: API definition
content:
application/json:
schema:
$ref: "#/components/schemas/OASSchemaResponse"
headers:
x-tyk-base-api-id:
schema:
type: string
description: ID of the base API if the requested API is a version.
put:
description: |
Updating an API definition uses the same signature an object as a `POST`, however it will first ensure that the API ID that is being updated is the same as the one in the object being `PUT`.
Updating will completely replace the file descriptor and will not change an API Definition that has already been loaded, the hot-reload endpoint will need to be called to push the new definition to live.
tags:
- OAS APIs
operationId: updateApiOAS
requestBody:
content:
application/json:
schema:
$ref: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json"
responses:
'200':
description: API updated
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "updated"
key: "{...API JSON definition...}"
'400':
description: Malformed data
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
status: "error"
message: "Malformed API data"
patch:
summary: Patch a single OAS API by ID
description: |-
Update API with OAS format. You can use this endpoint to update OAS part of the tyk API definition.
This endpoint allows you to configure tyk OAS extension based on query params provided(similar to import)
tags:
- OAS APIs
operationId: patchApiOAS
parameters:
- $ref: '#/components/parameters/UpstreamURL'
- $ref: '#/components/parameters/ListenPath'
- $ref: '#/components/parameters/CustomDomain'
- $ref: '#/components/parameters/ValidateRequest'
- $ref: '#/components/parameters/AllowList'
- $ref: '#/components/parameters/MockResponse'
- $ref: '#/components/parameters/Authentication'
requestBody:
content:
application/json:
schema:
$ref: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json"
responses:
'200':
description: API patched
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "modified"
key: "{updated APIID}"
'400':
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
examples:
malformedBody:
summary: When the request body is malformed
value:
message: "Request malformed"
status: "error"
missingAPIID:
summary: When the request is missing APIID in query Param
value:
message: "Must specify an apiID to patch"
status: "error"
nonExistingAPIID:
summary: When the client sends and APIID which doesn't exists in tyk gw
value:
message: "No API found for APIID {APIID}"
status: "error"
invalidUpstreamURL:
summary: When the client sends query param upstreamURL which isn't valid
value:
message: "invalid upstream URL"
status: "error"
500:
description: When patch request is send while using dashboard app configs
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
summary: dashboard app configs is used for tyk api definitions
value:
message: "Due to enabled use_db_app_configs, please use the Dashboard API"
status: "error"
delete:
description: |-
Deleting an API definition will remove the file from the file store, the API definition will NOT be unloaded, a separate reload request will need to be made to disable the API endpoint.
tags:
- OAS APIs
operationId: deleteOASApi
responses:
'200':
description: API deleted
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
message: API deleted
status: ok
'400':
description: No API ID specified
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
message: API ID not specified
status: error
/tyk/apis/oas/{apiID}/versions:
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
get:
description: |-
Listing versions of an OAS API
tags:
- OASAPIs
operationId: listOASApiVersions
parameters:
- $ref: '#/components/parameters/SearchText'
- $ref: '#/components/parameters/AccessType'
responses:
'200':
description: API version metas
content:
application/json:
schema:
properties:
apis:
type: array
items:
$ref: '#/components/schemas/APIVersionMeta'
'/tyk/apis/oas/{apiID}/export':
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
get:
description: |-
Download all OAS format APIs, when used without the Tyk Dashboard.
tags:
- OAS APIs
operationId: downloadApiOASPublic
parameters:
- description: |-
Mode of OAS export, by default mode could be empty which means to export OAS spec including OAS Tyk extension.
When mode=public, OAS spec excluding Tyk extension is exported
name: mode
in: query
schema:
type: string
example: public
responses:
'200':
description: API definition
content:
application/json:
schema:
$ref: "#/components/schemas/OASSchemaResponse"
/tyk/apis/oas/export:
get:
description: |-
Download all OAS format APIs, when used without the Tyk Dashboard.
tags:
- OAS APIs
operationId: downloadApisOASPublic
parameters:
- description: |-
The mode of OAS export. By default the mode is not set which means the OAS spec is exported including the OAS Tyk extension.
If the mode is set to public, the OAS spec excluding the Tyk extension is exported.
name: mode
in: query
schema:
type: string
example: public
responses:
'200':
description: API definition
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OASSchemaResponse'
/tyk/apis/oas/import:
post:
description: |-
Create a new OAS format API, without x-tyk-gateway.
For use with an existing OAS API that you want to expose via your Tyk Gateway. (New)
tags:
- OAS APIs
operationId: importOAS
parameters:
- $ref: '#/components/parameters/UpstreamURL'
- $ref: '#/components/parameters/ListenPath'
- $ref: '#/components/parameters/CustomDomain'
- $ref: '#/components/parameters/ApiID'
- $ref: '#/components/parameters/AllowList'
- $ref: '#/components/parameters/MockResponse'
- $ref: '#/components/parameters/ValidateRequest'
- $ref: '#/components/parameters/Authentication'
requestBody:
content:
application/json:
schema:
$ref: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json"
responses:
'200':
description: API definition created
content:
application/json:
schema:
$ref: "#/components/schemas/apiModifyKeySuccess"
example:
status: "ok"
action: "added"
key: "{created APIID}"
'400':
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
examples:
malformedBody:
summary: When the request body is malformed
value:
message: "Request malformed"
status: "error"
invalidUpstreamURL:
summary: When the client sends a query param upstreamURL which isn't valid
value:
message: "invalid upstream URL"
status: "error"
500:
description: When an import request is sent using your Tyk Dashboard app configs
content:
application/json:
schema:
$ref: "#/components/schemas/apiStatusMessage"
example:
summary: Tyk Dashboard app configs are being used for Tyk API definitions
value:
message: "Due to enabled use_db_app_configs, please use the Dashboard API"
status: "error"
'/tyk/cache/{apiID}':
parameters:
- description: The API ID
name: apiID
in: path
required: true
schema:
type: string
delete:
summary: Invalidate cache
description: Invalidate cache for the given API
tags:
- Cache Invalidation
operationId: invalidateCache
responses:
'200':
description: Invalidate cache
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
message: cache invalidated
status: ok
'/tyk/reload/':
get:
summary: Hot-reload a single node
description: Tyk is capable of reloading configurations without having to stop serving requests. This means that API configurations can be added at runtime, or even modified at runtime and those rules applied immediately without any downtime.
parameters:
- description: Block a response until the reload is performed. This can be useful in scripting environments like CI/CD workflows.
name: block
in: query
required: false
schema:
type: boolean
enum: [true]
tags:
- Hot Reload
operationId: hotReload
responses:
'200':
description: Reload gateway
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
status: ok
'/tyk/reload/group':
get:
summary: Hot-reload a Tyk group
description: To reload a whole group of Tyk nodes (without using the Dashboard or host manager). You can send an API request to a single node, this node will then send a notification through the pub/sub infrastructure to all other listening nodes (including the host manager if it is being used to manage NginX) which will then trigger a global reload.
tags:
- Hot Reload
operationId: hotReloadGroup
responses:
'200':
description: Reload the Tyk Gateway
content:
application/json:
schema:
$ref: '#/components/schemas/apiStatusMessage'
example:
status: ok
'/tyk/hello':
get:
summary: Check the Health of the Tyk Gateway
description: |
From v2.7.5 you can now rename the `/hello` endpoint by using the `health_check_endpoint_name` option
Returns 200 response in case of success
tags:
- Health Checking
operationId: hello
responses:
'200':
description: Success
content:
text/html:
schema:
type: string
example: "Hello Tiki"
'/tyk/certs':
get:
parameters:
- description: Organisation ID to list the certificates
in: query
name: org_id
required: true
schema:
type: string
- description: Mode to list the certificate details
name: mode
in: query
required: false
schema:
type: string
example: 'detailed'
- description: Comma separated list of certificates to list
name: certID
in: query
required: false
schema:
type: string
example: 'e6ce2b49-3e31-44de-95a7-12f054724283,234a37ac-28d1-4f12-b936-ffb4211b79f1'
summary: List Certificates
description: List All Certificates in the Tyk Gateway
tags:
- Certs
operationId: listCerts
responses:
'200':
description: List of all Certificates
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/APIAllCertificates'
- $ref: '#/components/schemas/APIAllCertificateBasics'
- type: array
items:
$ref: '#/components/schemas/CertificateMeta'
post:
summary: Add a certificate
description: Add a certificate to the Tyk Gateway
tags:
- Certs
operationId: addCert
parameters:
- description: Organisation ID to list the certificates
in: query
name: org_id
required: true
schema:
type: string
requestBody:
content:
text/plain:
schema:
type: string