Deepgram Security Basics

VerifiedCaution

Apply Deepgram security best practices for API key management and data protection. Use when securing Deepgram integrations, implementing key rotation, or auditing security configurations.

Sby Skills Guide Bot
SecurityIntermediate
8/30/2026
Claude Code
#deepgram#api-key-security#pii-redaction#key-rotation#ssrf-prevention

Recommended for

Automated summary

This skill outlines security best practices for Deepgram integrations: scoped API keys, key rotation, built-in PII redaction, temporary client-side keys, audio URL validation, and audit logging.

Strengths

  • Provides an actionable security checklist for a Deepgram integration.
  • Explains how to separate keys by listen, speak, usage:read, and admin scopes.
  • Shows Deepgram's built-in redaction option with pci, ssn, and numbers values.
  • Covers temporary keys for browser/mobile clients and SSRF prevention for audio URLs.

Limitations

  • The temporary-key creation example is cut off in the provided content and cannot be used as-is.
  • Audit logging and audio URL validation are listed in the checklist but not implemented in detail.
  • The skill does not replace an organization's compliance review or data classification policy.
When to use it

Use it when designing, hardening, or auditing a Deepgram integration that handles sensitive audio or transcripts.

When not to use it

Do not use it for general cloud security questions or advanced compliance requirements beyond Deepgram configuration.

Security analysis

Caution
Quality score76/100

The content is defensive and provides legitimate Deepgram security guidance with no destructive, exfiltration, obfuscation, or safety-disabling instructions. The main concern is the broad Bash(curl:*) tool declaration, plus an SSRF sample that is educational but incomplete.

Findings
  • •Declares Bash(curl:*) in allowed-tools but never actually instructs any shell/curl execution; all code is illustrative Node/TypeScript SDK usage — the declaration is broader than the content needs.
  • •The client-side token example exposes an Express endpoint (POST /api/deepgram/token) that mints project keys without showing any authentication/authorization or rate limiting; copied verbatim it would let anyone obtain Deepgram credentials. The doc should note that this route must be authenticated.
  • •SSRF validation example performs a DNS lookup then passes the original hostname to transcribeUrl, leaving a DNS-rebinding/TOCTOU gap; it should resolve once and pin the validated IP or use a vetted library. This is a correctness weakness in a defensive sample, not malicious.
  • •No exfiltration, obfuscation, destructive commands, or safety-disabling instructions present; credential handling is described via env vars/secret manager, which is the safe pattern.
  • •Declares Bash(curl:*) even though the skill is documentation/code-example oriented and provides no curl commands; this grants unnecessary network execution capability.
  • •The SSRF-prevention example performs a single DNS lookup before handing the URL to Deepgram and does not address redirects or DNS rebinding, so it should not be treated as a complete SSRF control.
How this analysis is made

Examples

Audit Deepgram key setup
Review my Deepgram integration and tell me how to split API keys by environment and scope (listen, speak, usage:read, admin), then outline a 90-day rotation procedure.
Redact PII from transcripts
Show me how to enable Deepgram's built-in redaction for PCI, SSN, and numeric data in a prerecorded transcription request, and explain what the resulting transcript will contain.
Secure browser audio access
I need browser clients to connect to Deepgram without exposing my main API key. Walk me through generating short-lived scoped keys from my backend and validating audio URLs to prevent SSRF.

name: deepgram-security-basics description: '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".

' allowed-tools: Read, Write, Edit, Grep, Bash(curl:*) version: 1.13.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:

  • saas
  • deepgram
  • api
  • security
  • compliance compatibility: Designed for Claude Code

Deepgram Security Basics

Prerequisites

  • A data classification and consent decision for the audio/transcript workload.
  • Scoped project credentials in the approved secret manager, an owner, and an incident/revocation route.

Examples

Use a development credential and a licensed non-sensitive audio fixture to verify the integration, logging only an opaque request ID and outcome. If recordings, transcripts, or keys are exposed, restrict access, revoke credentials where applicable, and follow the organization’s incident process before continuing.

Overview

Security best practices for Deepgram integration: scoped API keys, key rotation, Deepgram's built-in PII redaction feature, client-side temporary keys, SSRF prevention for audio URLs, and audit logging.

