API keys
Secura supports signed API-key requests alongside Bearer JWT authentication. Create and revoke keys in account settings. Keep the secret key on a trusted server; each signed request needs it.
Manage keys
POST /v1/user/api-key/generatewith JSON body{ "validUntil": "2027-12-31T23:59:59Z" }creates a key. The expiry must be in the future. Missing or null values are rejected. Only one active key is allowed per account. The response containsapiKey,secretKeyandvalidUntil.GET /v1/user/api-keys/mylists your keys withid,publicApiKeyandvalidUntil.POST /v1/user/api-key/revoke-by-userwith body{ "publicApiKey": "KP-..." }revokes your key.
These requests require authentication. Save the returned secret when creating the key; the list endpoint does not return it.
Sign a request
Send X-Api-Key, X-Signature, X-Timestamp and X-Nonce. The signature is Base64-encoded HMAC-SHA256, using the UTF-8 bytes of the returned secret string as the key.
Sign the exact payload below with newline separators and no trailing newline. The path includes the query string exactly as sent. For requests without a body, the final field is empty. For JSON, sign the same serialized body you send. Timestamps use Unix seconds; nonces must be unique and server time tolerance applies.
{timestamp}
{nonce}
{HTTP_METHOD}
{path_and_query}
{raw_request_body}
import { createHmac, randomUUID } from 'node:crypto'
const baseUrl = 'https://api.secura.finance'
const apiKey = process.env.SECURA_API_KEY
const secret = process.env.SECURA_API_SECRET
const method = 'GET'
const pathAndQuery = '/v1/user/information/my'
const body = ''
const timestamp = Math.floor(Date.now() / 1000).toString()
const nonce = randomUUID()
const payload = `${timestamp}\n${nonce}\n${method}\n${pathAndQuery}\n${body}`
const signature = createHmac('sha256', secret).update(payload, 'utf8').digest('base64')
const response = await fetch(`${baseUrl}${pathAndQuery}`, {
method,
headers: {
'X-Api-Key': apiKey,
'X-Signature': signature,
'X-Timestamp': timestamp,
'X-Nonce': nonce,
},
})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
console.log(await response.json())