WebscaleApiDataModels
type WebscaleApiDataModels = {
AccessCheckRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
identity: WebscaleApiDataModels["RequestIdentity"];
resource?: WebscaleApiDataModels["RequestResource"];
};
AccessCheckResponse: {
customer: WebscaleApiDataModels["CustomerInfo"];
eventId: string;
features: {
[key: string]: {
featureId: string;
featureSlug: string;
properties: {
[key: string]:
| {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
}
| {
isFallback: boolean;
type: "number";
value: number | null;
}
| {
isFallback: boolean;
type: "string";
value: string | null;
}
| {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};
};
};
};
identity: WebscaleApiDataModels["UserIdentity"];
status: "success";
};
AnonymousRequestIdentity: {
anonymousIdentifier: string;
};
BlindCounterUpdateRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
counterId: string;
identity: WebscaleApiDataModels["RequestIdentity"];
resourceId?: string;
update?: number;
};
BlindCounterUpdateResponse: {
status: "success";
};
BooleanProperty: {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};
CloudflareRequest: {
cf?: WebscaleApiDataModels["CloudflareWorkersCf"];
};
CloudflareWorkersCf: {
asOrganization?: string | null;
botManagement?: | {
detectionIds?: number[];
score?: number;
verifiedBot?: boolean;
}
| null;
city?: string | null;
continent?: string | null;
country?: string | null;
isEUCountry?: string | null;
latitude?: string | null;
longitude?: string | null;
metroCode?: string | null;
postalCode?: string | null;
region?: string | null;
regionCode?: string | null;
timezone?: string | null;
verifiedBotCategory?: string | null;
};
CustomerInfo: {
customerIdentifiers: string[];
hasProducts: boolean;
isCustomer: boolean;
};
ErrorResponse: {
errors?: WebscaleApiDataModels["ErrorResponse"][];
message: string;
status: "error";
statusCode: number;
};
FeatureAccess: {
featureId: string;
featureSlug: string;
properties: {
[key: string]:
| {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
}
| {
isFallback: boolean;
type: "number";
value: number | null;
}
| {
isFallback: boolean;
type: "string";
value: string | null;
}
| {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};
};
};
FeatureProperty: | WebscaleApiDataModels["MeterableProperty"]
| WebscaleApiDataModels["NumberProperty"]
| WebscaleApiDataModels["StringProperty"]
| WebscaleApiDataModels["BooleanProperty"];
JwtRequestIdentity: {
userJwt: string;
};
MeterableProperty: {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
};
NumberProperty: {
isFallback: boolean;
type: "number";
value: number | null;
};
ProvidedRequestIdentity: {
userIdentifier: string;
};
RequestIdentity: | WebscaleApiDataModels["ProvidedRequestIdentity"]
| WebscaleApiDataModels["JwtRequestIdentity"]
| WebscaleApiDataModels["AnonymousRequestIdentity"];
RequestResource: {
id?: string;
} & {
[key: string]: unknown;
};
StringProperty: {
isFallback: boolean;
type: "string";
value: string | null;
};
SubSurfaceBehavior: {
metadata: WebscaleApiDataModels["SubSurfaceMetadata"];
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};
SubSurfaceMetadata: {
cssSelector?: null | string;
};
SurfaceBehavior: {
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};
SurfaceDecisionRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
identity: WebscaleApiDataModels["RequestIdentity"];
resource?: WebscaleApiDataModels["RequestResource"];
surfaceSlug: string;
};
SurfaceDecisionResponse: {
componentBehaviors: {
[key: string]: {
metadata: WebscaleApiDataModels["SubSurfaceMetadata"];
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};
};
componentsSkipped: boolean;
surfaceBehavior: WebscaleApiDataModels["SurfaceBehavior"];
} & WebscaleApiDataModels["AccessCheckResponse"];
UserIdentity: {
authType: "provided" | "jwt" | "anonymous";
identifier: string;
isAuthenticated: boolean;
jwtClaims?: {
[key: string]: unknown;
};
};
};Properties
AccessCheckRequest
AccessCheckRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
identity: WebscaleApiDataModels["RequestIdentity"];
resource?: WebscaleApiDataModels["RequestResource"];
};-
cloudflare?
optional cloudflare: WebscaleApiDataModels["CloudflareRequest"]; -
identity
identity: WebscaleApiDataModels["RequestIdentity"]; -
resource?
optional resource: WebscaleApiDataModels["RequestResource"]; -
Description
Request payload for access checks.
**User Identity (required):** Exactly one of the following must be provided: - 'userIdentifier': Direct user ID (requires secret key) - 'userJwt': JWT token for authenticated users - 'anonymousIdentifier': Anonymous session identifier
Example
{
* "identity": {
* "userIdentifier": "user_12345"
* },
* "resource": {
* "id": "article_abc123"
* }
* }AccessCheckResponse
AccessCheckResponse: {
customer: WebscaleApiDataModels["CustomerInfo"];
eventId: string;
features: {
[key: string]: {
featureId: string;
featureSlug: string;
properties: {
[key: string]:
| {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
}
| {
isFallback: boolean;
type: "number";
value: number | null;
}
| {
isFallback: boolean;
type: "string";
value: string | null;
}
| {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};
};
};
};
identity: WebscaleApiDataModels["UserIdentity"];
status: "success";
};-
customer
customer: WebscaleApiDataModels["CustomerInfo"]; -
eventId
eventId: string;Description
Unique identifier for this access check event
Example
c918c19e-b782-4c2f-93c0-8a5f94c0a1b5 -
features
features: { [key: string]: { featureId: string; featureSlug: string; properties: { [key: string]: | { consumedInRequest?: boolean; consumedUnits?: number; consumedUnitsInRequest?: number; counterId: string; excessUnitsInRequest?: number; hasAccess: boolean; isFallback: boolean; periodStart?: string; remainingUnits?: number; resourceIdUsed?: boolean; totalUnits?: number; type: "meterable"; uniqueResources?: boolean; } | { isFallback: boolean; type: "number"; value: number | null; } | { isFallback: boolean; type: "string"; value: string | null; } | { isFallback: boolean; type: "boolean"; value: boolean | null; }; }; }; };Index Signature
[key: string]: { featureId: string; featureSlug: string; properties: { [key: string]: | { consumedInRequest?: boolean; consumedUnits?: number; consumedUnitsInRequest?: number; counterId: string; excessUnitsInRequest?: number; hasAccess: boolean; isFallback: boolean; periodStart?: string; remainingUnits?: number; resourceIdUsed?: boolean; totalUnits?: number; type: "meterable"; uniqueResources?: boolean; } | { isFallback: boolean; type: "number"; value: number | null; } | { isFallback: boolean; type: "string"; value: string | null; } | { isFallback: boolean; type: "boolean"; value: boolean | null; }; }; }Description
Map of feature slugs to feature access information
-
identity
identity: WebscaleApiDataModels["UserIdentity"]; -
status
status: "success";Description
Status of the access check
-
Description
Response from an access check
AnonymousRequestIdentity
AnonymousRequestIdentity: {
anonymousIdentifier: string;
};Anonymous User
-
anonymousIdentifier
anonymousIdentifier: string;Description
Identifier for anonymous/unauthenticated users. Use this for guest sessions or before user login.
Example
anon_session_789 -
Description
Request with anonymous identifier
BlindCounterUpdateRequest
BlindCounterUpdateRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
counterId: string;
identity: WebscaleApiDataModels["RequestIdentity"];
resourceId?: string;
update?: number;
};-
cloudflare?
optional cloudflare: WebscaleApiDataModels["CloudflareRequest"]; -
counterId
counterId: string;Description
Unique identifier for the counter to update
Example
api_calls.monthly_limit -
identity
identity: WebscaleApiDataModels["RequestIdentity"]; -
resourceId?
optional resourceId: string;Description
ID of the resource being tracked
Example
api_endpoint_123 -
update?
optional update: number;Description
Amount to add to the counter (can be negative)
Default
1Example
1 -
Description
Request to update usage counters without access check.
BlindCounterUpdateResponse
BlindCounterUpdateResponse: {
status: "success";
};-
status
status: "success";Description
Status of the counter update
-
Description
Response from a counter update
BooleanProperty
BooleanProperty: {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};-
isFallback
isFallback: boolean;Description
Whether this is a default value
-
type
type: "boolean";Description
Type of the property (enum property replaced by openapi-typescript)
-
value
value: boolean | null;Description
Boolean configuration value
Example
true
CloudflareRequest
CloudflareRequest: {
cf?: WebscaleApiDataModels["CloudflareWorkersCf"];
};Cloudflare Request Info
-
cf?
optional cf: WebscaleApiDataModels["CloudflareWorkersCf"]; -
Description
Request information specific to requests made from Cloudflare Workers. (requires secret key)
CloudflareWorkersCf
CloudflareWorkersCf: {
asOrganization?: string | null;
botManagement?: | {
detectionIds?: number[];
score?: number;
verifiedBot?: boolean;
}
| null;
city?: string | null;
continent?: string | null;
country?: string | null;
isEUCountry?: string | null;
latitude?: string | null;
longitude?: string | null;
metroCode?: string | null;
postalCode?: string | null;
region?: string | null;
regionCode?: string | null;
timezone?: string | null;
verifiedBotCategory?: string | null;
};Cloudflare Workers CF Object
-
asOrganization?
optional asOrganization: string | null; -
botManagement?
optional botManagement: | { detectionIds?: number[]; score?: number; verifiedBot?: boolean; } | null; -
city?
optional city: string | null; -
continent?
optional continent: string | null; -
country?
optional country: string | null; -
isEUCountry?
optional isEUCountry: string | null; -
latitude?
optional latitude: string | null; -
longitude?
optional longitude: string | null; -
metroCode?
optional metroCode: string | null; -
postalCode?
optional postalCode: string | null; -
region?
optional region: string | null; -
regionCode?
optional regionCode: string | null; -
timezone?
optional timezone: string | null; -
verifiedBotCategory?
optional verifiedBotCategory: string | null; -
Description
See https://developers.cloudflare.com/workers/runtime-apis/request/#incomingrequestcfproperties
CustomerInfo
CustomerInfo: {
customerIdentifiers: string[];
hasProducts: boolean;
isCustomer: boolean;
};-
customerIdentifiers
customerIdentifiers: string[];Description
List of customer identifiers (user ID, Stripe customer ID, etc.)
Example
[ "user_12345", "stripe_cus_abc123" ] -
hasProducts
hasProducts: boolean;Description
Whether the user has any associated products
Example
true -
isCustomer
isCustomer: boolean;Description
Whether the user is a paying customer
Example
true -
Description
Customer status and product information
ErrorResponse
ErrorResponse: {
errors?: WebscaleApiDataModels["ErrorResponse"][];
message: string;
status: "error";
statusCode: number;
};-
errors?
optional errors: WebscaleApiDataModels["ErrorResponse"][];Description
Additional error details
-
message
message: string;Description
Human-readable error message
Example
Invalid API key -
status
status: "error";Description
Status indicating an error occurred
-
statusCode
statusCode: number;Description
HTTP status code
Example
400 -
Description
Error response format
FeatureAccess
FeatureAccess: {
featureId: string;
featureSlug: string;
properties: {
[key: string]:
| {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
}
| {
isFallback: boolean;
type: "number";
value: number | null;
}
| {
isFallback: boolean;
type: "string";
value: string | null;
}
| {
isFallback: boolean;
type: "boolean";
value: boolean | null;
};
};
};-
featureId
featureId: string;Description
Internal feature identifier
Example
feat_123456 -
featureSlug
featureSlug: string;Description
Feature slug for external reference
Example
file_system -
properties
properties: { [key: string]: | { consumedInRequest?: boolean; consumedUnits?: number; consumedUnitsInRequest?: number; counterId: string; excessUnitsInRequest?: number; hasAccess: boolean; isFallback: boolean; periodStart?: string; remainingUnits?: number; resourceIdUsed?: boolean; totalUnits?: number; type: "meterable"; uniqueResources?: boolean; } | { isFallback: boolean; type: "number"; value: number | null; } | { isFallback: boolean; type: "string"; value: string | null; } | { isFallback: boolean; type: "boolean"; value: boolean | null; }; };Index Signature
[key: string]: | { consumedInRequest?: boolean; consumedUnits?: number; consumedUnitsInRequest?: number; counterId: string; excessUnitsInRequest?: number; hasAccess: boolean; isFallback: boolean; periodStart?: string; remainingUnits?: number; resourceIdUsed?: boolean; totalUnits?: number; type: "meterable"; uniqueResources?: boolean; } | { isFallback: boolean; type: "number"; value: number | null; } | { isFallback: boolean; type: "string"; value: string | null; } | { isFallback: boolean; type: "boolean"; value: boolean | null; }Description
Feature properties
-
Description
Access information for a specific feature
FeatureProperty
FeatureProperty:
| WebscaleApiDataModels["MeterableProperty"]
| WebscaleApiDataModels["NumberProperty"]
| WebscaleApiDataModels["StringProperty"]
| WebscaleApiDataModels["BooleanProperty"];-
Description
A feature property that can be boolean, number, string, or meterable with usage tracking
JwtRequestIdentity
JwtRequestIdentity: {
userJwt: string;
};JWT Authentication
-
userJwt
userJwt: string;Description
JWT token for user authentication. The JWT must be valid according to your configured JWT integrations.
Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KMUFsIDTnFmyG3nMiGM6H9FNFUROf3wh7SmqJp-QV30 -
Description
Request with JWT token
MeterableProperty
MeterableProperty: {
consumedInRequest?: boolean;
consumedUnits?: number;
consumedUnitsInRequest?: number;
counterId: string;
excessUnitsInRequest?: number;
hasAccess: boolean;
isFallback: boolean;
periodStart?: string;
remainingUnits?: number;
resourceIdUsed?: boolean;
totalUnits?: number;
type: "meterable";
uniqueResources?: boolean;
};-
consumedInRequest?
optional consumedInRequest: boolean;Description
Whether the counter for this meter was incremented in this request
Example
false -
consumedUnits?
optional consumedUnits: number;Description
Number of units already consumed in the current period
Example
10 -
consumedUnitsInRequest?
optional consumedUnitsInRequest: number;Description
Number of units consumed in this request
Example
1 -
counterId
counterId: string;Description
Unique identifier for the usage counter
Example
feat_123456.enabled -
excessUnitsInRequest?
optional excessUnitsInRequest: number;Description
Number of attempted consumption units in this request that exceeded available units
Example
0 -
hasAccess
hasAccess: boolean;Description
Whether the user currently has access
Example
true -
isFallback
isFallback: boolean;Description
Whether this is a default value
-
periodStart?
optional periodStart: string;Format: date-time
Description
Start of the current usage period
Example
2025-07-01T00:00:00Z -
remainingUnits?
optional remainingUnits: number;Description
Number of units remaining in the current period
Example
5 -
resourceIdUsed?
optional resourceIdUsed: boolean;Description
Whether the resource ID associated with this check has previously been used
Example
false -
totalUnits?
optional totalUnits: number;Description
Total units allowed in the current period
Example
15 -
type
type: "meterable";Description
Type of the property (enum property replaced by openapi-typescript)
-
uniqueResources?
optional uniqueResources: boolean;Description
Whether this counter tracks unique resources
Example
false
NumberProperty
NumberProperty: {
isFallback: boolean;
type: "number";
value: number | null;
};-
isFallback
isFallback: boolean;Description
Whether this is a default value
-
type
type: "number";Description
Type of the property (enum property replaced by openapi-typescript)
-
value
value: number | null;Description
Numeric configuration value
Example
100
ProvidedRequestIdentity
ProvidedRequestIdentity: {
userIdentifier: string;
};Authenticated User
-
userIdentifier
userIdentifier: string;Description
Authenticated user identifier. Can only be used with an organization's secret keys. Use this when you have a direct user ID from your system.
Example
user_12345 -
Description
Request with direct user identifier
RequestIdentity
RequestIdentity:
| WebscaleApiDataModels["ProvidedRequestIdentity"]
| WebscaleApiDataModels["JwtRequestIdentity"]
| WebscaleApiDataModels["AnonymousRequestIdentity"];Request Identity
-
Description
Properties used to identify the user or session that the request is associated with
RequestResource
RequestResource: {
id?: string;
} & {
[key: string]: unknown;
};-
Type Declaration
id?
optional id: string;Description
Unique identifier for the resource
Example
article_abc123 -
Description
Information about the resource being accessed. This helps determine which features and meter limits apply to the request.
Example
{
* "id": "article_abc123"
* }StringProperty
StringProperty: {
isFallback: boolean;
type: "string";
value: string | null;
};-
isFallback
isFallback: boolean;Description
Whether this is a default value
-
type
type: "string";Description
Type of the property (enum property replaced by openapi-typescript)
-
value
value: string | null;Description
String configuration value
Example
premium
SubSurfaceBehavior
SubSurfaceBehavior: {
metadata: WebscaleApiDataModels["SubSurfaceMetadata"];
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};-
Type Declaration
metadata
metadata: WebscaleApiDataModels["SubSurfaceMetadata"];properties?
optional properties: { [key: string]: unknown; };Index Signature
[key: string]: unknownDescription
Optional record of string keys to unknown values
-
Description
Open object with the results produced by the surface component workflows
SubSurfaceMetadata
SubSurfaceMetadata: {
cssSelector?: null | string;
};-
cssSelector?
optional cssSelector: null | string;Description
Optional CSS selector string
-
Description
Metadata for sub-surface behavior with optional CSS selector
SurfaceBehavior
SurfaceBehavior: {
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};-
Type Declaration
properties?
optional properties: { [key: string]: unknown; };Index Signature
[key: string]: unknownDescription
Optional record of string keys to unknown values
-
Description
Open object with the results produced by the top-level surface workflow
SurfaceDecisionRequest
SurfaceDecisionRequest: {
cloudflare?: WebscaleApiDataModels["CloudflareRequest"];
identity: WebscaleApiDataModels["RequestIdentity"];
resource?: WebscaleApiDataModels["RequestResource"];
surfaceSlug: string;
};-
cloudflare?
optional cloudflare: WebscaleApiDataModels["CloudflareRequest"]; -
identity
identity: WebscaleApiDataModels["RequestIdentity"]; -
resource?
optional resource: WebscaleApiDataModels["RequestResource"]; -
surfaceSlug
surfaceSlug: string; -
Description
Request payload for surface decisions.
**User Identity (required):** Exactly one of the following must be provided: - 'userIdentifier': Direct user ID (requires secret key) - 'userJwt': JWT token for authenticated users - 'anonymousIdentifier': Anonymous session identifier
Example
{
* "surfaceSlug": "website",
* "identity": {
* "userIdentifier": "user_12345"
* },
* "resource": {
* "id": "article_abc123"
* }
* }SurfaceDecisionResponse
SurfaceDecisionResponse: {
componentBehaviors: {
[key: string]: {
metadata: WebscaleApiDataModels["SubSurfaceMetadata"];
properties?: {
[key: string]: unknown;
};
} & {
[key: string]: unknown;
};
};
componentsSkipped: boolean;
surfaceBehavior: WebscaleApiDataModels["SurfaceBehavior"];
} & WebscaleApiDataModels["AccessCheckResponse"];-
Type Declaration
componentBehaviors
componentBehaviors: { [key: string]: { metadata: WebscaleApiDataModels["SubSurfaceMetadata"]; properties?: { [key: string]: unknown; }; } & { [key: string]: unknown; }; };Index Signature
[key: string]: { metadata: WebscaleApiDataModels["SubSurfaceMetadata"]; properties?: { [key: string]: unknown; }; } & { [key: string]: unknown; }Description
Record of component behaviors mapped by string keys
componentsSkipped
componentsSkipped: boolean;Description
Whether the component workflows were skipped by returning early from the surface workflow.
surfaceBehavior
surfaceBehavior: WebscaleApiDataModels["SurfaceBehavior"]; -
Description
Response from a surface decision
UserIdentity
UserIdentity: {
authType: "provided" | "jwt" | "anonymous";
identifier: string;
isAuthenticated: boolean;
jwtClaims?: {
[key: string]: unknown;
};
};-
authType
authType: "provided" | "jwt" | "anonymous";Description
How the user was authenticated: - provided: Direct identifier via API - jwt: JWT token authentication - anonymous: Anonymous user
Example
provided @enum {string} -
identifier
identifier: string;Description
The user's identifier
Example
user_12345 -
isAuthenticated
isAuthenticated: boolean;Description
Whether the user is authenticated
Example
true -
jwtClaims?
optional jwtClaims: { [key: string]: unknown; };Index Signature
[key: string]: unknownDescription
Claims extracted from the auth JWT
-
Description
Information about the user's identity and authentication status