createThirdwebClient

Creates a Thirdweb client using the provided client ID (client-side) or secret key (server-side).

Get your client ID and secret key from the Thirdweb dashboard here . **Never share your secret key with anyone.

A client is necessary for most functions in the thirdweb SDK. It provides access to thirdweb APIs including built-in RPC, storage, and more.

Example

Create a client on the client side (client ID):

import { createThirdwebClient } from "thirdweb";
const client = createThirdwebClient({ clientId: "..." });

Create a client on the server (secret key):

import { createThirdwebClient } from "thirdweb";
const client = createThirdwebClient({ secretKey: "..." });
function createThirdwebClient(

Parameters

The options for creating the client.

Type

let options: Prettify<
(
| { clientId: string; secretKey?: never }
| { clientId?: never; secretKey: string }
) &
ClientOptions
>;

Returns

let returnType: {
readonly clientId: string;
readonly secretKey: string | undefined;
} & Readonly<ClientOptions>;

The created Thirdweb client.