@unkey/api 0.26.2 → 0.28.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 +501 -12
- package/dist/index.d.ts +501 -12
- 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";
|
|
@@ -562,6 +586,21 @@ interface components {
|
|
|
562
586
|
* @example sk_1234
|
|
563
587
|
*/
|
|
564
588
|
key: string;
|
|
589
|
+
/**
|
|
590
|
+
* @description Tags do not influence the outcome of a verification.
|
|
591
|
+
* They can be added to filter or aggregate historical verification data for your analytics needs.
|
|
592
|
+
*
|
|
593
|
+
* To unkey, a tag is simply a string, we don't enforce any schema but leave that up to you.
|
|
594
|
+
* The only exception is that each tag must be between 1 and 128 characters long.
|
|
595
|
+
*
|
|
596
|
+
* A typical setup would be to add key-value pairs of resources or locations, that you need later when querying.
|
|
597
|
+
*
|
|
598
|
+
* @example [
|
|
599
|
+
* "path=/v1/users/123",
|
|
600
|
+
* "region=us-east-1"
|
|
601
|
+
* ]
|
|
602
|
+
*/
|
|
603
|
+
tags?: string[];
|
|
565
604
|
/** @description Perform RBAC checks */
|
|
566
605
|
authorization?: {
|
|
567
606
|
permissions?: components["schemas"]["PermissionQuery"];
|
|
@@ -666,8 +705,6 @@ interface operations {
|
|
|
666
705
|
ratelimit: string;
|
|
667
706
|
/** @description The name of the connected usagelimit service */
|
|
668
707
|
usagelimit: string;
|
|
669
|
-
/** @description The name of the connected analytics service */
|
|
670
|
-
analytics: string;
|
|
671
708
|
};
|
|
672
709
|
};
|
|
673
710
|
};
|
|
@@ -774,6 +811,123 @@ interface operations {
|
|
|
774
811
|
};
|
|
775
812
|
};
|
|
776
813
|
};
|
|
814
|
+
whoami: {
|
|
815
|
+
requestBody: {
|
|
816
|
+
content: {
|
|
817
|
+
"application/json": {
|
|
818
|
+
/**
|
|
819
|
+
* @description The actual key to fetch
|
|
820
|
+
* @example sk_123
|
|
821
|
+
*/
|
|
822
|
+
key: string;
|
|
823
|
+
};
|
|
824
|
+
};
|
|
825
|
+
};
|
|
826
|
+
responses: {
|
|
827
|
+
/** @description The configuration for a single key */
|
|
828
|
+
200: {
|
|
829
|
+
content: {
|
|
830
|
+
"application/json": {
|
|
831
|
+
/**
|
|
832
|
+
* @description The ID of the key
|
|
833
|
+
* @example key_123
|
|
834
|
+
*/
|
|
835
|
+
id: string;
|
|
836
|
+
/**
|
|
837
|
+
* @description The name of the key
|
|
838
|
+
* @example API Key 1
|
|
839
|
+
*/
|
|
840
|
+
name?: string;
|
|
841
|
+
/**
|
|
842
|
+
* @description The remaining number of requests for the key
|
|
843
|
+
* @example 1000
|
|
844
|
+
*/
|
|
845
|
+
remaining?: number;
|
|
846
|
+
/** @description The identity object associated with the key */
|
|
847
|
+
identity?: {
|
|
848
|
+
/**
|
|
849
|
+
* @description The identity ID associated with the key
|
|
850
|
+
* @example id_123
|
|
851
|
+
*/
|
|
852
|
+
id: string;
|
|
853
|
+
/**
|
|
854
|
+
* @description The external identity ID associated with the key
|
|
855
|
+
* @example ext123
|
|
856
|
+
*/
|
|
857
|
+
externalId: string;
|
|
858
|
+
};
|
|
859
|
+
/**
|
|
860
|
+
* @description Metadata associated with the key
|
|
861
|
+
* @example {
|
|
862
|
+
* "role": "admin",
|
|
863
|
+
* "plan": "premium"
|
|
864
|
+
* }
|
|
865
|
+
*/
|
|
866
|
+
meta?: {
|
|
867
|
+
[key: string]: unknown;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* @description The timestamp in milliseconds when the key was created
|
|
871
|
+
* @example 1620000000000
|
|
872
|
+
*/
|
|
873
|
+
createdAt: number;
|
|
874
|
+
/**
|
|
875
|
+
* @description Whether the key is enabled
|
|
876
|
+
* @example true
|
|
877
|
+
*/
|
|
878
|
+
enabled: boolean;
|
|
879
|
+
/**
|
|
880
|
+
* @description The environment the key is associated with
|
|
881
|
+
* @example production
|
|
882
|
+
*/
|
|
883
|
+
environment?: string;
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
/** @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). */
|
|
888
|
+
400: {
|
|
889
|
+
content: {
|
|
890
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
891
|
+
};
|
|
892
|
+
};
|
|
893
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
894
|
+
401: {
|
|
895
|
+
content: {
|
|
896
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
/** @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. */
|
|
900
|
+
403: {
|
|
901
|
+
content: {
|
|
902
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
/** @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. */
|
|
906
|
+
404: {
|
|
907
|
+
content: {
|
|
908
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
909
|
+
};
|
|
910
|
+
};
|
|
911
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
912
|
+
409: {
|
|
913
|
+
content: {
|
|
914
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
918
|
+
429: {
|
|
919
|
+
content: {
|
|
920
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
921
|
+
};
|
|
922
|
+
};
|
|
923
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
924
|
+
500: {
|
|
925
|
+
content: {
|
|
926
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
927
|
+
};
|
|
928
|
+
};
|
|
929
|
+
};
|
|
930
|
+
};
|
|
777
931
|
deleteKey: {
|
|
778
932
|
requestBody: {
|
|
779
933
|
content: {
|
|
@@ -915,8 +1069,9 @@ interface operations {
|
|
|
915
1069
|
/**
|
|
916
1070
|
* @description Unkey enables you to refill verifications for each key at regular intervals.
|
|
917
1071
|
* @example {
|
|
918
|
-
* "interval": "
|
|
919
|
-
* "amount": 100
|
|
1072
|
+
* "interval": "monthly",
|
|
1073
|
+
* "amount": 100,
|
|
1074
|
+
* "refillDay": 15
|
|
920
1075
|
* }
|
|
921
1076
|
*/
|
|
922
1077
|
refill?: {
|
|
@@ -927,6 +1082,11 @@ interface operations {
|
|
|
927
1082
|
interval: "daily" | "monthly";
|
|
928
1083
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
929
1084
|
amount: number;
|
|
1085
|
+
/**
|
|
1086
|
+
* @description The day of the month, when we will refill the remaining verifications. To refill on the 15th of each month, set 'refillDay': 15.
|
|
1087
|
+
* 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.
|
|
1088
|
+
*/
|
|
1089
|
+
refillDay?: number;
|
|
930
1090
|
};
|
|
931
1091
|
/**
|
|
932
1092
|
* @description Unkey comes with per-key fixed-window ratelimiting out of the box.
|
|
@@ -978,7 +1138,7 @@ interface operations {
|
|
|
978
1138
|
*
|
|
979
1139
|
* 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
1140
|
*
|
|
981
|
-
* https://www.unkey.com/docs/security/recovering-keys for more information.
|
|
1141
|
+
* [https://www.unkey.com/docs/security/recovering-keys](https://www.unkey.com/docs/security/recovering-keys) for more information.
|
|
982
1142
|
* @default false
|
|
983
1143
|
*/
|
|
984
1144
|
recoverable?: boolean;
|
|
@@ -1223,6 +1383,8 @@ interface operations {
|
|
|
1223
1383
|
interval: "daily" | "monthly";
|
|
1224
1384
|
/** @description The amount of verifications to refill for each occurrence is determined individually for each key. */
|
|
1225
1385
|
amount: number;
|
|
1386
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
1387
|
+
refillDay?: number;
|
|
1226
1388
|
}) | null;
|
|
1227
1389
|
/**
|
|
1228
1390
|
* @description Set if key is enabled or disabled. If disabled, the key cannot be used to verify.
|
|
@@ -2196,7 +2358,7 @@ interface operations {
|
|
|
2196
2358
|
* @example eyJrZXkiOiJrZXlfMTIzNCJ9
|
|
2197
2359
|
*/
|
|
2198
2360
|
cursor?: string;
|
|
2199
|
-
/** @description The total number of keys for this api */
|
|
2361
|
+
/** @description The total number of keys for this api. This is an approximation and may lag behind up to 5 minutes. */
|
|
2200
2362
|
total: number;
|
|
2201
2363
|
};
|
|
2202
2364
|
};
|
|
@@ -2527,6 +2689,313 @@ interface operations {
|
|
|
2527
2689
|
};
|
|
2528
2690
|
};
|
|
2529
2691
|
};
|
|
2692
|
+
"ratelimit.setOverride": {
|
|
2693
|
+
requestBody: {
|
|
2694
|
+
content: {
|
|
2695
|
+
"application/json": {
|
|
2696
|
+
/**
|
|
2697
|
+
* @description The id of the namespace. Either namespaceId or namespaceName must be provided
|
|
2698
|
+
* @example rlns_1234
|
|
2699
|
+
*/
|
|
2700
|
+
namespaceId?: string;
|
|
2701
|
+
/**
|
|
2702
|
+
* @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
|
|
2703
|
+
* @example email.outbound
|
|
2704
|
+
*/
|
|
2705
|
+
namespaceName?: string;
|
|
2706
|
+
/**
|
|
2707
|
+
* @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
|
|
2708
|
+
* @example user_123
|
|
2709
|
+
*/
|
|
2710
|
+
identifier: string;
|
|
2711
|
+
/**
|
|
2712
|
+
* @description How many requests may pass in a given window.
|
|
2713
|
+
* @example 10
|
|
2714
|
+
*/
|
|
2715
|
+
limit: number;
|
|
2716
|
+
/**
|
|
2717
|
+
* @description The window duration in milliseconds
|
|
2718
|
+
* @example 60000
|
|
2719
|
+
*/
|
|
2720
|
+
duration: number;
|
|
2721
|
+
/**
|
|
2722
|
+
* @description Async will return a response immediately, lowering latency at the cost of accuracy.
|
|
2723
|
+
* @default false
|
|
2724
|
+
*/
|
|
2725
|
+
async?: boolean;
|
|
2726
|
+
};
|
|
2727
|
+
};
|
|
2728
|
+
};
|
|
2729
|
+
responses: {
|
|
2730
|
+
/** @description Sucessfully created a ratelimit override */
|
|
2731
|
+
200: {
|
|
2732
|
+
content: {
|
|
2733
|
+
"application/json": {
|
|
2734
|
+
/**
|
|
2735
|
+
* @description The id of the override. This is used internally
|
|
2736
|
+
* @example over_123
|
|
2737
|
+
*/
|
|
2738
|
+
overrideId: string;
|
|
2739
|
+
};
|
|
2740
|
+
};
|
|
2741
|
+
};
|
|
2742
|
+
/** @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). */
|
|
2743
|
+
400: {
|
|
2744
|
+
content: {
|
|
2745
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2746
|
+
};
|
|
2747
|
+
};
|
|
2748
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2749
|
+
401: {
|
|
2750
|
+
content: {
|
|
2751
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2752
|
+
};
|
|
2753
|
+
};
|
|
2754
|
+
/** @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. */
|
|
2755
|
+
403: {
|
|
2756
|
+
content: {
|
|
2757
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2758
|
+
};
|
|
2759
|
+
};
|
|
2760
|
+
/** @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. */
|
|
2761
|
+
404: {
|
|
2762
|
+
content: {
|
|
2763
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2764
|
+
};
|
|
2765
|
+
};
|
|
2766
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2767
|
+
409: {
|
|
2768
|
+
content: {
|
|
2769
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2770
|
+
};
|
|
2771
|
+
};
|
|
2772
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2773
|
+
429: {
|
|
2774
|
+
content: {
|
|
2775
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2776
|
+
};
|
|
2777
|
+
};
|
|
2778
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2779
|
+
500: {
|
|
2780
|
+
content: {
|
|
2781
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2782
|
+
};
|
|
2783
|
+
};
|
|
2784
|
+
};
|
|
2785
|
+
};
|
|
2786
|
+
listOverrides: {
|
|
2787
|
+
parameters: {
|
|
2788
|
+
query?: {
|
|
2789
|
+
namespaceId?: string;
|
|
2790
|
+
namespaceName?: string;
|
|
2791
|
+
limit?: number;
|
|
2792
|
+
cursor?: string;
|
|
2793
|
+
};
|
|
2794
|
+
};
|
|
2795
|
+
responses: {
|
|
2796
|
+
/** @description List of overrides for the given namespace. */
|
|
2797
|
+
200: {
|
|
2798
|
+
content: {
|
|
2799
|
+
"application/json": {
|
|
2800
|
+
overrides: ({
|
|
2801
|
+
id: string;
|
|
2802
|
+
identifier: string;
|
|
2803
|
+
limit: number;
|
|
2804
|
+
duration: number;
|
|
2805
|
+
async?: boolean | null;
|
|
2806
|
+
})[];
|
|
2807
|
+
/**
|
|
2808
|
+
* @description The cursor to use for the next page of results, if no cursor is returned, there are no more results
|
|
2809
|
+
* @example eyJrZXkiOiJrZXlfMTIzNCJ9
|
|
2810
|
+
*/
|
|
2811
|
+
cursor?: string;
|
|
2812
|
+
/** @description The total number of overrides for the namespace */
|
|
2813
|
+
total: number;
|
|
2814
|
+
};
|
|
2815
|
+
};
|
|
2816
|
+
};
|
|
2817
|
+
/** @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). */
|
|
2818
|
+
400: {
|
|
2819
|
+
content: {
|
|
2820
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2821
|
+
};
|
|
2822
|
+
};
|
|
2823
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2824
|
+
401: {
|
|
2825
|
+
content: {
|
|
2826
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2827
|
+
};
|
|
2828
|
+
};
|
|
2829
|
+
/** @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. */
|
|
2830
|
+
403: {
|
|
2831
|
+
content: {
|
|
2832
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2833
|
+
};
|
|
2834
|
+
};
|
|
2835
|
+
/** @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. */
|
|
2836
|
+
404: {
|
|
2837
|
+
content: {
|
|
2838
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2839
|
+
};
|
|
2840
|
+
};
|
|
2841
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2842
|
+
409: {
|
|
2843
|
+
content: {
|
|
2844
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2845
|
+
};
|
|
2846
|
+
};
|
|
2847
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2848
|
+
429: {
|
|
2849
|
+
content: {
|
|
2850
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2851
|
+
};
|
|
2852
|
+
};
|
|
2853
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2854
|
+
500: {
|
|
2855
|
+
content: {
|
|
2856
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2857
|
+
};
|
|
2858
|
+
};
|
|
2859
|
+
};
|
|
2860
|
+
};
|
|
2861
|
+
deleteOverride: {
|
|
2862
|
+
requestBody: {
|
|
2863
|
+
content: {
|
|
2864
|
+
"application/json": {
|
|
2865
|
+
/**
|
|
2866
|
+
* @description The id of the namespace. Either namespaceId or namespaceName must be provided
|
|
2867
|
+
* @example rlns_1234
|
|
2868
|
+
*/
|
|
2869
|
+
namespaceId?: string;
|
|
2870
|
+
/**
|
|
2871
|
+
* @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.
|
|
2872
|
+
* @example email.outbound
|
|
2873
|
+
*/
|
|
2874
|
+
namespaceName?: string;
|
|
2875
|
+
/**
|
|
2876
|
+
* @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
|
|
2877
|
+
* @example user_123
|
|
2878
|
+
*/
|
|
2879
|
+
identifier: string;
|
|
2880
|
+
};
|
|
2881
|
+
};
|
|
2882
|
+
};
|
|
2883
|
+
responses: {
|
|
2884
|
+
/** @description Successfully deleted a ratelimit override */
|
|
2885
|
+
200: {
|
|
2886
|
+
content: {
|
|
2887
|
+
"application/json": Record<string, never>;
|
|
2888
|
+
};
|
|
2889
|
+
};
|
|
2890
|
+
/** @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). */
|
|
2891
|
+
400: {
|
|
2892
|
+
content: {
|
|
2893
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2894
|
+
};
|
|
2895
|
+
};
|
|
2896
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2897
|
+
401: {
|
|
2898
|
+
content: {
|
|
2899
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2900
|
+
};
|
|
2901
|
+
};
|
|
2902
|
+
/** @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. */
|
|
2903
|
+
403: {
|
|
2904
|
+
content: {
|
|
2905
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2906
|
+
};
|
|
2907
|
+
};
|
|
2908
|
+
/** @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. */
|
|
2909
|
+
404: {
|
|
2910
|
+
content: {
|
|
2911
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2912
|
+
};
|
|
2913
|
+
};
|
|
2914
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2915
|
+
409: {
|
|
2916
|
+
content: {
|
|
2917
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2918
|
+
};
|
|
2919
|
+
};
|
|
2920
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2921
|
+
429: {
|
|
2922
|
+
content: {
|
|
2923
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2924
|
+
};
|
|
2925
|
+
};
|
|
2926
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2927
|
+
500: {
|
|
2928
|
+
content: {
|
|
2929
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2930
|
+
};
|
|
2931
|
+
};
|
|
2932
|
+
};
|
|
2933
|
+
};
|
|
2934
|
+
getOverride: {
|
|
2935
|
+
parameters: {
|
|
2936
|
+
query: {
|
|
2937
|
+
namespaceId?: string;
|
|
2938
|
+
namespaceName?: string;
|
|
2939
|
+
identifier: string;
|
|
2940
|
+
};
|
|
2941
|
+
};
|
|
2942
|
+
responses: {
|
|
2943
|
+
/** @description Details of the override for the given identifier */
|
|
2944
|
+
200: {
|
|
2945
|
+
content: {
|
|
2946
|
+
"application/json": {
|
|
2947
|
+
id: string;
|
|
2948
|
+
identifier: string;
|
|
2949
|
+
limit: number;
|
|
2950
|
+
duration: number;
|
|
2951
|
+
async?: boolean | null;
|
|
2952
|
+
};
|
|
2953
|
+
};
|
|
2954
|
+
};
|
|
2955
|
+
/** @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). */
|
|
2956
|
+
400: {
|
|
2957
|
+
content: {
|
|
2958
|
+
"application/json": components["schemas"]["ErrBadRequest"];
|
|
2959
|
+
};
|
|
2960
|
+
};
|
|
2961
|
+
/** @description Although the HTTP standard specifies "unauthorized", semantically this response means "unauthenticated". That is, the client must authenticate itself to get the requested response. */
|
|
2962
|
+
401: {
|
|
2963
|
+
content: {
|
|
2964
|
+
"application/json": components["schemas"]["ErrUnauthorized"];
|
|
2965
|
+
};
|
|
2966
|
+
};
|
|
2967
|
+
/** @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. */
|
|
2968
|
+
403: {
|
|
2969
|
+
content: {
|
|
2970
|
+
"application/json": components["schemas"]["ErrForbidden"];
|
|
2971
|
+
};
|
|
2972
|
+
};
|
|
2973
|
+
/** @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. */
|
|
2974
|
+
404: {
|
|
2975
|
+
content: {
|
|
2976
|
+
"application/json": components["schemas"]["ErrNotFound"];
|
|
2977
|
+
};
|
|
2978
|
+
};
|
|
2979
|
+
/** @description This response is sent when a request conflicts with the current state of the server. */
|
|
2980
|
+
409: {
|
|
2981
|
+
content: {
|
|
2982
|
+
"application/json": components["schemas"]["ErrConflict"];
|
|
2983
|
+
};
|
|
2984
|
+
};
|
|
2985
|
+
/** @description The user has sent too many requests in a given amount of time ("rate limiting") */
|
|
2986
|
+
429: {
|
|
2987
|
+
content: {
|
|
2988
|
+
"application/json": components["schemas"]["ErrTooManyRequests"];
|
|
2989
|
+
};
|
|
2990
|
+
};
|
|
2991
|
+
/** @description The server has encountered a situation it does not know how to handle. */
|
|
2992
|
+
500: {
|
|
2993
|
+
content: {
|
|
2994
|
+
"application/json": components["schemas"]["ErrInternalServerError"];
|
|
2995
|
+
};
|
|
2996
|
+
};
|
|
2997
|
+
};
|
|
2998
|
+
};
|
|
2530
2999
|
"v1.migrations.createKeys": {
|
|
2531
3000
|
requestBody: {
|
|
2532
3001
|
content: {
|
|
@@ -2623,6 +3092,8 @@ interface operations {
|
|
|
2623
3092
|
interval: "daily" | "monthly";
|
|
2624
3093
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
2625
3094
|
amount: number;
|
|
3095
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
3096
|
+
refillDay?: number;
|
|
2626
3097
|
};
|
|
2627
3098
|
/**
|
|
2628
3099
|
* @description Unkey comes with per-key ratelimiting out of the box.
|
|
@@ -2835,6 +3306,8 @@ interface operations {
|
|
|
2835
3306
|
interval: "daily" | "monthly";
|
|
2836
3307
|
/** @description The number of verifications to refill for each occurrence is determined individually for each key. */
|
|
2837
3308
|
amount: number;
|
|
3309
|
+
/** @description The day verifications will refill each month, when interval is set to 'monthly' */
|
|
3310
|
+
refillDay?: number;
|
|
2838
3311
|
};
|
|
2839
3312
|
/**
|
|
2840
3313
|
* @description Unkey comes with per-key fixed-window ratelimiting out of the box.
|
|
@@ -3513,6 +3986,8 @@ interface operations {
|
|
|
3513
3986
|
* This usually comes from your authentication provider and could be a userId, organisationId or even an email.
|
|
3514
3987
|
* It does not matter what you use, as long as it uniquely identifies something in your application.
|
|
3515
3988
|
*
|
|
3989
|
+
* `externalId`s are unique across your workspace and therefore a `PRECONDITION_FAILED` error is returned when you try to create duplicates.
|
|
3990
|
+
*
|
|
3516
3991
|
* @example user_123
|
|
3517
3992
|
*/
|
|
3518
3993
|
externalId: string;
|
|
@@ -4168,7 +4643,7 @@ interface operations {
|
|
|
4168
4643
|
*/
|
|
4169
4644
|
valid: boolean;
|
|
4170
4645
|
/**
|
|
4171
|
-
* @description The name of the key, give keys a name to easily
|
|
4646
|
+
* @description The name of the key, give keys a name to easily identify their purpose
|
|
4172
4647
|
* @example Customer X
|
|
4173
4648
|
*/
|
|
4174
4649
|
name?: string;
|
|
@@ -4427,7 +4902,12 @@ type Result<R> = {
|
|
|
4427
4902
|
error?: never;
|
|
4428
4903
|
} | {
|
|
4429
4904
|
result?: never;
|
|
4430
|
-
error:
|
|
4905
|
+
error: {
|
|
4906
|
+
code: ErrorResponse["error"]["code"];
|
|
4907
|
+
message: ErrorResponse["error"]["message"];
|
|
4908
|
+
docs: ErrorResponse["error"]["docs"];
|
|
4909
|
+
requestId: string;
|
|
4910
|
+
};
|
|
4431
4911
|
};
|
|
4432
4912
|
declare class Unkey {
|
|
4433
4913
|
readonly baseUrl: string;
|
|
@@ -4462,6 +4942,10 @@ declare class Unkey {
|
|
|
4462
4942
|
};
|
|
4463
4943
|
get ratelimits(): {
|
|
4464
4944
|
limit: (req: paths["/v1/ratelimits.limit"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.limit"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4945
|
+
getOverride: (req: paths["/v1/ratelimits.getOverride"]["get"]["parameters"]["query"]) => Promise<Result<paths["/v1/ratelimits.getOverride"]["get"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4946
|
+
listOverrides: (req: paths["/v1/ratelimits.listOverrides"]["get"]["parameters"]["query"]) => Promise<Result<paths["/v1/ratelimits.listOverrides"]["get"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4947
|
+
setOverride: (req: paths["/v1/ratelimits.setOverride"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.setOverride"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4948
|
+
deleteOverride: (req: paths["/v1/ratelimits.deleteOverride"]["post"]["requestBody"]["content"]["application/json"]) => Promise<Result<paths["/v1/ratelimits.deleteOverride"]["post"]["responses"]["200"]["content"]["application/json"]>>;
|
|
4465
4949
|
};
|
|
4466
4950
|
get identities(): {
|
|
4467
4951
|
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 +4986,12 @@ declare function verifyKey(req: string | {
|
|
|
4502
4986
|
apiId: string;
|
|
4503
4987
|
}): Promise<{
|
|
4504
4988
|
result?: never;
|
|
4505
|
-
error:
|
|
4989
|
+
error: {
|
|
4990
|
+
code: ErrorResponse["error"]["code"];
|
|
4991
|
+
message: ErrorResponse["error"]["message"];
|
|
4992
|
+
docs: ErrorResponse["error"]["docs"];
|
|
4993
|
+
requestId: string;
|
|
4994
|
+
};
|
|
4506
4995
|
} | {
|
|
4507
4996
|
result: {
|
|
4508
4997
|
keyId?: string;
|