> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fonoster.com/llms.txt
> Use this file to discover all available pages before exploring further.

# First API Keys

> Initial setup of API keys for a self-hosted instance.

Fonoster uses a Workspace-centric approach, meaning all operations are performed against a specific Workspace. By default, when you self-host Fonoster, it automatically creates a default Workspace along with a default username and password.

```text theme={"system"}
Default accessKeyId: WO00000000000000000000000000000000
Default username: admin@fonoster.local
Default password: changeme
```

You must create API keys to log in to a Workspace and perform operations.

## Create an API Key

**1. Prepare the environment**

First, create a new folder (e.g., fonoster-apikeys-demo) and navigate to it.

```bash theme={"system"}
mkdir fonoster-apikeys-demo
cd fonoster-apikeys-demo
npm init -y
```

**2. Install the SDK**

Install the `@fonoster/sdk` package.

```bash theme={"system"}
npm install @fonoster/sdk
```

**3. Create the script**

Once the installation is complete, create a new file called `index.js` and add the following code:

```javascript theme={"system"}
const SDK = require("@fonoster/sdk");

// Replace these with your values
const client = new SDK.Client({ 
  accessKeyId: "WO00000000000000000000000000000000",
  endpoint: "localhost:8449",
  allowInsecure: true
});

// Use your actual username and password here
client.login("admin@fonoster.local", "changeme").then(async () => {
  const apikeys = new SDK.ApiKeys(client);

  apikeys.createApiKey({
    role: "WORKSPACE_ADMIN",
  }).then((result) => {
    console.log(result);
  });
});
```

**4. Run the script**

Finally, run the script.

```bash theme={"system"}
node index.js
```

If everything goes well, you should see the new API key printed to the console, and you can use it to log in to your Workspace.

> **[SDK](https://www.npmjs.com/package/@fonoster/sdk)**
>
> SDK documentation at NPM.

> **[Command-Line](https://www.npmjs.com/package/@fonoster/ctl)**
>
> Command-line documentation at NPM.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.