Skip to main content
The SDK authenticates every request with a bearer API key. You construct a YoukaClient once and reuse it for the lifetime of your process.

new YoukaClient(options)

import { YoukaClient } from "@youka/sdk";

const client = new YoukaClient({
  apiKey: process.env.YOUKA_API_KEY!,
});

Options

apiKey
string
required
Your Youka API key. Create one at online.youka.io/account under API keys.
fetch
typeof fetch
Custom fetch implementation. Defaults to the global fetch. Use this to inject logging, proxies, or custom retry middleware.

Storing the API key

API keys grant access to your billing. Never commit them to source control.
Recommended patterns:
const client = new YoukaClient({
  apiKey: process.env.YOUKA_API_KEY!,
});

Injecting a custom fetch

Every SDK method uses the fetch you pass to the constructor. This makes it easy to add logging or middleware:
import { YoukaClient } from "@youka/sdk";

const instrumentedFetch: typeof fetch = async (input, init) => {
  const start = Date.now();
  const response = await fetch(input, init);
  console.log(
    `${init?.method ?? "GET"} ${input} ${response.status} in ${Date.now() - start}ms`,
  );
  return response;
};

const client = new YoukaClient({
  apiKey: process.env.YOUKA_API_KEY!,
  fetch: instrumentedFetch,
});

Per-request options

Every method accepts an optional second or third argument with request-level options:
await client.projects.create(body, {
  idempotencyKey: "import-2026-04-08-song-001",
  signal: abortController.signal,
});
idempotencyKey
string
Passed as the Idempotency-Key header. Reusing the same key with the same payload returns the original result instead of creating a duplicate. See API idempotency.
signal
AbortSignal
Standard abort signal. Cancels in-flight requests and long-running client.tasks.wait(...), client.projects.wait(...), and client.exports.wait(...) polls.

What’s next