@unkey/api 0.26.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +485 -11
- package/dist/index.d.ts +485 -11
- package/dist/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,9 @@ interface paths {
|
|
|
19
19
|
"/v1/keys.getKey": {
|
|
20
20
|
get: operations["getKey"];
|
|
21
21
|
};
|
|
22
|
+
"/v1/keys.whoami": {
|
|
23
|
+
post: operations["whoami"];
|
|
24
|
+
};
|
|
22
25
|
"/v1/keys.deleteKey": {
|
|
23
26
|
post: operations["deleteKey"];
|
|
24
27
|
};
|
|
@@ -73,6 +76,18 @@ interface paths {
|
|
|
73
76
|
"/v1/ratelimits.limit": {
|
|
74
77
|
post: operations["limit"];
|
|
75
78
|
};
|
|
79
|
+
"/v1/ratelimits.setOverride": {
|
|
80
|
+
post: operations["ratelimit.setOverride"];
|
|
81
|
+
};
|
|
82
|
+
"/v1/ratelimits.listOverrides": {
|
|
83
|
+
get: operations["listOverrides"];
|
|
84
|
+
};
|
|
85
|
+
"/v1/ratelimits.deleteOverride": {
|
|
86
|
+
post: operations["deleteOverride"];
|
|
87
|
+
};
|
|
88
|
+
"/v1/ratelimits.getOverride": {
|
|
89
|
+
get: operations["getOverride"];
|
|
90
|
+
};
|
|
76
91
|
"/v1/migrations.createKeys": {
|
|
77
92
|
post: operations["v1.migrations.createKeys"];
|
|
78
93
|
};
|
|
@@ -353,13 +368,14 @@ interface components {
|
|
|
353
368
|
/**
|
|
354
369
|
* @description Unkey allows you to refill remaining verifications on a key on a regular interval.
|
|
355
370
|
* @example {
|
|
356
|
-
* "interval": "
|
|
357
|
-
* "amount": 10
|
|
371
|
+
* "interval": "monthly",
|
|
372
|
+
* "amount": 10,
|
|
373
|
+
* "refillDay": 10
|
|
358
374
|
* }
|
|
359
375
|
*/
|
|
360
376
|
refill?: {
|
|
361
377
|
/**
|
|
362
|
-
* @description Determines the rate at which verifications will be refilled.
|
|
378
|
+
* @description Determines the rate at which verifications will be refilled. When 'daily' is set for 'interval' 'refillDay' will be set to null.
|
|
363
379
|
* @example daily
|
|
364
380
|
* @enum {string}
|
|
365
381
|
*/
|
|
@@ -369,6 +385,12 @@ interface components {
|
|
|
369
385
|
* @example 100
|
|
370
386
|
*/
|
|
371
387
|
amount: number;
|
|
388
|
+
/**
|
|
389
|
+
* @description The day verifications will refill each month, when interval is set to 'monthly'. Value is not zero-indexed making 1 the first day of the month. If left blank it will default to the first day of the month. When 'daily' is set for 'interval' 'refillDay' will be set to null.
|
|
390
|
+
* @default 1
|
|
391
|
+
* @example 15
|
|
392
|
+
*/
|
|
393
|
+
refillDay?: number | null;
|
|
372
394
|
/**
|
|
373
395
|
* @description The unix timestamp in miliseconds when the key was last refilled.
|
|
374
396
|
* @example 100
|
|
@@ -517,6 +539,8 @@ interface components {
|
|
|
517
539
|
* - INSUFFICIENT_PERMISSIONS: you do not have the required permissions to perform this action
|
|
518
540
|
* - EXPIRED: The key was only valid for a certain time and has expired.
|
|
519
541
|
*
|
|
542
|
+
* These are validation codes, the HTTP status will be 200.
|
|
543
|
+
*
|
|
520
544
|
* @enum {string}
|
|
521
545
|
*/
|
|
522
546
|
code: "VALID" | "NOT_FOUND" | "FORBIDDEN" | "USAGE_EXCEEDED" | "RATE_LIMITED" | "UNAUTHORIZED" | "DISABLED" | "INSUFFICIENT_PERMISSIONS" | "EXPIRED";
|
|
@@ -666,8 +690,6 @@ interface operations {
|
|
|
666
690
|
ratelimit: string;
|
|
667
691
|
/** @description The name of the connected usagelimit service */
|
|
668
692
|
usagelimit: string;
|
|
669
|
-
/** @description The name of the connected analytics service */
|
|
670
|
-
analytics: string;
|
|
671
693
|
};
|
|
672
694
|
};
|
|
673
695
|
};
|
|
@@ -774,6 +796,123 @@ interface operations {
|
|
|
774
796
|
};
|
|
775
797
|
};
|
|
776
798
|
};
|
|
799
|
+
whoami: {
|
|
800
|
+
requestBody: {
|
|
801
|
+
content: {
|
|
802
|
+
"application/json": {
|
|
803
|
+
/**
|
|
804
|
+
* @description The actual key to fetch
|
|
805
|
+
* @example sk_123
|
|
806
|
+
*/
|
|
807
|
+
key: string;
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
};
|
|
811
|
+
responses: {
|
|
812
|
+
/** @description The configuration for a single key */
|
|
813
|
+
200: {
|
|
814
|
+
content: {
|
|
815
|
+
"application/json": {
|
|
816
|
+
/**
|
|
817
|
+
* @description The ID of the key
|
|
818
|
+
* @example key_123
|
|
819
|
+
*/
|
|
820
|
+
id: string;
|
|
821
|
+
/**
|
|
822
|
+
* @description The name of the key
|
|
823
|
+
* @example API Key 1
|
|
824
|
+
*/
|
|
825
|
+
name?: string;
|
|
826
|
+
/**
|
|
827
|
+
* @description The remaining number of requests for the key
|
|
828
|
+
* @example 1000
|
|
829
|
+
*/
|
|
830
|
+
remaining?: number;
|
|
831
|
+
/** @description The identity object associated with the key */
|
|
832
|
+
identity?: {
|
|
833
|
+
/**
|
|
834
|
+
* @description The identity ID associated with the key
|
|
835
|
+
* @example id_123
|
|
836
|
+
*/
|
|
837
|
+
id: string;
|
|
838
|
+
/**
|
|
839
|
+
* @description The external identity ID associated with the key
|
|
840
|
+
* @example ext123
|
|
841
|
+
*/
|
|
842
|
+
externalId: string;
|
|
843
|
+
};
|
|
844
|
+
/**
|
|
845
|
+
* @description Metadata associated with the key
|
|
846
|
+
* @example {
|
|
847
|
+
* "role": "admin",
|
|
848
|
+
* "plan": "premium"
|
|
849
|
+
* }
|
|
850
|
+
*/
|
|
851
|
+
meta?: {
|
|
852
|
+
[key: string]: unknown;
|
|
853
|
+
};
|
|
854
|
+
/**
|
|
855
|
+
* @description The timestamp in milliseconds when the key was created
|
|
856
|
+
* @example 1620000000000
|
|
857
|
+
*/
|
|
858
|
+
createdAt: number;
|
|
859
|
+
/**
|
|
860
|
+
* @description Whether the key is enabled
|
|
861
|
+
* @example true
|
|
862
|
+
*/
|
|
863
|
+
enabled: boolean;
|
|
864
|
+
/**
|
|
865
|
+
* @description The environment the key is associated with
|
|
866
|
+
* @example production
|
|
867
|
+
*/
|
|
868
|
+
environment?: string;
|
|
869
|
+
};
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
873
|
+
400: {
|
|
874
|
+
content: {
|
|
875
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
876
|
+
};
|
|
877
|
+
};
|
|
878
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
879
|
+
401: {
|
|
880
|
+
content: {
|
|
881
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
885
|
+
403: {
|
|
886
|
+
content: {
|
|
887
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
888
|
+
};
|
|
889
|
+
};
|
|
890
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
891
|
+
404: {
|
|
892
|
+
content: {
|
|
893
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
897
|
+
409: {
|
|
898
|
+
content: {
|
|
899
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
900
|
+
};
|
|
901
|
+
};
|
|
902
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
903
|
+
429: {
|
|
904
|
+
content: {
|
|
905
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
909
|
+
500: {
|
|
910
|
+
content: {
|
|
911
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
912
|
+
};
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
};
|
|
777
916
|
deleteKey: {
|
|
778
917
|
requestBody: {
|
|
779
918
|
content: {
|
|
@@ -915,8 +1054,9 @@ interface operations {
|
|
|
915
1054
|
/**
|
|
916
1055
|
* @description Unkey enables you to refill verifications for each key at regular intervals.
|
|
917
1056
|
* @example {
|
|
918
|
-
* "interval": "
|
|
919
|
-
* "amount": 100
|
|
1057
|
+
* "interval": "monthly",
|
|
1058
|
+
* "amount": 100,
|
|
1059
|
+
* "refillDay": 15
|
|
920
1060
|
* }
|
|
921
1061
|
*/
|
|
922
1062
|
refill?: {
|
|
@@ -927,6 +1067,11 @@ interface operations {
|
|
|
927
1067
|
interval: "daily" | "monthly";
|
|
928
1068
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
929
1069
|
amount: number;
|
|
1070
|
+
/**
|
|
1071
|
+
* @description The day of the month, when we will refill the remaining verifications. To refill on the 15th of each month, set 'refillDay': 15.
|
|
1072
|
+
* If the day does not exist, for example you specified the 30th and it's february, we will refill them on the last day of the month instead.
|
|
1073
|
+
*/
|
|
1074
|
+
refillDay?: number;
|
|
930
1075
|
};
|
|
931
1076
|
/**
|
|
932
1077
|
* @description Unkey comes with per-key fixed-window ratelimiting out of the box.
|
|
@@ -978,7 +1123,7 @@ interface operations {
|
|
|
978
1123
|
*
|
|
979
1124
|
* In addition to storing the key's hash, recoverable keys are stored in an encrypted vault, allowing you to retrieve and display the plaintext later.
|
|
980
1125
|
*
|
|
981
|
-
* https://www.unkey.com/docs/security/recovering-keys for more information.
|
|
1126
|
+
* [https://www.unkey.com/docs/security/recovering-keys](https://www.unkey.com/docs/security/recovering-keys) for more information.
|
|
982
1127
|
* @default false
|
|
983
1128
|
*/
|
|
984
1129
|
recoverable?: boolean;
|
|
@@ -1223,6 +1368,8 @@ interface operations {
|
|
|
1223
1368
|
interval: "daily" | "monthly";
|
|
1224
1369
|
/** @description The amount of verifications to refill for each occurrence is determined individually for each key. */
|
|
1225
1370
|
amount: number;
|
|
1371
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
1372
|
+
refillDay?: number;
|
|
1226
1373
|
}) | null;
|
|
1227
1374
|
/**
|
|
1228
1375
|
* @description Set if key is enabled or disabled. If disabled, the key cannot be used to verify.
|
|
@@ -2527,6 +2674,313 @@ interface operations {
|
|
|
2527
2674
|
};
|
|
2528
2675
|
};
|
|
2529
2676
|
};
|
|
2677
|
+
"ratelimit.setOverride": {
|
|
2678
|
+
requestBody: {
|
|
2679
|
+
content: {
|
|
2680
|
+
"application/json": {
|
|
2681
|
+
/**
|
|
2682
|
+
* @description The id of the namespace. Either namespaceId or namespaceName must be provided
|
|
2683
|
+
* @example rlns_1234
|
|
2684
|
+
*/
|
|
2685
|
+
namespaceId?: string;
|
|
2686
|
+
/**
|
|
2687
|
+
* @description Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes. Wildcards can also be used, more info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules
|
|
2688
|
+
* @example email.outbound
|
|
2689
|
+
*/
|
|
2690
|
+
namespaceName?: string;
|
|
2691
|
+
/**
|
|
2692
|
+
* @description Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules
|
|
2693
|
+
* @example user_123
|
|
2694
|
+
*/
|
|
2695
|
+
identifier: string;
|
|
2696
|
+
/**
|
|
2697
|
+
* @description How many requests may pass in a given window.
|
|
2698
|
+
* @example 10
|
|
2699
|
+
*/
|
|
2700
|
+
limit: number;
|
|
2701
|
+
/**
|
|
2702
|
+
* @description The window duration in milliseconds
|
|
2703
|
+
* @example 60000
|
|
2704
|
+
*/
|
|
2705
|
+
duration: number;
|
|
2706
|
+
/**
|
|
2707
|
+
* @description Async will return a response immediately, lowering latency at the cost of accuracy.
|
|
2708
|
+
* @default false
|
|
2709
|
+
*/
|
|
2710
|
+
async?: boolean;
|
|
2711
|
+
};
|
|
2712
|
+
};
|
|
2713
|
+
};
|
|
2714
|
+
responses: {
|
|
2715
|
+
/** @description Sucessfully created a ratelimit override */
|
|
2716
|
+
200: {
|
|
2717
|
+
content: {
|
|
2718
|
+
"application/json": {
|
|
2719
|
+
/**
|
|
2720
|
+
* @description The id of the override. This is used internally
|
|
2721
|
+
* @example over_123
|
|
2722
|
+
*/
|
|
2723
|
+
overrideId: string;
|
|
2724
|
+
};
|
|
2725
|
+
};
|
|
2726
|
+
};
|
|
2727
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
2728
|
+
400: {
|
|
2729
|
+
content: {
|
|
2730
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2731
|
+
};
|
|
2732
|
+
};
|
|
2733
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2734
|
+
401: {
|
|
2735
|
+
content: {
|
|
2736
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2737
|
+
};
|
|
2738
|
+
};
|
|
2739
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
2740
|
+
403: {
|
|
2741
|
+
content: {
|
|
2742
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2743
|
+
};
|
|
2744
|
+
};
|
|
2745
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
2746
|
+
404: {
|
|
2747
|
+
content: {
|
|
2748
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2749
|
+
};
|
|
2750
|
+
};
|
|
2751
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2752
|
+
409: {
|
|
2753
|
+
content: {
|
|
2754
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2755
|
+
};
|
|
2756
|
+
};
|
|
2757
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2758
|
+
429: {
|
|
2759
|
+
content: {
|
|
2760
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2761
|
+
};
|
|
2762
|
+
};
|
|
2763
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2764
|
+
500: {
|
|
2765
|
+
content: {
|
|
2766
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2767
|
+
};
|
|
2768
|
+
};
|
|
2769
|
+
};
|
|
2770
|
+
};
|
|
2771
|
+
listOverrides: {
|
|
2772
|
+
parameters: {
|
|
2773
|
+
query?: {
|
|
2774
|
+
namespaceId?: string;
|
|
2775
|
+
namespaceName?: string;
|
|
2776
|
+
limit?: number;
|
|
2777
|
+
cursor?: string;
|
|
2778
|
+
};
|
|
2779
|
+
};
|
|
2780
|
+
responses: {
|
|
2781
|
+
/** @description List of overrides for the given namespace. */
|
|
2782
|
+
200: {
|
|
2783
|
+
content: {
|
|
2784
|
+
"application/json": {
|
|
2785
|
+
overrides: ({
|
|
2786
|
+
id: string;
|
|
2787
|
+
identifier: string;
|
|
2788
|
+
limit: number;
|
|
2789
|
+
duration: number;
|
|
2790
|
+
async?: boolean | null;
|
|
2791
|
+
})[];
|
|
2792
|
+
/**
|
|
2793
|
+
* @description The cursor to use for the next page of results, if no cursor is returned, there are no more results
|
|
2794
|
+
* @example eyJrZXkiOiJrZXlfMTIzNCJ9
|
|
2795
|
+
*/
|
|
2796
|
+
cursor?: string;
|
|
2797
|
+
/** @description The total number of overrides for the namespace */
|
|
2798
|
+
total: number;
|
|
2799
|
+
};
|
|
2800
|
+
};
|
|
2801
|
+
};
|
|
2802
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
2803
|
+
400: {
|
|
2804
|
+
content: {
|
|
2805
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2806
|
+
};
|
|
2807
|
+
};
|
|
2808
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2809
|
+
401: {
|
|
2810
|
+
content: {
|
|
2811
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2812
|
+
};
|
|
2813
|
+
};
|
|
2814
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
2815
|
+
403: {
|
|
2816
|
+
content: {
|
|
2817
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2818
|
+
};
|
|
2819
|
+
};
|
|
2820
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
2821
|
+
404: {
|
|
2822
|
+
content: {
|
|
2823
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2824
|
+
};
|
|
2825
|
+
};
|
|
2826
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2827
|
+
409: {
|
|
2828
|
+
content: {
|
|
2829
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2830
|
+
};
|
|
2831
|
+
};
|
|
2832
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2833
|
+
429: {
|
|
2834
|
+
content: {
|
|
2835
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2836
|
+
};
|
|
2837
|
+
};
|
|
2838
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2839
|
+
500: {
|
|
2840
|
+
content: {
|
|
2841
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2842
|
+
};
|
|
2843
|
+
};
|
|
2844
|
+
};
|
|
2845
|
+
};
|
|
2846
|
+
deleteOverride: {
|
|
2847
|
+
requestBody: {
|
|
2848
|
+
content: {
|
|
2849
|
+
"application/json": {
|
|
2850
|
+
/**
|
|
2851
|
+
* @description The id of the namespace. Either namespaceId or namespaceName must be provided
|
|
2852
|
+
* @example rlns_1234
|
|
2853
|
+
*/
|
|
2854
|
+
namespaceId?: string;
|
|
2855
|
+
/**
|
|
2856
|
+
* @description The name of the namespace. Namespaces group different limits together for better analytics. You might have a namespace for your public API and one for internal tRPC routes.
|
|
2857
|
+
* @example email.outbound
|
|
2858
|
+
*/
|
|
2859
|
+
namespaceName?: string;
|
|
2860
|
+
/**
|
|
2861
|
+
* @description Identifier of your user, this can be their userId, an email, an ip or anything else. Wildcards ( * ) can be used to match multiple identifiers, More info can be found at https://www.unkey.com/docs/ratelimiting/overrides#wildcard-rules
|
|
2862
|
+
* @example user_123
|
|
2863
|
+
*/
|
|
2864
|
+
identifier: string;
|
|
2865
|
+
};
|
|
2866
|
+
};
|
|
2867
|
+
};
|
|
2868
|
+
responses: {
|
|
2869
|
+
/** @description Successfully deleted a ratelimit override */
|
|
2870
|
+
200: {
|
|
2871
|
+
content: {
|
|
2872
|
+
"application/json": Record<string, never>;
|
|
2873
|
+
};
|
|
2874
|
+
};
|
|
2875
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
2876
|
+
400: {
|
|
2877
|
+
content: {
|
|
2878
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2879
|
+
};
|
|
2880
|
+
};
|
|
2881
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2882
|
+
401: {
|
|
2883
|
+
content: {
|
|
2884
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2885
|
+
};
|
|
2886
|
+
};
|
|
2887
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
2888
|
+
403: {
|
|
2889
|
+
content: {
|
|
2890
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2891
|
+
};
|
|
2892
|
+
};
|
|
2893
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
2894
|
+
404: {
|
|
2895
|
+
content: {
|
|
2896
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2897
|
+
};
|
|
2898
|
+
};
|
|
2899
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2900
|
+
409: {
|
|
2901
|
+
content: {
|
|
2902
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2903
|
+
};
|
|
2904
|
+
};
|
|
2905
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2906
|
+
429: {
|
|
2907
|
+
content: {
|
|
2908
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2909
|
+
};
|
|
2910
|
+
};
|
|
2911
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2912
|
+
500: {
|
|
2913
|
+
content: {
|
|
2914
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2915
|
+
};
|
|
2916
|
+
};
|
|
2917
|
+
};
|
|
2918
|
+
};
|
|
2919
|
+
getOverride: {
|
|
2920
|
+
parameters: {
|
|
2921
|
+
query: {
|
|
2922
|
+
namespaceId?: string;
|
|
2923
|
+
namespaceName?: string;
|
|
2924
|
+
identifier: string;
|
|
2925
|
+
};
|
|
2926
|
+
};
|
|
2927
|
+
responses: {
|
|
2928
|
+
/** @description Details of the override for the given identifier */
|
|
2929
|
+
200: {
|
|
2930
|
+
content: {
|
|
2931
|
+
"application/json": {
|
|
2932
|
+
id: string;
|
|
2933
|
+
identifier: string;
|
|
2934
|
+
limit: number;
|
|
2935
|
+
duration: number;
|
|
2936
|
+
async?: boolean | null;
|
|
2937
|
+
};
|
|
2938
|
+
};
|
|
2939
|
+
};
|
|
2940
|
+
/** @description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). */
|
|
2941
|
+
400: {
|
|
2942
|
+
content: {
|
|
2943
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2944
|
+
};
|
|
2945
|
+
};
|
|
2946
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2947
|
+
401: {
|
|
2948
|
+
content: {
|
|
2949
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2950
|
+
};
|
|
2951
|
+
};
|
|
2952
|
+
/** @description The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client's identity is known to the server. */
|
|
2953
|
+
403: {
|
|
2954
|
+
content: {
|
|
2955
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2956
|
+
};
|
|
2957
|
+
};
|
|
2958
|
+
/** @description The server cannot find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web. */
|
|
2959
|
+
404: {
|
|
2960
|
+
content: {
|
|
2961
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2962
|
+
};
|
|
2963
|
+
};
|
|
2964
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2965
|
+
409: {
|
|
2966
|
+
content: {
|
|
2967
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2968
|
+
};
|
|
2969
|
+
};
|
|
2970
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2971
|
+
429: {
|
|
2972
|
+
content: {
|
|
2973
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2974
|
+
};
|
|
2975
|
+
};
|
|
2976
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2977
|
+
500: {
|
|
2978
|
+
content: {
|
|
2979
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2980
|
+
};
|
|
2981
|
+
};
|
|
2982
|
+
};
|
|
2983
|
+
};
|
|
2530
2984
|
"v1.migrations.createKeys": {
|
|
2531
2985
|
requestBody: {
|
|
2532
2986
|
content: {
|
|
@@ -2623,6 +3077,8 @@ interface operations {
|
|
|
2623
3077
|
interval: "daily" | "monthly";
|
|
2624
3078
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
2625
3079
|
amount: number;
|
|
3080
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
3081
|
+
refillDay?: number;
|
|
2626
3082
|
};
|
|
2627
3083
|
/**
|
|
2628
3084
|
* @description Unkey comes with per-key ratelimiting out of the box.
|
|
@@ -2835,6 +3291,8 @@ interface operations {
|
|
|
2835
3291
|
interval: "daily" | "monthly";
|
|
2836
3292
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
2837
3293
|
amount: number;
|
|
3294
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
3295
|
+
refillDay?: number;
|
|
2838
3296
|
};
|
|
2839
3297
|
/**
|
|
2840
3298
|
* @description Unkey comes with per-key fixed-window ratelimiting out of the box.
|
|
@@ -3513,6 +3971,8 @@ interface operations {
|
|
|
3513
3971
|
* This usually comes from your authentication provider and could be a userId, organisationId or even an email.
|
|
3514
3972
|
* It does not matter what you use, as long as it uniquely identifies something in your application.
|
|
3515
3973
|
*
|
|
3974
|
+
* `externalId`s are unique across your workspace and therefore a `PRECONDITION_FAILED` error is returned when you try to create duplicates.
|
|
3975
|
+
*
|
|
3516
3976
|
* @example user_123
|
|
3517
3977
|
*/
|
|
3518
3978
|
externalId: string;
|
|
@@ -4168,7 +4628,7 @@ interface operations {
|
|
|
4168
4628
|
*/
|
|
4169
4629
|
valid: boolean;
|
|
4170
4630
|
/**
|
|
4171
|
-
* @description The name of the key, give keys a name to easily
|
|
4631
|
+
* @description The name of the key, give keys a name to easily identify their purpose
|
|
4172
4632
|
* @example Customer X
|
|
4173
4633
|
*/
|
|
4174
4634
|
name?: string;
|
|
@@ -4427,7 +4887,12 @@ type Result<R> = {
|
|
|
4427
4887
|
error?: never;
|
|
4428
4888
|
} | {
|
|
4429
4889
|
result?: never;
|
|
4430
|
-
error:
|
|
4890
|
+
error: {
|
|
4891
|
+
code: ErrorResponse["error"]["code"];
|
|
4892
|
+
message: ErrorResponse["error"]["message"];
|
|
4893
|
+
docs: ErrorResponse["error"]["docs"];
|
|
4894
|
+
requestId: string;
|
|
4895
|
+
};
|
|
4431
4896
|
};
|
|
4432
4897
|
declare class Unkey {
|
|
4433
4898
|
readonly baseUrl: string;
|
|
@@ -4462,6 +4927,10 @@ declare class Unkey {
|
|
|
4462
4927
|
};
|
|
4463
4928
|
get ratelimits(): {
|
|
4464
4929
|
limit: (req: paths["/v1/ratelimits.limit"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.limit"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4930
|
+
getOverride: (req: paths["/v1/ratelimits.getOverride"]["get"]["parameters"]["query"]) => Promise<Result<paths["/v1/ratelimits.getOverride"]["get"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4931
|
+
listOverrides: (req: paths["/v1/ratelimits.listOverrides"]["get"]["parameters"]["query"]) => Promise<Result<paths["/v1/ratelimits.listOverrides"]["get"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4932
|
+
setOverride: (req: paths["/v1/ratelimits.setOverride"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.setOverride"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4933
|
+
deleteOverride: (req: paths["/v1/ratelimits.deleteOverride"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.deleteOverride"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4465
4934
|
};
|
|
4466
4935
|
get identities(): {
|
|
4467
4936
|
create: (req: paths["/v1/identities.createIdentity"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/identities.createIdentity"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
@@ -4502,7 +4971,12 @@ declare function verifyKey(req: string | {
|
|
|
4502
4971
|
apiId: string;
|
|
4503
4972
|
}): Promise<{
|
|
4504
4973
|
result?: never;
|
|
4505
|
-
error:
|
|
4974
|
+
error: {
|
|
4975
|
+
code: ErrorResponse["error"]["code"];
|
|
4976
|
+
message: ErrorResponse["error"]["message"];
|
|
4977
|
+
docs: ErrorResponse["error"]["docs"];
|
|
4978
|
+
requestId: string;
|
|
4979
|
+
};
|
|
4506
4980
|
} | {
|
|
4507
4981
|
result: {
|
|
4508
4982
|
keyId?: string;
|