Documentation Index
Fetch the complete documentation index at: https://docs.grantex.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Grantex supports policy-as-code workflows where your authorization policies live in a Git repository and are automatically synced to the auth service.
Uploading Policy Bundles
Upload a policy bundle via the API:
# Base64-encode your policy files
CONTENT=$(tar czf - policies/ | base64)
curl -X POST https://api.grantex.dev/v1/policies/sync \
-H "Authorization: Bearer $GRANTEX_KEY" \
-H "Content-Type: application/json" \
-d "{
\"format\": \"rego\",
\"version\": \"1.2.0\",
\"content\": \"$CONTENT\",
\"fileCount\": 5,
\"activate\": true
}"
Git Webhook Integration
Set up a webhook to automatically sync on push:
- Configure a webhook in your Git provider pointing to:
POST https://api.grantex.dev/v1/policies/sync/webhook
- Your CI/CD pipeline bundles and uploads the policies on each push to main
Managing Bundles
# List all bundles
curl https://api.grantex.dev/v1/policies/bundles \
-H "Authorization: Bearer $GRANTEX_KEY"
# Get active bundle
curl "https://api.grantex.dev/v1/policies/bundles/active?format=rego" \
-H "Authorization: Bearer $GRANTEX_KEY"
SDK Usage
// TypeScript
const grantex = new Grantex({ apiKey: '...' });
// Policies are evaluated automatically on authorize()
const auth = await grantex.authorize({
agentId: 'ag_...',
userId: 'user_...',
scopes: ['read'],
});