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

# Sigrex API

{% hint style="info" %}
This API uses **HMAC or ML-DSA44 authentication**.\
Every request must be signed using your API secret.
{% endhint %}

{% tabs %}
{% tab title="Production" %}
**Base URL**

`https://api.sigrex.io/api/v2`
{% endtab %}
{% endtabs %}

***

#### Getting Started

{% stepper %}
{% step %}

#### Create an account

Create a Sigrex account in the dashboard.
{% endstep %}

{% step %}

#### Generate an API key

Navigate to **API Management** and create a new key.
{% endstep %}

{% step %}

#### Sign your request

All requests must include the following headers:

| Header        | Description                       |
| ------------- | --------------------------------- |
| `api-key`     | Your public API key               |
| `timestamp`   | Current unix timestamp            |
| `signature`   | HMAC SHA256 or ML-DSA44 signature |
| {% endstep %} |                                   |

{% step %}

#### Make your first request

`GET strategy/llm-session`
{% endstep %}
{% endstepper %}

***

#### Signature generation examples

{% hint style="info" %}
Signatures are generated using **HMAC SHA256** or **ML-DSA44** and your API secret.

GET / DELETE requests use:

METHOD + PATH + TIMESTAMP

POST / PUT requests use:

METHOD + PATH + BODY + TIMESTAMP
{% endhint %}

**HMAC SHA256 (GET request)**

```ts
import crypto from "crypto"

const API_KEY = "your_public_api_key"
const API_SECRET = "your_private_api_secret"

const method = "GET"
const path = "/api/v2/strategy/llm-session"
const timestamp = Math.floor(Date.now() / 1000).toString()

const message = method + path + timestamp

const signature = crypto
  .createHmac("sha256", API_SECRET)
  .update(message)
  .digest("hex")

```

**ML-DSA44 (GET request)**

```ts
import { createMLDSA44 } from "@oqs/liboqs-js"

const API_KEY = "your_public_api_key"
const PRIVATE_KEY_B64 = "your_private_key_base64"

const method = "GET"
const path = "/api/v2/strategy/llm-session"
const timestamp = Math.floor(Date.now() / 1000).toString()

const message = new TextEncoder().encode(
  method + path + timestamp
)

const sig = await createMLDSA44()

const signature = sig.sign(
  message,
  Uint8Array.from(Buffer.from(PRIVATE_KEY_B64, "base64"))
)

const signatureB64 = Buffer.from(signature).toString("base64")

sig.destroy()

```

**HMAC SHA256 (POST request)**

```ts
import crypto from "crypto"

const API_KEY = "your_public_api_key"
const API_SECRET = "your_private_api_secret"

const method = "POST"
const path = "/api/v2/strategy/llm-session"

const body = {
  name: "My Strategy",
  cron_interval: "15M"
}

const timestamp = Math.floor(Date.now() / 1000).toString()

const payload =
   method + path + JSON.stringify(body) + timestamp

const signature = crypto
  .createHmac("sha256", API_SECRET)
  .update(payload)
  .digest("hex")
  
```

**ML-DSA44 (POST request)**

```ts
import { createMLDSA44 } from "@oqs/liboqs-js"

const API_KEY = "your_public_api_key"
const PRIVATE_KEY_B64 = "your_private_key_base64"

const method = "POST"
const path = "/api/v2/strategy/llm-session"

const body = {
  name: "My Strategy",
  cron_interval: "15M"
}

const timestamp = Math.floor(Date.now() / 1000).toString()

const payload =
  method + path + JSON.stringify(body) + timestamp

const message = new TextEncoder().encode(payload)

const sig = await createMLDSA44()

const signature = sig.sign(
  message,
  Uint8Array.from(Buffer.from(PRIVATE_KEY_B64, "base64"))
)

const signatureB64 = Buffer.from(signature).toString("base64")

sig.destroy()
  
```

***

#### Example request

```bash
curl https://api.sigrex.io/api/v2/strategy/sessions \
  -H "api-key: YOUR_API_KEY" \
  -H "timestamp: 1700000000" \
  -H "signature: GENERATED_SIGNATURE"
```

{% hint style="warning" %}
Never expose your **API secret** in frontend code.\
Always generate signatures on your backend.
{% endhint %}


---

# 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.sigrex.io/api-reference/reference/sigrex-api.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.
