> For the complete documentation index, see [llms.txt](https://docs.nosto.com/magento-2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nosto.com/magento-2/guides/console-commands.md).

# Console Commands

It is possible to use a console command to reconnect or remove the account. This process can be handy when your deployments are automated. From `7.6.0` it is also possible to clear Nosto message queues with a console command. This might be helpful in debugging.

![3.0.0](https://img.shields.io/badge/nosto-3.0.0-green.svg)

### Getting tokens from the Nosto Admin Panel.

Log-in into [Nosto Admin](https://my.nosto.com) with your already existing account, select the store you want to reconnect and head to `Settings -> Authentication Tokens`.\
To obtain the tokens, just hit the decrypt button. ![cropper](https://user-images.githubusercontent.com/2778820/44570846-cf96f300-a787-11e8-952e-0fc1950ea77e.png)

### Getting Store View Scope Code From Magento's Backend

Since you need a different Nosto account for each store view, you need to get the store scope code. You can find in: `Stores -> All stores`

![image](https://user-images.githubusercontent.com/2778820/44571925-f73b8a80-a78a-11e8-996c-6d0dbb998459.png)

Click on your store view:

![stores\_\_\_settings\_\_\_stores\_\_\_magento\_admin](https://user-images.githubusercontent.com/2778820/44571988-26ea9280-a78b-11e8-8e68-07f0de17eb07.png)

Copy the value from de `code` field

![stores\_\_\_default\_store\_view\_\_\_settings\_\_\_stores\_\_\_magento\_admin](https://user-images.githubusercontent.com/2778820/44572053-500b2300-a78b-11e8-993f-d311d233856b.png)

## Using the Console Command to Reconnect Your Existing Nosto Account

### Using the interactive mode

* Open the terminal and head to you Magento installation path directory

  You can run:

  `bin/magento nosto:account:connect` and enter the interactive mode, where you will input the required tokens.

  ![image](https://user-images.githubusercontent.com/2778820/44572711-5d291180-a78d-11e8-99c7-f6468621156a.png)

### Using the non-interactive mode

In order to use this command with non-interactive installation scripts, you can also pass all the parameters via the command line arguments.

You can use the help from the command to figure out all the necessary parameters: ![image](https://user-images.githubusercontent.com/2778820/44572987-1851aa80-a78e-11e8-8690-284a3a222670.png)

#### Example of non-interactive command:

```bash
bin/magento nosto:account:connect \
--account-id=NOSTO_ACCOUNT_NAME \
--sso_token=SSO_TOKEN \
--products_token=PRODUCTS_TOKEN \
--settings_token=SETTINGS_TOKEN \
--rates_token=RATES_TOKEN \
--apps_token=APPS_TOKEN \
--scope-code=STORE_VIEW_SCOPE_CODE --no-interaction
```

![image](https://user-images.githubusercontent.com/2778820/44573107-741c3380-a78e-11e8-909f-19620a62bf51.png)

## Using the Console Command to Remove Nosto account from your store view

This command is used to disconnect an existing account from your store.

### Using the interactive mode

* Open the terminal and head to you Magento installation path directory

  You can run:

  `bin/magento nosto:account:remove` and enter the interactive mode, where you will input the store view scope code.

  ![image](https://user-images.githubusercontent.com/44775916/49924280-8a293d80-febe-11e8-8230-bf816efc1784.png)

### Using the non-interactive mode

In order to use this command with non-interactive installation scripts, you can also pass the parameter via the command line arguments.

#### Example of non-interactive command:

```bash
bin/magento nosto:account:remove \
--scope-code=STORE_VIEW_SCOPE_CODE --no-interaction
```

![image](https://user-images.githubusercontent.com/44775916/49924701-9a8de800-febf-11e8-8789-6ab37d4a8f6c.png)

## Using the Console To Clear Messages on RabbitMQ

* Open the terminal in your Magento root directory and run

  `bin/magento nosto:clear:message-queue`

![image](/files/LpPcFiUWJLtrZDbp8JXg)

This will clear all messages on both update and delete queues.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.nosto.com/magento-2/guides/console-commands.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
