This documentation is actively being improved. You may encounter gaps or incomplete sections as we refine and expand the content. We appreciate your understanding and welcome any feedback to help us make this resource even better!

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.

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.

mkdir fonoster-apikeys-demo
cd fonoster-apikeys-demo
npm init -y
2

Install the SDK

Install the @fonoster/sdk package.

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:

const SDK = require("@fonoster/sdk");

// Replace these with your values
const client = new SDK.Client({ 
  accessKeyId: "WO00000000000000000000000000000000",
  endpoint: "localhost:50051",
  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.

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.