---
updatedAt: 2026-09-23T09:21:44.000Z
agentTools:
  projectIndex: https://docs.socket.dev/llms.txt
---

# socket login

Socket API login

If you have a Socket.dev API token you can use `socket login` to store the token in a file such that it will automatically use that token when you run commands.

`socket login` asks for your [API token](https://docs.socket.dev/docs/api-keys). Leave it blank to use Socket's limited public token. It then:

* verifies the token and sets the first organization it has access to as your default org
* asks whether Socket should enforce your enterprise organization's security policies system-wide, if the token has access to one
* offers to install bash tab completion, which adds a loader line to `~/.bashrc`
* saves the token, along with `--api-base-url` and `--api-proxy` if you passed them

The settings are saved in a `config.json` file in Socket's settings folder:

* macOS: `~/Library/Application Support/socket/settings`
* Linux: `~/.local/share/socket/settings`
* Windows: `%LOCALAPPDATA%\socket\settings`

On macOS and Linux, `$XDG_DATA_HOME/socket/settings` is used when `XDG_DATA_HOME` is set.

`socket login` needs an interactive terminal. In CI, set the `SOCKET_CLI_API_TOKEN` environment variable instead. If the config is overridden with `--config` or `SOCKET_CLI_CONFIG`, the login is not saved.

## socket login --help

```
$ socket login --help

  Setup Socket CLI with an API token and defaults

  Usage
    $ socket login [options]

  API Token Requirements
    - Quota: 1 unit

  Logs into the Socket API by prompting for an API token

  Options
    --api-base-url      API server to connect to for login
    --api-proxy         Proxy to use when making connection to API server

  Examples
    $ socket login
    $ socket login --api-proxy=http://localhost:1234
```