GET
/v1/bytes
QuBitLang
Returns raw random bytes encoded as hexadecimal or Base64. Ideal for cryptographic key material, seeds, nonces, and any application requiring raw entropy.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| count | integer | No | 16 | Number of bytes to generate (1–1,024) |
| encoding | string | No | hex | Output encoding: hex or base64 |
Code Examples
bytes.py
from trueentropy import TrueEntropy
client = TrueEntropy(api_key="te_live_YOUR_KEY")
result = client.bytes(
count=32,
encoding="hex"
)
print(result.bytes)
# "a7f2b9c4d8e1f3a5b7c9d2e4f6a8b0c2d4e6f8a0b2c4d6e8f0a1b3c5d7e9f1"
print(result.metadata.qubitlang_circuit)
# "qrng_hadamard_v2.3"
bytes.js
import { TrueEntropy } from '@trueentropy/sdk';
const client = new TrueEntropy('te_live_YOUR_KEY');
const result = await client.bytes({
count: 32,
encoding: 'hex'
});
console.log(result.data.bytes);
// "a7f2b9c4d8e1f3a5b7c9d2e4f6a8b0c2..."
bytes.php
use TrueEntropy\Client;
$client = new Client('te_live_YOUR_KEY');
$result = $client->bytes([
'count' => 32,
'encoding' => 'hex',
]);
echo $result->bytes;
// "a7f2b9c4d8e1f3a5b7c9d2e4f6a8b0c2..."
Terminal
curl https://api.trueentropy.net/v1/bytes \
-H "Authorization: Bearer te_live_YOUR_KEY" \
-G -d "count=32&encoding=hex"
Response
200 OK
JSON
{
"data": {
"bytes": "a7f2b9c4d8e1f3a5b7c9d2e4f6a8b0c2",
"count": 16,
"encoding": "hex",
"bits": 128
},
"metadata": {
"request_id": "req_b2c3d4e5f6a7",
"timestamp": "2026-03-09T15:42:17Z",
"qubitlang_circuit": "qrng_hadamard_v2.3",
"qubitlang_version": "1.4.0",
"quantum_backend": "ibm_fez",
"nist_verified": true,
"certificate_id": "cert_b2c3d4e5f6a7",
"powered_by": "QuBitLang"
}
}
Response Headers
X-QuBitLang-Circuit: qrng_hadamard_v2.3
X-QuBitLang-Version: 1.4.0
X-Quantum-Backend: ibm_fez
X-NIST-Verified: true
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1741536180
Errors
| Status | Code | Description |
|---|---|---|
| 400 | invalid_count | count must be between 1 and 1,024 |
| 400 | invalid_encoding | encoding must be hex or base64 |
| 401 | auth_missing | No API key provided |
| 401 | auth_invalid | API key is invalid or revoked |
| 429 | rate_limited | Rate limit exceeded |