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

# Why does my API key fail with 'must be 40 characters long'?

Forge now issues longer API keys (about 86 characters). Older `wandb` SDK versions validate exactly 40 characters and reject the new format:

`ValueError: API key must be 40 characters long, yours was 86`

On [Dedicated Cloud](https://docs.coreweave.com/products/wandb/platform/hosting/hosting-options/dedicated-cloud.md) or [Self-Managed](https://docs.coreweave.com/products/wandb/platform/hosting/hosting-options/self-managed.md) instances, the message may instead be `ERROR API key must be 40 characters long, yours was 86`.

## Upgrade the wandb SDK

Support for longer API keys was added in `wandb` v0.22.3, so upgrading to that version or later resolves the error:

```bash theme={"system"}
pip install -U wandb
wandb login --relogin
```

## If you cannot upgrade the SDK

* If a legacy 40-character key is still active on your account, keep using it. New-format keys do not automatically revoke legacy keys.
* If you deleted the legacy key and cannot upgrade, contact [forge-support@coreweave.com](mailto:forge-support@coreweave.com). [Dedicated Cloud](https://docs.coreweave.com/products/wandb/platform/hosting/hosting-options/dedicated-cloud.md) and [Self-Managed](https://docs.coreweave.com/products/wandb/platform/hosting/hosting-options/self-managed.md) deployments might be able to issue a legacy-format key.
* As a workaround, set `WANDB_API_KEY` in the environment instead of using `wandb login`. Some older SDK versions skip local length checks. Replace `[API-KEY]` with your CoreWeave Forge API key:

  ```bash theme={"system"}
  export WANDB_API_KEY=[API-KEY]
  ```

## Different error: key reported as too short

`API key must have 40+ characters, has 20` can appear when calling `wandb.Api().viewer.generate_api_key()` in certain SDK versions. This is separate from the longer-key format migration. Upgrade the SDK. If the error persists after upgrading, contact [forge-support@coreweave.com](mailto:forge-support@coreweave.com).

For more information, see [How do I find my API key?](https://docs.coreweave.com/support/models/articles/how-do-i-find-my-api-key) and [SDK release notes](https://docs.coreweave.com/release-notes/sdk-releases.md).

***

[API Keys](https://docs.coreweave.com/support/models/tags/api-keys.md)[Authentication](https://docs.coreweave.com/support/models/tags/authentication.md)[SDK](https://docs.coreweave.com/support/models/tags/sdk.md)
