diff --git a/apps/docs/api-reference/keys/verifications.mdx b/apps/docs/api-reference/keys/verifications.mdx
deleted file mode 100644
index 75fea3d73a..0000000000
--- a/apps/docs/api-reference/keys/verifications.mdx
+++ /dev/null
@@ -1,11 +0,0 @@
----
-title: Retrieve usage numbers
-description: Filter by `keyId` or `ownerId`.
-openapi: get /v1/keys.getVerifications
----
-
-## Changelog
-
-| Date | Changes |
-|-------------|---------------------|
-| Jan 08 2024 | Introduced endpoint |
diff --git a/apps/docs/docs.json b/apps/docs/docs.json
index 0f8be93178..40c17ab04b 100644
--- a/apps/docs/docs.json
+++ b/apps/docs/docs.json
@@ -230,7 +230,6 @@
"api-reference/keys/update",
"api-reference/keys/update-remaining",
"api-reference/keys/delete",
- "api-reference/keys/verifications",
"api-reference/keys/add-permissions",
"api-reference/keys/remove-permissions",
"api-reference/keys/set-permissions",
@@ -315,7 +314,6 @@
"libraries/ts/sdk/keys/update",
"libraries/ts/sdk/keys/update-remaining",
"libraries/ts/sdk/keys/delete",
- "libraries/ts/sdk/keys/verifications",
"libraries/ts/sdk/keys/add-permission",
"libraries/ts/sdk/keys/remove-permission",
"libraries/ts/sdk/keys/set-permission",
@@ -324,6 +322,10 @@
"libraries/ts/sdk/keys/set-roles"
]
},
+ {
+ "group": "Analytics",
+ "pages": ["libraries/ts/sdk/analytics/get"]
+ },
{
"group": "APIs",
"pages": [
diff --git a/apps/docs/libraries/ts/sdk/analytics/get.mdx b/apps/docs/libraries/ts/sdk/analytics/get.mdx
new file mode 100644
index 0000000000..5db2a33743
--- /dev/null
+++ b/apps/docs/libraries/ts/sdk/analytics/get.mdx
@@ -0,0 +1,173 @@
+---
+title: "Get Verifications"
+description: "Retrieve usage data from unkey to power your dashboards, reports or usage-based billing."
+---
+
+
+ ```ts
+ const { result, error } = await unkey.analytics.getVerifications({
+ apiId: "api_123",
+ });
+
+ if (error) {
+ // handle potential network or bad request error
+ // a link to our docs will be in the `error.docs` field
+ console.error(error.message);
+ return;
+ }
+
+ console.log(result)
+
+ ```
+
+
+
+```json
+{
+ "result": [
+ {
+ "time": 123,
+ "valid": 123,
+ "notFound": 123,
+ "forbidden": 123,
+ "usageExceeded": 123,
+ "rateLimited": 123,
+ "unauthorized": 123,
+ "disabled": 123,
+ "insufficientPermissions": 123,
+ "expired": 123,
+ "total": 123,
+ "tag": "path/user_123",
+ "tags": [
+ "path/user_123",
+ "path/create",
+ "path/delete/"
+ ],
+ "keyId": "key_123",
+ "identity": {
+ "id": "id_123",
+ "externalId": "user_123"
+ }
+ }
+ ]
+}
+```
+
+
+
+
+To use this function, your root key must have the `api.*.read_api permission`.
+
+
+## Request
+
+
+ Select the API. Only keys belonging to this API will be included.
+
+
+ Filtering by externalId allows you to narrow down the search to a specific user or organisation.
+
+
+ Only include data for a specific key or keys.
+
+ When you are providing zero or more than one key ids, all usage counts are aggregated and summed up. Send multiple requests with one keyId each if you need counts per key.
+
+
+Only include data for a specific tag or tags.
+
+When you are providing zero or more than one tag, all usage counts are aggregated and summed up. Send multiple requests with one tag each if you need counts per tag.
+
+
+
+The start of the period to fetch usage for as unix milliseconds timestamp.
+
+
+
+ The end of the period to fetch usage for as unix milliseconds timestamp.
+
+
+
+ By default, datapoints are not aggregated, however you probably want to get a breakdown per time, key or identity.
+
+ Grouping by tags and by tag is mutually exclusive.
+
+
+
+
+ Limit the number of returned datapoints.
+ This may become useful for querying the top 10 identities based on usage.
+
+
+
+ Sort the output by a specific value. You can use this in combination with the order param.
+
+
+
+
+ Define the order of sorting. Use this in combination with orderBy
+
+
+## Response
+
+
+ Total number of verifications in the current time slice, regardless of outcome.
+
+
+
+ Unix timestamp in milliseconds of the start of the current time slice.
+
+
+
+ Total number of valid verifications in the current time slice
+
+
+
+ Total number of not found responses in the current time slice
+
+
+ Total number of forbidden requests in the current time slice
+
+
+ Total number of usage exceeded verifications in the current time slice
+
+
+ Total number of rateLimited verifications in the current time slice
+
+
+ Total number of unauthorized verifications in the current time slice
+
+
+ Total number of disabled verifications in the current time slice
+
+
+ Total number of insufficient permissions verifications in the current time slice
+
+
+ Total number of expired verifications in the current time slice
+
+
+
+ Only available when grouping by tag.
+
+
+
+ Only available when grouping by tag.
+
+
+
+ Only available when specifying groupBy=key in the query.
+ In this case there would be one datapoint per time and groupBy target.
+
+
+
+Only available when specifying groupBy=identity in the query.
+In this case there would be one datapoint per time and groupBy target.
+
+
+ The id of the identity
+
+
+The external id of the identity
+
+
+
diff --git a/apps/docs/libraries/ts/sdk/keys/verifications.mdx b/apps/docs/libraries/ts/sdk/keys/verifications.mdx
index c2cb818636..1d9279d435 100644
--- a/apps/docs/libraries/ts/sdk/keys/verifications.mdx
+++ b/apps/docs/libraries/ts/sdk/keys/verifications.mdx
@@ -3,6 +3,7 @@ title: "Verifications"
description: "Get usage information about your API keys"
---
+ This is deprecated, please use the `analytics.getVerifications` function instead.