> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-workspaces-notebooks.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started

The following guide will help you get started with W\&B notebooks, from signing up and creating an API key to running your first training experiment.

## Sign up and create an API key

To authenticate your machine with W\&B, you need an API key.

To create an API key, select the **Personal API key** or **Service Account API key** tab for details.

<Tabs>
  <Tab title="Personal API key">
    To create a personal API key owned by your user ID:

    1. Log in to W\&B, then click your user profile icon **> User Settings**.
    2. Click **Create new API key**.
    3. Provide a descriptive name for your API key.
    4. Click **Create**.
    5. Copy the displayed API key immediately and store it securely.
  </Tab>

  <Tab title="Service account API key">
    To create an API key owned by a service account:

    1. In your team or organization settings, go to the **Service Accounts** tab.
    2. Find the service account in the list.
    3. Click the **action (<Icon icon="ellipsis" iconType="solid" />)** menu, then click **Create API key**.
    4. Provide a name for the API key, then click **Create**.
    5. Copy the displayed API key immediately and store it securely.
    6. Click **Done**.

    You can create multiple API keys for a single service account to support different environments or workflows.
  </Tab>
</Tabs>

<Warning>
  W\&B shows the full API key only once, when you create it. After you close the dialog, you cannot view the full API key again. Your settings display only the key ID (the first part of the key). If you lose the full API key, you must create a new one.
</Warning>

For secure storage options, see [Store API keys securely](/platform/app/settings-page/user-settings/#store-and-handle-api-keys-securely).

## Create your first notebook

1. Navigate to your project's workspace.
2. Select **Notebooks** from the project sidebar.
3. Click **Create notebook**.

See the [Create and manage notebooks](/models/notebooks/create-notebook) for more information.

## Run a training experiment

This mock training script logs simulated accuracy and loss metrics to W\&B. Copy and paste the following code into a Python script or notebook cell and run it:

1. Select **Python** to create a new code cell.
2. Copy and paste the following code into the cell:

```python theme={null}
import random
import wandb

PROJECT = "your-project-name"

# Dictionary with hyperparameters
config = {
    'epochs' : 10,
    'lr' : 0.01
}

with wandb.init(project=PROJECT, config=config) as run:
    offset = random.random() / 5
    print(f"lr: {config['lr']}")
    
    # Simulate a training run
    for epoch in range(2, config['epochs']):
        acc = 1 - 2**-config['epochs'] - random.random() / config['epochs'] - offset
        loss = 2**-config['epochs'] + random.random() / config['epochs'] + offset
        print(f"epoch={config['epochs']}, accuracy={acc}, loss={loss}")
        run.log({"accuracy": acc, "loss": loss})
```

3. Press **Command + Enter** on macOS or **Ctrl+Enter** on Windows or Linux. Alternatively, select the play (<Icon icon="circle-play" iconType="solid" />) button next to the cell.

## View your experiment

View the accuracy and loss metrics logged during the training experiment:

1. Select **Workspace** from the project sidebar.
2. Review the runs and visualizations in the workspace. The [runs](/models/runs) list shows each run logged to the project and its details. [Workspace panels](/models/app/features/panels) display visualizations of the metrics logged during each run.

## Save the notebook

Notebooks save automatically by default. You can turn off automatic saving, change how often the notebook saves, and configure other save settings in the [notebook preferences](https://docs.marimo.io/guides/configuration/).

To save the notebook manually, press **Command+S** on macOS or **Ctrl+S** on Windows or Linux. Alternatively, select the save (<Icon icon="floppy-disk" iconType="solid" />) button in the lower-right corner of the notebook.

## Share your notebook

Share your notebook with users outside of W\&B. You can publish it as HTML, create a WebAssembly link, or create a molab notebook.

1. Select **action ( <Icon icon="bars" iconType="solid" /> )** in the upper-right corner of the notebook.
2. Move your cursor to **Share**.
3. From the dropdown menu, select the desired sharing option: **Publish HTML to web**, **Create WebAssembly link**, or **Create molab notebook**.

For more information on sharing your notebook, see the relevant guides below:

* [Export a notebook as WebAssembly HTML](https://docs.marimo.io/guides/exporting/webassembly_html/)
* [Export a notebook as static HTML](https://docs.marimo.io/guides/exporting/static_html/?h=static)
* [Run a notebook in the cloud with molab](https://docs.marimo.io/guides/molab/)
