deepgram-enterprise-rbac
Configure enterprise role-based access control for Deepgram integrations. Use when implementing team permissions, managing API key scopes, or setting up organization-level access controls. Trigger: "deepgram RBAC", "deepgram permissions", "deepgram access control", "deepgram team roles", "deepgram enterprise", "deepgram key scopes".
Best use case
deepgram-enterprise-rbac is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Configure enterprise role-based access control for Deepgram integrations. Use when implementing team permissions, managing API key scopes, or setting up organization-level access controls. Trigger: "deepgram RBAC", "deepgram permissions", "deepgram access control", "deepgram team roles", "deepgram enterprise", "deepgram key scopes".
Teams using deepgram-enterprise-rbac should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/deepgram-enterprise-rbac/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How deepgram-enterprise-rbac Compares
| Feature / Agent | deepgram-enterprise-rbac | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Configure enterprise role-based access control for Deepgram integrations. Use when implementing team permissions, managing API key scopes, or setting up organization-level access controls. Trigger: "deepgram RBAC", "deepgram permissions", "deepgram access control", "deepgram team roles", "deepgram enterprise", "deepgram key scopes".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Deepgram Enterprise RBAC
## Overview
Role-based access control for enterprise Deepgram deployments. Maps five application roles to Deepgram API key scopes, implements scoped key provisioning via the Deepgram Management API, Express permission middleware, team management with auto-provisioned keys, and automated key rotation.
## Deepgram Scope Reference
| Scope | Permission | Used By |
|-------|-----------|---------|
| `member` | Full access (all scopes) | Admin only |
| `listen` | STT transcription | Developers, Services |
| `speak` | TTS synthesis | Developers, Services |
| `manage` | Project/key management | Admin |
| `usage:read` | View usage metrics | Analysts, Auditors |
| `keys:read` | List API keys | Auditors |
| `keys:write` | Create/delete keys | Admin |
## Instructions
### Step 1: Define Roles and Scope Mapping
```typescript
interface Role {
name: string;
deepgramScopes: string[];
keyExpiry: number; // Days
description: string;
}
const ROLES: Record<string, Role> = {
admin: {
name: 'Admin',
deepgramScopes: ['member'],
keyExpiry: 90,
description: 'Full access — project and key management',
},
developer: {
name: 'Developer',
deepgramScopes: ['listen', 'speak'],
keyExpiry: 90,
description: 'STT and TTS — no management access',
},
analyst: {
name: 'Analyst',
deepgramScopes: ['usage:read'],
keyExpiry: 365,
description: 'Read-only usage metrics',
},
service: {
name: 'Service Account',
deepgramScopes: ['listen'],
keyExpiry: 90,
description: 'STT only — for automated systems',
},
auditor: {
name: 'Auditor',
deepgramScopes: ['usage:read', 'keys:read'],
keyExpiry: 30,
description: 'Read-only audit access',
},
};
```
### Step 2: Scoped Key Provisioning
```typescript
import { createClient } from '@deepgram/sdk';
class DeepgramKeyManager {
private admin: ReturnType<typeof createClient>;
private projectId: string;
constructor(adminKey: string, projectId: string) {
this.admin = createClient(adminKey);
this.projectId = projectId;
}
async createScopedKey(userId: string, roleName: string): Promise<{
keyId: string;
key: string;
scopes: string[];
expiresAt: string;
}> {
const role = ROLES[roleName];
if (!role) throw new Error(`Unknown role: ${roleName}`);
const expirationDate = new Date(Date.now() + role.keyExpiry * 86400000);
const { result, error } = await this.admin.manage.createProjectKey(
this.projectId,
{
comment: `${roleName}:${userId}:${new Date().toISOString().split('T')[0]}`,
scopes: role.deepgramScopes,
expiration_date: expirationDate.toISOString(),
}
);
if (error) throw new Error(`Key creation failed: ${error.message}`);
console.log(`Created ${roleName} key for ${userId} (expires ${expirationDate.toISOString().split('T')[0]})`);
return {
keyId: result.key_id,
key: result.key,
scopes: role.deepgramScopes,
expiresAt: expirationDate.toISOString(),
};
}
async revokeKey(keyId: string) {
const { error } = await this.admin.manage.deleteProjectKey(
this.projectId, keyId
);
if (error) throw new Error(`Key revocation failed: ${error.message}`);
console.log(`Revoked key: ${keyId}`);
}
async listKeys() {
const { result, error } = await this.admin.manage.getProjectKeys(this.projectId);
if (error) throw error;
return result.api_keys.map((k: any) => ({
keyId: k.api_key_id,
comment: k.comment,
scopes: k.scopes,
created: k.created,
expiration: k.expiration_date,
}));
}
}
```
### Step 3: Permission Middleware
```typescript
import { Request, Response, NextFunction } from 'express';
interface AuthenticatedRequest extends Request {
user?: { id: string; role: string; deepgramKeyId: string };
}
function requireRole(...allowedRoles: string[]) {
return (req: AuthenticatedRequest, res: Response, next: NextFunction) => {
if (!req.user) {
return res.status(401).json({ error: 'Authentication required' });
}
if (!allowedRoles.includes(req.user.role)) {
console.warn(`Access denied: user ${req.user.id} (${req.user.role}) tried to access ${req.path}`);
return res.status(403).json({
error: 'Insufficient permissions',
required: allowedRoles,
current: req.user.role,
});
}
next();
};
}
function requireScope(...requiredScopes: string[]) {
return (req: AuthenticatedRequest, res: Response, next: NextFunction) => {
if (!req.user) {
return res.status(401).json({ error: 'Authentication required' });
}
const role = ROLES[req.user.role];
const hasScopes = requiredScopes.every(
s => role.deepgramScopes.includes(s) || role.deepgramScopes.includes('member')
);
if (!hasScopes) {
return res.status(403).json({
error: 'Missing required Deepgram scopes',
required: requiredScopes,
current: role.deepgramScopes,
});
}
next();
};
}
// Route examples:
app.post('/api/transcribe', requireScope('listen'), transcribeHandler);
app.post('/api/tts', requireScope('speak'), ttsHandler);
app.get('/api/usage', requireScope('usage:read'), usageHandler);
app.post('/api/keys', requireRole('admin'), createKeyHandler);
app.get('/api/audit', requireRole('admin', 'auditor'), auditHandler);
```
### Step 4: Team Management
```typescript
interface Team {
id: string;
name: string;
projectId: string; // Deepgram project ID
members: Array<{
userId: string;
role: string;
keyId: string;
joinedAt: string;
}>;
}
class TeamManager {
private keyManager: DeepgramKeyManager;
constructor(adminKey: string, projectId: string) {
this.keyManager = new DeepgramKeyManager(adminKey, projectId);
}
async addMember(team: Team, userId: string, role: string) {
// Provision Deepgram key with role scopes
const key = await this.keyManager.createScopedKey(userId, role);
team.members.push({
userId,
role,
keyId: key.keyId,
joinedAt: new Date().toISOString(),
});
console.log(`Added ${userId} to ${team.name} as ${role}`);
return key;
}
async removeMember(team: Team, userId: string) {
const member = team.members.find(m => m.userId === userId);
if (!member) throw new Error(`User ${userId} not in team`);
// Revoke Deepgram key
await this.keyManager.revokeKey(member.keyId);
team.members = team.members.filter(m => m.userId !== userId);
console.log(`Removed ${userId} from ${team.name}, key revoked`);
}
async changeRole(team: Team, userId: string, newRole: string) {
const member = team.members.find(m => m.userId === userId);
if (!member) throw new Error(`User ${userId} not in team`);
// Revoke old key, create new key with new role scopes
await this.keyManager.revokeKey(member.keyId);
const newKey = await this.keyManager.createScopedKey(userId, newRole);
member.role = newRole;
member.keyId = newKey.keyId;
console.log(`Changed ${userId} role to ${newRole}`);
return newKey;
}
}
```
### Step 5: Automated Key Rotation
```typescript
async function rotateExpiringKeys(
keyManager: DeepgramKeyManager,
db: any,
daysBeforeExpiry = 7
) {
const keys = await keyManager.listKeys();
const now = Date.now();
const threshold = now + daysBeforeExpiry * 86400000;
let rotated = 0;
for (const key of keys) {
if (!key.expiration) continue;
const expiresAt = new Date(key.expiration).getTime();
if (expiresAt < threshold) {
// Parse role from comment (format: "role:userId:date")
const [role, userId] = (key.comment ?? '').split(':');
if (!role || !userId) {
console.warn(`Cannot rotate key ${key.keyId} — unknown format: ${key.comment}`);
continue;
}
console.log(`Rotating key for ${userId} (${role}), expires ${key.expiration}`);
// Create new key
const newKey = await keyManager.createScopedKey(userId, role);
// Update database with new key ID
await db.query(
'UPDATE team_members SET key_id = $1 WHERE user_id = $2',
[newKey.keyId, userId]
);
// Revoke old key (after a grace period, or immediately)
await keyManager.revokeKey(key.keyId);
rotated++;
}
}
console.log(`Rotated ${rotated} keys expiring within ${daysBeforeExpiry} days`);
return rotated;
}
```
### Step 6: Access Control Matrix
| Action | Admin | Developer | Analyst | Service | Auditor |
|--------|-------|-----------|---------|---------|---------|
| Transcribe (STT) | Yes | Yes | No | Yes | No |
| Text-to-Speech | Yes | Yes | No | No | No |
| View usage | Yes | No | Yes | No | Yes |
| Manage keys | Yes | No | No | No | No |
| View audit logs | Yes | No | No | No | Yes |
| Create projects | Yes | No | No | No | No |
## Output
- Five-role permission model with Deepgram scope mapping
- Scoped API key provisioning via Management API
- Express middleware (role-based and scope-based)
- Team management with auto-provisioned/revoked keys
- Automated key rotation for expiring keys
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| 403 Forbidden | Key lacks scope | Create new key with correct scopes |
| Key expired | No rotation configured | Enable automated rotation |
| `manage.createProjectKey` fails | Admin key missing `member` scope | Use key with `member` scope |
| Team member can't transcribe | Wrong role assigned | Change role to `developer` or `service` |
## Resources
- [API Key Management](https://developers.deepgram.com/docs/api-key-management)
- [Project Management](https://developers.deepgram.com/docs/projects)
- [Deepgram Enterprise](https://deepgram.com/enterprise)Related Skills
kubernetes-rbac-analyzer
Kubernetes Rbac Analyzer - Auto-activating skill for Security Advanced. Triggers on: kubernetes rbac analyzer, kubernetes rbac analyzer Part of the Security Advanced skill category.
exa-enterprise-rbac
Manage Exa API key scoping, team access controls, and domain restrictions. Use when implementing multi-key access control, configuring per-team search limits, or setting up organization-level Exa governance. Trigger with phrases like "exa access control", "exa RBAC", "exa enterprise", "exa team keys", "exa permissions".
evernote-enterprise-rbac
Implement enterprise RBAC for Evernote integrations. Use when building multi-tenant systems, implementing role-based access, or handling business accounts. Trigger with phrases like "evernote enterprise", "evernote rbac", "evernote business", "evernote permissions".
documenso-enterprise-rbac
Configure Documenso enterprise role-based access control and team management. Use when implementing team permissions, configuring organizational roles, or setting up enterprise access controls. Trigger with phrases like "documenso RBAC", "documenso teams", "documenso permissions", "documenso enterprise", "documenso roles".
deepgram-webhooks-events
Implement Deepgram callback and webhook handling for async transcription. Use when implementing callback URLs, processing async transcription results, or handling Deepgram event notifications. Trigger: "deepgram callback", "deepgram webhook", "async transcription", "deepgram events", "deepgram notifications", "deepgram async".
deepgram-upgrade-migration
Plan and execute Deepgram SDK upgrades and model migrations. Use when upgrading SDK versions (v3->v4->v5), migrating models (Nova-2 to Nova-3), or planning API version transitions. Trigger: "upgrade deepgram", "deepgram migration", "update deepgram SDK", "deepgram version upgrade", "nova-3 migration".
deepgram-security-basics
Apply Deepgram security best practices for API key management and data protection. Use when securing Deepgram integrations, implementing key rotation, or auditing security configurations. Trigger: "deepgram security", "deepgram API key security", "secure deepgram", "deepgram key rotation", "deepgram data protection", "deepgram PII redaction".
deepgram-sdk-patterns
Apply production-ready Deepgram SDK patterns for TypeScript and Python. Use when implementing Deepgram integrations, refactoring SDK usage, or establishing team coding standards for Deepgram. Trigger: "deepgram SDK patterns", "deepgram best practices", "deepgram code patterns", "idiomatic deepgram", "deepgram typescript".
deepgram-reference-architecture
Implement Deepgram reference architecture for scalable transcription systems. Use when designing transcription pipelines, building production architectures, or planning Deepgram integration at scale. Trigger: "deepgram architecture", "transcription pipeline", "deepgram system design", "deepgram at scale", "enterprise deepgram", "deepgram queue".
deepgram-rate-limits
Implement Deepgram rate limiting and backoff strategies. Use when handling API quotas, implementing request throttling, or dealing with 429 rate limit errors. Trigger: "deepgram rate limit", "deepgram throttling", "429 error deepgram", "deepgram quota", "deepgram backoff", "deepgram concurrency".
deepgram-prod-checklist
Execute Deepgram production deployment checklist. Use when preparing for production launch, auditing production readiness, or verifying deployment configurations. Trigger: "deepgram production", "deploy deepgram", "deepgram prod checklist", "deepgram go-live", "production ready deepgram".
deepgram-performance-tuning
Optimize Deepgram API performance for faster transcription and lower latency. Use when improving transcription speed, reducing latency, or optimizing audio processing pipelines. Trigger: "deepgram performance", "speed up deepgram", "optimize transcription", "deepgram latency", "deepgram faster", "deepgram throughput".