Security Checklist

  • [ ] API keys in environment variables or secret manager (never in code)
  • [ ] Separate keys per environment (dev/staging/prod)
  • [ ] Keys scoped to minimum required permissions
  • [ ] Key rotation schedule (90 days recommended)
  • [ ] Deepgram redact option enabled for PII-sensitive audio
  • [ ] Audio URLs validated (HTTPS only, no private IPs)
  • [ ] Audit logging on all transcription operations

Instructions

Step 1: Scoped API Keys

Create keys with minimal permissions in Console > Settings > API Keys:

// Production transcription service — only needs listen scope
const sttKey = process.env.DEEPGRAM_STT_KEY;  // Scope: listen

// TTS service — only needs speak scope
const ttsKey = process.env.DEEPGRAM_TTS_KEY;  // Scope: speak

// Monitoring dashboard — only needs usage read
const monitorKey = process.env.DEEPGRAM_MONITOR_KEY;  // Scope: usage:read

// Admin operations — separate key, restricted access
const adminKey = process.env.DEEPGRAM_ADMIN_KEY;  // Scope: manage, keys

Step 2: Deepgram Built-in PII Redaction

import { createClient } from '@deepgram/sdk';

const deepgram = createClient(process.env.DEEPGRAM_API_KEY!);

// Deepgram redacts PII directly in the transcript
const { result } = await deepgram.listen.prerecorded.transcribeUrl(
  { url: audioUrl },
  {
    model: 'nova-3',
    smart_format: true,
    // Built-in redaction — replaces sensitive data in transcript
    redact: ['pci', 'ssn', 'numbers'],
    // pci     — Credit card numbers → [REDACTED]
    // ssn     — Social Security numbers → [REDACTED]
    // numbers — All numeric sequences → [REDACTED]
  }
);

// Transcript will contain [REDACTED] in place of sensitive numbers
console.log(result.results.channels[0].alternatives[0].transcript);
// "My card number is [REDACTED] and my SSN is [REDACTED]"

Step 3: Temporary Keys for Client-Side

// Generate short-lived keys for browser/mobile clients
// This prevents exposing your main API key

import { createClient } from '@deepgram/sdk';
import express from 'express';

const app = express();
const deepgram = createClient(process.env.DEEPGRAM_API_KEY!);

app.post('/api/deepgram/token', async (req, res) => {
  // Create a temporary key that expires in 10 seconds
  // Use for browser WebSocket connections
  const { result, error } = await deepgram.manage.createProjectKey(
    process.env.DEEPGRAM_PROJECT_ID!,
    {
      comment: `temp-key-${Date.now()}`,
      scopes: ['listen'],          // Minimal scope
      time_to_live_in_seconds: 10, // Short-lived
    }
  );

  if (error) return res.status(500).json({ error: error.message });
  res.json({ key: result.key, expires_in: 10 });
});

// Browser client uses temporary key:
// const { key } = await fetch('/api/deepgram/token').then(r => r.json());
// const ws = new WebSocket('wss://api.deepgram.com/v1/listen', ['token', key]);

Step 4: Key Rotation

import { createClient } from '@deepgram/sdk';

async function rotateApiKey(projectId: string) {
  const admin = createClient(process.env.DEEPGRAM_ADMIN_KEY!);

  // 1. Create new key with same scopes
  const { result: newKey } = await admin.manage.createProjectKey(projectId, {
    comment: `rotated-${new Date().toISOString().split('T')[0]}`,
    scopes: ['listen', 'speak'],
    expiration_date: new Date(Date.now() + 90 * 86400000).toISOString(), // 90 days
  });
  console.log('New key created:', newKey.key_id);

  // 2. Update secret manager (example: GCP Secret Manager)
  // await updateSecret('DEEPGRAM_API_KEY', newKey.key);

  // 3. Validate new key works
  const testClient = createClient(newKey.key);
  const { error } = await testClient.manage.getProjects();
  if (error) throw new Error('New key validation failed — aborting rotation');

  // 4. Delete old key (after services have picked up new key)
  // await admin.manage.deleteProjectKey(projectId, oldKeyId);

  return newKey;
}

Step 5: Audio URL Validation (SSRF Prevention)

import { URL } from 'url';
import { lookup } from 'dns/promises';

