Using Deepgram Management API (.NET SDK)
Administrative REST endpoints for projects, models, API keys, members, invites, usage, balances, and auth token grants.
When to use this product
- List or mutate projects.
- List models or per-project model availability.
- Manage keys, members, invites, scopes, usage, balances.
- Mint short-lived bearer tokens with
GrantToken().
Use a different skill when:
- You want to run a live agent session →
deepgram-dotnet-voice-agent.
- You want STT/TTS rather than project administration.
Authentication
dotnet add package Deepgram
using Deepgram;
Library.Initialize();
var manageClient = ClientFactory.CreateManageClient();
var authClient = ClientFactory.CreateAuthClient();
Both factory calls read credentials from the DEEPGRAM_API_KEY (or DEEPGRAM_ACCESS_TOKEN) environment variable by default. To pass them explicitly: ClientFactory.CreateManageClient(apiKey: "...", options: ...) / ClientFactory.CreateAuthClient(apiKey: "...", options: ...). DeepgramHttpClientOptions throws if neither the env var nor an explicit credential is provided.
Quick start — projects and models
using Deepgram.Models.Manage.v1;
var client = ClientFactory.CreateManageClient();
var projects = await client.GetProjects();
var projectId = projects.Projects[0].ProjectId;
var project = await client.GetProject(projectId);
var models = await client.GetModels(new ModelSchema { IncludeOutdated = true });
var projectModels = await client.GetProjectModels(projectId);
Quick start — keys / invites / members / usage
var client = ClientFactory.CreateManageClient();
var projectId = (await client.GetProjects()).Projects[0].ProjectId;
var key = await client.CreateKey(projectId, new KeySchema()
{
Comment = "MyTestKey",
Scopes = new List<string> { "member" },
});
await client.SendInvite(projectId, new InviteSchema()
{
Email = "spam@spam.com",
Scope = "member",
});
var members = await client.GetMembers(projectId);
var usage = await client.GetUsageRequests(projectId, new UsageRequestsSchema());
var balances = await client.GetBalances(projectId);
Quick start — auth token grant
using Deepgram.Models.Auth.v1;
using Deepgram.Models.Authenticate.v1;
var authClient = ClientFactory.CreateAuthClient();
var token = await authClient.GrantToken(new GrantTokenSchema
{
TtlSeconds = 300,
});
var bearerOptions = new DeepgramHttpClientOptions(accessToken: token.AccessToken);
var prerecordClient = ClientFactory.CreateListenRESTClient(options: bearerOptions);
Key methods
Management:
GetProjects, GetProject, UpdateProject, DeleteProject, LeaveProject
GetModels, GetModel, GetProjectModels, GetProjectModel
GetKeys, GetKey, CreateKey, DeleteKey
GetInvites, SendInvite, DeleteInvite
GetMembers, GetMemberScopes, UpdateMemberScope, RemoveMember
GetUsageRequests, GetUsageRequest, GetUsageFields, GetUsageSummary
GetBalances, GetBalance
Auth:
GrantToken()
GrantToken(GrantTokenSchema)
References
Guard pattern for destructive operations
// 1. Verify the resource exists
var key = await client.GetKey(projectId, keyId);
Console.WriteLine($"Found key: {key.ApiKey.Comment} ({keyId})");
// 2. Delete
await client.DeleteKey(projectId, keyId);
// 3. Verify deletion succeeded
try
{
await client.GetKey(projectId, keyId);
Console.Error.WriteLine("ERROR: key still exists after deletion");
}
catch
{
Console.WriteLine("Key deleted successfully.");
}
Gotchas
- This repo does not currently expose Voice Agent configuration CRUD. Do not copy Python
client.voice_agent.configurations.* examples into C#.
- Destructive methods are irreversible.
DeleteProject, DeleteKey, DeleteInvite, and RemoveMember should always use the verify-delete-verify pattern above.
- Bearer-token auth is supported.
DeepgramHttpClientOptions prefers explicit accessToken over apiKey, then env vars in that order.
- Most sub-resources are project-scoped. Fetch a project ID first via
GetProjects() before calling key/member/usage methods.
Example files in this repo
examples/manage/projects/Program.cs
examples/manage/models/Program.cs
examples/manage/keys/Program.cs
examples/manage/members/Program.cs
examples/manage/scopes/Program.cs
examples/manage/invitations/Program.cs
examples/manage/usage/Program.cs
examples/manage/balances/Program.cs
examples/auth/grant-token/Program.cs
examples/auth/bearer-token-workflow/Program.cs
Cross-language product knowledge (API reference, recipes, MCP setup): npx skills add deepgram/skills.
1---2name: deepgram-dotnet-management-api3description: Use when writing or reviewing C# code in this repo that calls Deepgram Management APIs for projects, models, keys, members, invitations, usage, balances, and auth token grants. Covers `ClientFactory.CreateManageClient()` and `ClientFactory.CreateAuthClient()`. Unlike some other SDKs, this repo does not currently expose reusable Voice Agent configuration management endpoints.4---56# Using Deepgram Management API (.NET SDK)78Administrative REST endpoints for projects, models, API keys, members, invites, usage, balances, and auth token grants.910## When to use this product1112- List or mutate projects.13- List models or per-project model availability.14- Manage keys, members, invites, scopes, usage, balances.15- Mint short-lived bearer tokens with `GrantToken()`.1617**Use a different skill when:**18- You want to run a live agent session → `deepgram-dotnet-voice-agent`.19- You want STT/TTS rather than project administration.2021## Authentication2223```bash24dotnet add package Deepgram25```2627```csharp28using Deepgram;2930Library.Initialize();31var manageClient = ClientFactory.CreateManageClient();32var authClient = ClientFactory.CreateAuthClient();33```3435Both factory calls read credentials from the `DEEPGRAM_API_KEY` (or `DEEPGRAM_ACCESS_TOKEN`) environment variable by default. To pass them explicitly: `ClientFactory.CreateManageClient(apiKey: "...", options: ...)` / `ClientFactory.CreateAuthClient(apiKey: "...", options: ...)`. `DeepgramHttpClientOptions` throws if neither the env var nor an explicit credential is provided.3637## Quick start — projects and models3839```csharp40using Deepgram.Models.Manage.v1;4142var client = ClientFactory.CreateManageClient();4344var projects = await client.GetProjects();45var projectId = projects.Projects[0].ProjectId;4647var project = await client.GetProject(projectId);48var models = await client.GetModels(new ModelSchema { IncludeOutdated = true });49var projectModels = await client.GetProjectModels(projectId);50```5152## Quick start — keys / invites / members / usage5354```csharp55var client = ClientFactory.CreateManageClient();56var projectId = (await client.GetProjects()).Projects[0].ProjectId;5758var key = await client.CreateKey(projectId, new KeySchema()59{60 Comment = "MyTestKey",61 Scopes = new List<string> { "member" },62});6364await client.SendInvite(projectId, new InviteSchema()65{66 Email = "spam@spam.com",67 Scope = "member",68});6970var members = await client.GetMembers(projectId);71var usage = await client.GetUsageRequests(projectId, new UsageRequestsSchema());72var balances = await client.GetBalances(projectId);73```7475## Quick start — auth token grant7677```csharp78using Deepgram.Models.Auth.v1;79using Deepgram.Models.Authenticate.v1;8081var authClient = ClientFactory.CreateAuthClient();82var token = await authClient.GrantToken(new GrantTokenSchema83{84 TtlSeconds = 300,85});8687var bearerOptions = new DeepgramHttpClientOptions(accessToken: token.AccessToken);88var prerecordClient = ClientFactory.CreateListenRESTClient(options: bearerOptions);89```9091## Key methods9293Management:94- `GetProjects`, `GetProject`, `UpdateProject`, `DeleteProject`, `LeaveProject`95- `GetModels`, `GetModel`, `GetProjectModels`, `GetProjectModel`96- `GetKeys`, `GetKey`, `CreateKey`, `DeleteKey`97- `GetInvites`, `SendInvite`, `DeleteInvite`98- `GetMembers`, `GetMemberScopes`, `UpdateMemberScope`, `RemoveMember`99- `GetUsageRequests`, `GetUsageRequest`, `GetUsageFields`, `GetUsageSummary`100- `GetBalances`, `GetBalance`101102Auth:103- `GrantToken()`104- `GrantToken(GrantTokenSchema)`105106## References107108- In-repo: `Deepgram/Clients/Manage/v1/Client.cs`, `Deepgram/Clients/Auth/v1/Client.cs`, `Deepgram/Models/Manage/v1/*.cs`, `Deepgram/Models/Auth/v1/*.cs`109- OpenAPI: https://developers.deepgram.com/openapi.yaml110- Product docs: https://developers.deepgram.com/reference/manage/projects/list, https://developers.deepgram.com/reference/auth/grant-token111112## Guard pattern for destructive operations113114```csharp115// 1. Verify the resource exists116var key = await client.GetKey(projectId, keyId);117Console.WriteLine($"Found key: {key.ApiKey.Comment} ({keyId})");118119// 2. Delete120await client.DeleteKey(projectId, keyId);121122// 3. Verify deletion succeeded123try124{125 await client.GetKey(projectId, keyId);126 Console.Error.WriteLine("ERROR: key still exists after deletion");127}128catch129{130 Console.WriteLine("Key deleted successfully.");131}132```133134## Gotchas1351361. **This repo does not currently expose Voice Agent configuration CRUD.** Do not copy Python `client.voice_agent.configurations.*` examples into C#.1372. **Destructive methods are irreversible.** `DeleteProject`, `DeleteKey`, `DeleteInvite`, and `RemoveMember` should always use the verify-delete-verify pattern above.1383. **Bearer-token auth is supported.** `DeepgramHttpClientOptions` prefers explicit `accessToken` over `apiKey`, then env vars in that order.1394. **Most sub-resources are project-scoped.** Fetch a project ID first via `GetProjects()` before calling key/member/usage methods.140141## Example files in this repo142143- `examples/manage/projects/Program.cs`144- `examples/manage/models/Program.cs`145- `examples/manage/keys/Program.cs`146- `examples/manage/members/Program.cs`147- `examples/manage/scopes/Program.cs`148- `examples/manage/invitations/Program.cs`149- `examples/manage/usage/Program.cs`150- `examples/manage/balances/Program.cs`151- `examples/auth/grant-token/Program.cs`152- `examples/auth/bearer-token-workflow/Program.cs`153154Cross-language product knowledge (API reference, recipes, MCP setup): `npx skills add deepgram/skills`.