# Session Token

Access Token lets you transact and **fetch details** from a particular user account.\
To generate an Access token, you must **pass the API Key, Request Token, and API secret**. to create an Access token.

**Endpoint**

{% code title="Base URL" overflow="wrap" fullWidth="false" %}

```
https://connects.torusdigital.com/api/v1/session/generate
```

{% endcode %}

#### Header Parameters <a href="#header-parameters" id="header-parameters"></a>

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| `Token`      | `<Token>`          |

#### Request Parameters <a href="#header-parameters" id="header-parameters"></a>

<table><thead><tr><th width="232">ATTRIBUTE</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td>API_SECRET</td><td>The apiSecret generated during Merchant Onboarding step for the specific merchant</td></tr><tr><td>API_KEY</td><td>The apiKey generated during Merchant Onboarding step for the specific merchant</td></tr></tbody></table>

#### **Request**

{% tabs %}
{% tab title="curl" %}
{% code title="cURL" overflow="wrap" fullWidth="true" %}

```javascript
curl --location 'https://connects.torusdigital.com/api/v1/session/generate' \
--header 'Token: {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "API_KEY": "<API_KEY>",
    "API_SECRET": "<API_SECRET>"
}'
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code title="Java-Unirest" fullWidth="false" %}

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connects.torusdigital.com/api/v1/session/generate")
  .header("Token", "{{token}}")
  .header("Content-Type", "application/json")
  .body("{\n" +
        "    \"API_KEY\": \"<API_KEY>\",\n" +
        "    \"API_SECRET\": \"<API_SECRET>\"\n" +
        "}")
  .asString();
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code title="Go-Native" overflow="wrap" fullWidth="false" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://connects.torusdigital.com/api/v1/session/generate"
  method := "POST"

  payload := strings.NewReader(`{
    "API_KEY": "<API_KEY>",
    "API_SECRET": "<API_SECRET>"
  }`)

  client := &http.Client{}
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Token", "{{token}}")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="JavaScript-JQuery" overflow="wrap" %}

```javascript
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/session/generate",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Token": "{{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "API_KEY": "<API_KEY>",
    "API_SECRET": "<API_SECRET>"
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" fullWidth="false" %}

```json
{
    "AccessToken": "<AccessToken>",
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://heytorus.gitbook.io/authentication/session-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
