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

# login

> TypeScript SDK reference

# login

▸ **login**(`apiKey`, `host?`): `Promise`\<`void`>

Log in to Weights & Biases (W\&B) using the provided API key.
This function attempts to save the credentials to your netrc file for future use,
but will continue even if it cannot write to the file system.

#### Parameters

| Name     | Type     | Description                                                                          |
| :------- | :------- | :----------------------------------------------------------------------------------- |
| `apiKey` | `string` | Your W\&B API key.                                                                   |
| `host?`  | `string` | (Optional) The host name (usually only needed if you're using a custom W\&B server). |

#### Returns

`Promise`\<`void`>

`Throws`

If the API key is not specified or if the connection to the weave trace server cannot be verified.

#### Defined in

[clientApi.ts:30](https://github.com/wandb/weave/blob/6538626556c93d6f31ae725fdefe4e6b8b71bc2c/sdks/node/src/clientApi.ts#L30)

***
