> 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 %}

***

#### TypeScript SDK

{% hint style="success" %}
An official **TypeScript client library** is available.

[@sigrex/client](https://github.com/sigrexio/sigrex-client-ts)
{% endhint %}

***

#### 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

{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sigrex.io/api-reference/reference/sigrex-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
