> **Building with AI coding agents?** If you're using an AI coding agent, install the official Scalekit plugin. It gives your agent full awareness of the Scalekit API — reducing hallucinations and enabling faster, more accurate code generation.
>
> - **Claude Code**: `/plugin marketplace add scalekit-inc/claude-code-authstack` then `/plugin install <auth-type>@scalekit-auth-stack`
> - **GitHub Copilot CLI**: `copilot plugin marketplace add scalekit-inc/github-copilot-authstack` then `copilot plugin install <auth-type>@scalekit-auth-stack`
> - **Codex**: run the bash installer, restart, then open Plugin Directory and enable `<auth-type>`
> - **Skills CLI** (Windsurf, Cline, 40+ agents): `npx skills add scalekit-inc/skills --list` then `--skill <skill-name>`
>
> `<auth-type>` / `<skill-name>`: `agentkit`, `full-stack-auth`, `mcp-auth`, `modular-sso`, `modular-scim` — [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Diarize

**Authentication:** Bearer Token
**Categories:** Transcription, Media, Productivity, Analytics
## What you can do

Connect this agent connector to let your agent:

- **Get get** — Retrieve the current status of a transcription job by its job ID
- **Transcript download** — Download the transcript output for a completed transcription job in JSON, TXT, SRT, or VTT format, including speaker diarization, segments, and word-level timestamps
- **Create create** — Submit a new transcription and diarization job for an audio or video URL (YouTube, X, Instagram, TikTok)

## Authentication

This connector uses **Bearer Token** authentication. Scalekit securely stores the token and injects it into API requests on behalf of your users. Your agent code never handles tokens directly — you only pass a `connectionName` and a user `identifier`.

Before calling this connector from your code, create the Diarize connection in **AgentKit** > **Connections** and copy the exact **Connection name** from that connection into your code. The value in code must match the dashboard exactly.

## Set up the connector

Register your Diarize API key with Scalekit so it can authenticate and proxy transcription requests on behalf of your users. Unlike OAuth connectors, Diarize uses API key authentication — there is no redirect URI or OAuth flow.

1. ### Get a Diarize API key

   - Sign in to [diarize.io](https://diarize.io) and go to **Settings** → **API Keys**.

   - Click **+ Create New Key**, give it a name (e.g., `Agent Auth`), and confirm.

   - Copy the key value — store it securely, as you will not be able to view it again.

   > Image: Diarize.io settings page showing the API Keys section with an existing key and the Create New Key button

2. ### Create a connection in Scalekit

   - In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** > **Create Connection**. Find **Diarize** and click **Create**.

   - Note the **Connection name** — you will use this as `connection_name` in your code (e.g., `diarize`).

   - Click **Save**.

   > Image: Scalekit connection configuration for Diarize showing the connection name and API Key authentication type

3. ### Add a connected account

   Connected accounts link a specific user identifier in your system to a Diarize API key. Add accounts via the dashboard for testing, or via the Scalekit API in production.

   **Via dashboard (for testing)**

   - Open the connection you created and click the **Connected Accounts** tab → **Add account**.

   - Fill in:
     - **Your User's ID** — a unique identifier for this user in your system (e.g., `user_123`)
     - **API Key** — the Diarize API key you copied in step 1

   - Click **Create Account**.

   > Image: Add connected account form for Diarize in Scalekit dashboard showing User ID and API Key fields

   **Via API (for production)**

   
     ### Node.js

```typescript
// Never hard-code API keys — read from secure storage or user input
const diarizeApiKey = getUserDiarizeKey(); // retrieve from your secure store

await scalekit.actions.upsertConnectedAccount({
  connectionName: 'diarize',
  identifier: 'user_123',       // your user's unique ID
  credentials: { token: diarizeApiKey },
});
```

     ### Python

```python
# Never hard-code API keys — read from secure storage or user input
diarize_api_key = get_user_diarize_key()  # retrieve from your secure store

scalekit_client.actions.upsert_connected_account(
    connection_name="diarize",
    identifier="user_123",
    credentials={"token": diarize_api_key}
)
```

   

   > tip: Production usage tip
>
> In production, call `upsert_connected_account` (Python) / `upsertConnectedAccount` (Node.js) when a user connects their Diarize account — for example, after they paste their API key into a settings page in your app.

> note: Supported media sources
>
> Diarize supports YouTube, X (Twitter), Instagram, and TikTok URLs. Direct audio or video file URLs are not supported — the URL must point to a public post on one of these platforms.

## Code examples

Connect a user's Diarize account and transcribe audio and video content through Scalekit tools. Scalekit handles API key storage and tool execution automatically — you never handle credentials in your application code.

Diarize is primarily used through Scalekit tools. Use `execute_tool` to submit transcription jobs, poll for completion, and download results in any supported format.

## Tool calling

Use this connector when you want an agent to transcribe and diarize audio or video from YouTube, X, Instagram, or TikTok.

- Use `diarize_create_transcription_job` to submit a URL for transcription. Returns an `id` (job ID) and an `estimatedTime` (in seconds) for how long processing will take.
- Use `diarize_get_job_status` to poll until `status` is `COMPLETED` or `FAILED`. Use `estimatedTime` to set a sensible timeout — do not give up before that time has elapsed.
- Use `diarize_download_transcript` to retrieve the result once complete. Choose `json` for structured speaker diarization data, or `txt`, `srt`, `vtt` for plain-text and subtitle formats.

  ### Python

```python title="examples/diarize_transcribe.py"

from scalekit.client import ScalekitClient

scalekit_client = ScalekitClient(
    client_id=os.environ["SCALEKIT_CLIENT_ID"],
    client_secret=os.environ["SCALEKIT_CLIENT_SECRET"],
    env_url=os.environ["SCALEKIT_ENV_URL"],
)

connected_account = scalekit_client.actions.get_or_create_connected_account(
    connection_name="diarize",
    identifier="user_123",
).connected_account

# Step 1: Submit a transcription job
create_result = scalekit_client.actions.execute_tool(
    tool_name="diarize_create_transcription_job",
    connected_account_id=connected_account.id,
    tool_input={
        "url": "https://www.youtube.com/watch?v=example",
        "language": "en",   # optional — omit for auto-detection
        "num_speakers": 2,  # optional — improves speaker diarization
    },
)
job_id = create_result.result["id"]
estimated_seconds = create_result.result.get("estimatedTime", 120)
deadline = time.time() + estimated_seconds * 2
print(f"Job {job_id} submitted. Estimated: {estimated_seconds}s")

# Step 2: Poll until complete
while True:
    if time.time() > deadline:
        raise TimeoutError(f"Job {job_id} timed out after {estimated_seconds * 2}s")
    time.sleep(15)
    status_result = scalekit_client.actions.execute_tool(
        tool_name="diarize_get_job_status",
        connected_account_id=connected_account.id,
        tool_input={"job_id": job_id},
    )
    status = status_result.result["status"]
    print("Status:", status)
    if status == "COMPLETED":
        break
    if status == "FAILED":
        raise RuntimeError(f"Job {job_id} failed")

# Step 3: Download the diarized transcript
transcript_result = scalekit_client.actions.execute_tool(
    tool_name="diarize_download_transcript",
    connected_account_id=connected_account.id,
    tool_input={"job_id": job_id, "format": "json"},
)
# handle the transcript_result
```

  ### Node.js

```typescript title="examples/diarize_transcribe.ts"

const scalekit = new ScalekitClient(
  process.env.SCALEKIT_ENV_URL!,
  process.env.SCALEKIT_CLIENT_ID!,
  process.env.SCALEKIT_CLIENT_SECRET!
);
const actions = scalekit.actions;

const { connectedAccount } = await actions.getOrCreateConnectedAccount({
  connectionName: 'diarize',
  identifier: 'user_123',
});

// Step 1: Submit a transcription job
const createResult = await actions.executeTool({
  toolName: 'diarize_create_transcription_job',
  connectedAccountId: connectedAccount.id,
  toolInput: {
    url: 'https://www.youtube.com/watch?v=example',
    language: 'en',   // optional — omit for auto-detection
    num_speakers: 2,  // optional — improves speaker diarization
  },
});
const jobId = createResult.data.id;
const estimatedSeconds = createResult.data.estimatedTime ?? 120;
const deadline = Date.now() + estimatedSeconds * 2 * 1000;
console.log(`Job ${jobId} submitted. Estimated: ${estimatedSeconds}s`);

// Step 2: Poll until complete
let status = 'PENDING';
while (status !== 'COMPLETED' && status !== 'FAILED') {
  if (Date.now() > deadline) throw new Error(`Job ${jobId} timed out after ${estimatedSeconds * 2}s`);
  await new Promise(r => setTimeout(r, 15_000));
  const statusResult = await actions.executeTool({
    toolName: 'diarize_get_job_status',
    connectedAccountId: connectedAccount.id,
    toolInput: { job_id: jobId },
  });
  status = statusResult.data.status;
  console.log('Status:', status);
}
if (status === 'FAILED') throw new Error(`Job ${jobId} failed`);

// Step 3: Download the diarized transcript
const transcriptResult = await actions.executeTool({
  toolName: 'diarize_download_transcript',
  connectedAccountId: connectedAccount.id,
  toolInput: { job_id: jobId, format: 'json' },
});
// handle the transcriptResult
```

> note: Polling guidance
>
> The `estimatedTime` field (in seconds) tells you how long processing is expected to take. For a 49-minute episode, `estimatedTime` may be around 891 seconds (~15 minutes). Wait at least that long before treating the job as timed out.

## Scalekit tools

## Tool list

Use the exact tool names from the **Tool list** below when you call `execute_tool`. If you're not sure which name to use, list the tools available for the current user first.

## Tool list

### `diarize_create_transcription_job`

Submit a new transcription and diarization job for an audio or video URL (YouTube, X, Instagram, TikTok). Returns a job ID that can be used to check status and download results.

Parameters:

- `url` (`string`, required): The URL of the audio or video content to transcribe (e.g. YouTube, X, Instagram, TikTok link)
- `language` (`string`, optional): Language code for transcription (e.g. 'en', 'es', 'fr'). Defaults to auto-detection if not provided.
- `num_speakers` (`integer`, optional): Expected number of speakers in the audio. Helps improve diarization accuracy.
- `schema_version` (`string`, optional): Optional schema version to use for tool execution
- `tool_version` (`string`, optional): Optional tool version to use for execution

### `diarize_download_transcript`

Download the transcript output for a completed transcription job in JSON, TXT, SRT, or VTT format, including speaker diarization, segments, and word-level timestamps.

Parameters:

- `job_id` (`string`, required): The unique ID of the completed transcription job
- `format` (`string`, optional): Output format for the transcript. Supported formats: 'json', 'txt', 'srt', 'vtt'.
- `schema_version` (`string`, optional): Optional schema version to use for tool execution
- `tool_version` (`string`, optional): Optional tool version to use for execution

### `diarize_get_job_status`

Retrieve the current status of a transcription job by its job ID. Returns job state (pending, processing, completed, failed), metadata, and an estimatedTime field (in seconds) indicating how long processing is expected to take. Use estimatedTime to determine polling frequency and max wait duration — for example, a 49-minute episode may have an estimatedTime of ~891s (~15 mins), so the agent should wait at least that long before giving up.

Parameters:

- `job_id` (`string`, required): The unique ID of the transcription job to check
- `schema_version` (`string`, optional): Optional schema version to use for tool execution
- `tool_version` (`string`, optional): Optional tool version to use for execution


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
