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

# Sign in with an existing account

> Sign a login request, obtain a JWT, and retrieve your account over HTTPS

Use your existing account credentials to sign in and retrieve account information. You can send these requests with any HTTP client or backend language.

## Before you start

You need your account's exact HTTPS host, username, password, and a reachable HTTPS URL identifying your application. If you have an API key and secret instead, [create your sandbox account and identity](/neuron-api/quickstart) first. See [Get API access](/get-started/api-access) for both access options.

For a sandbox account, use `sandbox.neuro-tech.io`. For another environment, use the host supplied by its operator. An account and its credentials belong to that environment.

## 1. Calculate the login signature

Generate a fresh nonce from at least 32 cryptographically random bytes and encode it as Base64. Use that exact string in both the signed message and the request body.

```text theme={null}
message = userName:host:nonce
signature = Base64(HMAC-SHA256(key=UTF8(accountPassword), data=UTF8(message)))
```

Replace the names with their values, separated by colons with no added whitespace. The host excludes `https://` and paths, and includes the port if it is not the default.

Use standard Base64 for the HMAC digest, not hexadecimal or Base64URL. The HMAC key is the account password. Check your language's implementation against the [authentication test vector](/neuron-api/authentication#hmac-test-vector).

## 2. Sign in

Send this request over HTTPS, replacing the placeholders with your host, username, nonce, and calculated signature:

```http theme={null}
POST /Agent/Account/Login HTTP/1.1
Host: <NEURON_HOST>
Referer: https://your-app.example/
Accept: application/json
Content-Type: application/json

{
  "userName": "<USERNAME>",
  "nonce": "<FRESH_NONCE>",
  "signature": "<CALCULATED_SIGNATURE>",
  "seconds": 3600
}
```

Replace the example `Referer` with your application's URL. Include it on **every Agent API request**, including login and calls from a backend. Login does not require a bearer token.

A successful response contains `jwt` and `expires`. Retain the JWT in your backend session and use the returned expiry when deciding whether to sign in again.

See [Login reference](/neuron-api/api-reference/authentication-and-sessions/login) for the response schema.

## 3. Retrieve your account

Copy the returned `jwt` into the `Authorization` header and send an empty JSON object:

```http theme={null}
POST /Agent/Account/Info HTTP/1.1
Host: <NEURON_HOST>
Referer: https://your-app.example/
Authorization: Bearer <JWT>
Accept: application/json
Content-Type: application/json

{}
```

Success is an account information response for the account you signed in with. Check its identity against the intended username and host before continuing. The [Account information reference](/neuron-api/api-reference/accounts-and-onboarding/info) describes the returned fields.

## Troubleshoot sign-in

| Problem                                      | What to check                                                                                                               |
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Signature rejected                           | Exact username, host, nonce, colon separators, UTF-8 input, and Base64 output. Sign with the account password.              |
| New sandbox account cannot sign in           | Complete [sandbox account enablement](/neuron-api/quickstart#2-enable-the-sandbox-account).                                 |
| Login succeeds but account information fails | Send the returned JWT to the same host, include `Referer`, and check expiry and account access.                             |
| A request fails or times out                 | Inspect the HTTP status using [error handling](/neuron-api/error-handling). Generate a new nonce for another login attempt. |

## Continue building

[Add Neuro to your application](/get-started/first-application), or use your session to [apply for a Legal Identity](/neuron-api/guides/applying-for-a-legal-identity) and [create a contract](/contracts/from-scratch).
