> For the complete documentation index, see [llms.txt](https://docs.volven.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.volven.io/api/volven-api/authentication.md).

# Authentication

In order to authenticate use following endpoint, passing your Volven/TYR Markets user name (which is your email) and password:

```http
POST /httpserver/main/v2/auth/login
{
    "username": "<email>",  
    "password": "<password>"
}
```

If you have 2FA enabled you will get following response:

```http
200 OK
{
    "awsUsername": "9205eec4-8b36-48a4-aa6c-a73e8ce01684",
    "session": "AYABeK9med7n...Z7oBVQAjVJEZ0k",
    "challengeName": "SOFTWARE_TOKEN_MFA",
    "status": "CHALLENGE_REQUIRED"
}
```

In that case you have to provide OTP (one time password) from your configured authenticator app.\
Send it in `challengeAnswer` field along with `awsUsername` and `session` from previous authentication response:

```http
POST /httpserver/main/v2/auth/login
{
    "awsUsername": "9205eec4-8b36-48a4-aa6c-a73e8ce01684",
    "session": "AYABeK9med7n...Z7oBVQAjVJEZ0k",
    "challengeName": "SOFTWARE_TOKEN_MFA",
    "status": "CHALLENGE_REQUIRED",
    "challengeAnswer": "898165"
}
```

Once you are successfully authenticated (with or without 2FA enabled) you will get following response:

```http
200 OK
Authorization: Bearer eyJraWQiOiJWQmd...8yeUJmCX2JXxyJBzHA
{
    "refreshToken": "eyJjdHkiOiJKV1Qi...ULGaonedpIyv86GNpg",
    "expirationTime": 3600,
    "isAppConnected": false
}
```

Now you need to use the token received in `Authorization` header from the response above to authorize all business API request. You simply pass this token in `Authorization` header when performing every HTTP request or initiating WebSocket connection.&#x20;

The token is valid for `expirationTime` number of seconds, which in this case is 1 hour. If you want to use API in continuous manner but authorize only once then use `refreshToken` from the response above. Perform following call periodically before your session expires (for instance 5 minutes before expiration time):

```http
POST /httpserver/main/v2/auth/login
{
    "refreshToken": "eyJjdHkiOiJKV1Qi...ULGaonedpIyv86GNpg"
}
```

You should receive following response meaning that your session has been prolonged and will expire at `expirationTime` (Unix timestamp). You need to replace your existing token with a new one from `Authorization` header from the response below:

```http
200 OK
Authorization: Bearer eyJraWQiOiJWQmd...nFmxU4PiUIV38iEbZA
{
    "expirationTime": 1758546865
}
```


---

# 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.volven.io/api/volven-api/authentication.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.