async function validateAudioUrl(url: string): Promise<void> {
  const parsed = new URL(url);

  // Require HTTPS
  if (parsed.protocol !== 'https:') {
    throw new Error('Only HTTPS audio URLs allowed');
  }

  // Block private/internal IPs
  const { address } = await lookup(parsed.hostname);
  const privateRanges = [
    /^127\./, /^10\./, /^172\.(1[6-9]|2\d|3[01])\./, /^192\.168\./,
    /^0\./, /^169\.254\./, /^::1$/, /^fc00:/, /^fe80:/,
  ];
  if (privateRanges.some(r => r.test(address))) {
    throw new Error(`Blocked: ${parsed.hostname} resolves to private IP`);
  }

  // Block known internal hostnames
  const blockedHosts = ['localhost', 'metadata.google.internal', '169.254.169.254'];
  if (blockedHosts.includes(parsed.hostname)) {
    throw new Error(`Blocked hostname: ${parsed.hostname}`);
  }
}

// Use before transcription:
await validateAudioUrl(userProvidedUrl);
const { result } = await deepgram.listen.prerecorded.transcribeUrl(
  { url: userProvidedUrl }, { model: 'nova-3' }
);

Step 6: Audit Logging

interface AuditEntry {
  timestamp: string;
  action: 'transcribe' | 'tts' | 'key_create' | 'key_delete';
  userId: string;
  requestId?: string;
  model: string;
  audioDuration?: number;
  success: boolean;
  error?: string;
  ip?: string;
}

function logAudit(entry: AuditEntry) {
  // Structured JSON for log aggregation (Datadog, CloudWatch, etc.)
  const log = {
    ...entry,
    service: 'deepgram-integration',
    level: entry.success ? 'info' : 'error',
  };
  console.log(JSON.stringify(log));
}

// Usage in transcription middleware
async function transcribeWithAudit(userId: string, url: string, ip: string) {
  const start = Date.now();
  try {
    const { result, error } = await deepgram.listen.prerecorded.transcribeUrl(
      { url }, { model: 'nova-3', smart_format: true }
    );
    logAudit({
      timestamp: new Date().toISOString(),
      action: 'transcribe',
      userId, model: 'nova-3', ip,
      requestId: result?.metadata?.request_id,
      audioDuration: result?.metadata?.duration,
      success: !error,
      error: error?.message,
    });
    if (error) throw error;
    return result;
  } catch (err: any) {
    logAudit({
      timestamp: new Date().toISOString(),
      action: 'transcribe',
      userId, model: 'nova-3', ip,
      success: false, error: err.message,
    });
    throw err;
  }
}

Output

  • Scoped API keys per service/environment
  • Built-in PII redaction via redact parameter
  • Temporary keys for client-side (browser/mobile)
  • Key rotation with validation and cleanup
  • SSRF-safe audio URL validation
  • Structured audit logging

Error Handling

| Issue | Cause | Solution | |-------|-------|----------| | 403 after scoping | Key missing required scope | Add scope in Console (e.g., listen) | | Temp key expired | TTL too short | Increase time_to_live_in_seconds | | Rotation broke service | New key not propagated | Use overlap period — both keys active | | Redaction missed PII | Wrong redact option | Use redact: ['pci', 'ssn', 'numbers'] |

Resources

  • API Key Management
  • PII Redaction
  • Deepgram Security
  • SOC 2 / HIPAA

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/deepgram-security-basics-mtfbwl8z' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/deepgram-security-basics-mtfbwl8z/download' --output '.skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md.part' && mv '.skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md.part' '.skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: Designed for Claude Code

Tools declared by the author (check availability in your agent): Read, Write, Edit, Grep, Bash(curl:*)

Original excerpt: Prerequisites
  • A data classification and consent decision for the audio/transcript workload.
  • Scoped project credentials in the approved secret manager, an owner, and an incident/revocation route.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md' && test -s '.skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/deepgram-security-basics' && cp -R '.skill-downloads/deepgram-security-basics-mtfbwl8z' '.claude/skills/deepgram-security-basics'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/deepgram-security-basics-mtfbwl8z'

openskills read 'deepgram-security-basics-mtfbwl8z'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/deepgram-security-basics-mtfbwl8z/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills