Policy types
Syft Space supports three types of policies that can be applied to endpoints. Each policy type has its own configuration schema and behavior.Rate limit policy
Policy type:rate_limit
Icon: ⏱️
Description: Limit the number of requests that can be made within a time window. Supports per-user rate limiting and selective application to specific users.
Configuration
Rate limit in format
N/unit where unit is s (seconds), m (minutes), or h (hours).Examples: 50/m, 1000/h, 100/sScope of the rate limit:
per_user: Each user has their own rate limit counterglobal: All users share the same rate limit counter for the endpoint
List of user email patterns to apply this rate limit to. Supports glob patterns.Examples:
["*"]: Apply to all users["*@company.com"]: Apply to all users from company.com["[email protected]", "[email protected]"]: Apply to specific users
Behavior
- Aggregation logic: AND - All rate limit policies must pass
- Ordering: Policies are sorted by most restrictive first (fail fast)
- Stateless: Rate limit history is managed by the limiter module
Example configuration
Access control policy
Policy type:access
Icon: 🔐
Description: Control access to endpoints using whitelist and blacklist rules. Denied users are always blocked, even if in the allowed list.
Configuration
List of glob patterns for allowed users. Empty array means everyone is allowed (except denied users).Examples:
["*@company.com"]: Allow all users from company.com["admin-*@*"]: Allow all users with admin- prefix["*"]: Allow everyone
List of glob patterns for denied users. Takes priority over
allowed_users.Examples:["[email protected]"]: Deny specific user["*@competitor.com"]: Deny all users from competitor.com
Access control logic
- If user matches
denied_userspattern → DENY (blacklist takes priority) - If
allowed_usersis empty → ALLOW (open to everyone except denied) - If user matches
allowed_userspattern → ALLOW - Otherwise → DENY
Behavior
- Aggregation logic: OR - If any access policy allows, access is granted
- Ordering: Policies are sorted by specificity (most specific patterns first)
- Stateless: No state is maintained
Example configurations
Allow only company users:Accounting policy
Policy type:accounting
Icon: 💰
Description: Track and bill API usage based on calls or tokens. Integrates with external accounting service for transaction management.
Configuration
Price per unit. Must be greater than or equal to 0.
Pricing mode:
per_call: Fixed price per API call (currently the only supported mode)
List of user email patterns to apply this accounting policy to. Supports glob patterns.Examples:
["*"]: Apply to all users["*@company.com"]: Apply to all users from company.com
Behavior
- Aggregation logic: AND - All accounting policies must succeed
- Stateless: Accounting records are managed by external accounting SDK
- Transaction flow:
- Pre-hook: Create delegated transaction before endpoint execution
- Endpoint executes
- Post-hook: Confirm transaction after successful execution
- Requirements: Requires accounting credentials in context metadata (injected from marketplace configuration)
- Transaction token: Requests must include a
transaction_tokenfield when accounting policies are active
Example configuration
Making requests with accounting
When an endpoint has accounting policies, requests must include a transaction token:Get policy types
List all policy types
Retrieve information about all available policy types. Endpoint:Get specific policy type
Retrieve information about a specific policy type. Endpoint:Name of the policy type (e.g.,
rate_limit, access, accounting)Get policy type schema
Retrieve only the configuration schema for a specific policy type. Endpoint:Name of the policy type (e.g.,
rate_limit, access, accounting)