Skip to content
GitHubXDiscord

ClientKey

Create and manage Sentry client keys.

You can authenticate with Sentry in two ways:

  1. Environment variable (recommended):

    .env
    SENTRY_AUTH_TOKEN=your_auth_token
  2. Pass the token directly:

    const key = await ClientKey("my-key", {
    authToken: alchemy.secret(process.env.SENTRY_AUTH_TOKEN),
    name: "My Key",
    project: "my-project",
    organization: "my-org",
    });

Get your Sentry User Auth Token.

Create a basic Sentry client key:

import { ClientKey } from "alchemy/sentry";
const key = await ClientKey("my-key", {
name: "My Key",
project: "my-project",
organization: "my-org",
});

Create a client key with rate limiting:

import { ClientKey } from "alchemy/sentry";
const key = await ClientKey("rate-limited-key", {
name: "Rate Limited Key",
project: "my-project",
organization: "my-org",
rateLimit: {
window: 3600, // 1 hour
count: 1000, // 1000 events per hour
},
});

Create a client key for a specific use case:

import { ClientKey } from "alchemy/sentry";
const key = await ClientKey("profiling-key", {
name: "Profiling Key",
project: "my-project",
organization: "my-org",
useCase: "profiling",
});

Create or adopt an existing key with the same name:

import { ClientKey } from "alchemy/sentry";
const key = await ClientKey("existing-key", {
adopt: true
name: "Existing Key",
project: "my-project",
organization: "my-org",
});