---
updatedAt: 2026-08-28T04:17:25.000Z
agentTools:
  projectIndex: https://apidocs.bct.host/llms.txt
---

# REST v5 Authentication

# **Authentication**

OSL's v5 OpenAPI uses **Header + HMAC-SHA512 signature authentication mechanism**

All interface requests need to carry the following four parameters in the HTTP header:

| Header           | Required | Explanation                                                                                                                                                      |
| ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api-expires      | Yes      | Request expiration time (Unix Timestamp, seconds), used to prevent request replay                                                                                |
| api-key          | Yes      | API Key, used to identify the identity of the caller                                                                                                             |
| api-signature    | Yes      | Request signature is used to verify the legitimacy of the request                                                                                                |
| api-account-uuid | No       | Not required. If not filled, the main account under the user will be executed by default. If filled, the corresponding sub-account of the user will be executed. |

## Signature generation rules

Signature algorithm: `HMAC-SHA512`

The signature content is spliced in the following order:&#x20;

`signature_string = METHOD + ENDPOINT + EXPIRES + REQUEST_BODY`&#x20;

<br />

### **Description**

| Field         | Example               |                                                   |
| ------------- | --------------------- | ------------------------------------------------- |
| METHOD        | GET                   | HTTP method, uppercase required                   |
| ENDPOINT      | /api/v1/order?id=1    | Request path (including Query parameter)          |
| EXPIRES       | 1731480000            | Request expiration time (second timestamp)        |
| REQUEST\_BODY | `{"symbol":"BTCUSD"}` | Request body content; GET request is empty string |

Example of splicing: `signature_string = POST/api/v1/order? id = 11731480000 \{"symbol": "BTCUSD"\}`

`decoded_api_secret = Base64.decode(api_secret)`

Generate signature:

```Plain Text
api-signature = Base64(
    HMAC_SHA512(
        signature_string,
        decoded_api_secret
    )
)
```

## Request Limitations

`Api-expires` is recommended to be set to: current time + 15 seconds

Example: `Math.round (Date.now ()/1000 + 15)`

The server level will verify the validity of the time.

* **Current time exceeds&#x20;**`api-expires`   →  Authentication failed

* **Inconsistent signatures**  →  Authentication failed

* **Header missing**  → A uthentication failed