Universal Base64 & Base32 Encoder
This API provides access to encoding and decoding Base64 & Base32 encoding/decoding.
Endpoint
Section titled “Endpoint” POST
/api/v1/encoder Request Parameters
Section titled “Request Parameters”The following parameters are accepted in the request body:
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The string to process. |
type | string | Optional | base64 (default) or base32. |
mode | string | Optional | encode (default) or decode. |
Request Examples
Section titled “Request Examples”Choose your preferred method to interact with the Encoder API:
curl -X POST https://heavstal.com.ng/api/v1/encoder \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"text": "Heavstal Tech", "mode": "encode", "type": "base64"}'const response = await fetch('https://heavstal.com.ng/api/v1/encoder', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ text: 'Heavstal Tech', mode: 'encode' })});
const res = await response.json();console.log(res.data.output);import { tools } from '@heavstal/api';
const encoded = await tools.encoder("Heavstal Tech", "base64", "encode");console.log(encoded.data.output);
// Decoding a fileconst decodedFile = await tools.encoder("/9j/4AAQSkZJRgABAQAAAQABAAD...", "base64", "decode");console.log(decodedFile.data.output); // Returns a URL if it's an image/fileimport requests
url = "https://heavstal.com.ng/api/v1/encoder"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "text": "Heavstal Tech", "mode": "encode", "type": "base64"}
response = requests.post(url, headers=headers, json=payload)print(response.json()["data"]["output"])Response Examples
Section titled “Response Examples”{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "type": "base64", "mode": "encode", "output": "SGVhdnN0YWwgVGVjaA==", "is_file": false }}{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "type": "base64", "mode": "decode", "output": "https://files.catbox.moe/xyz123.jpg", "is_file": true, "file_type": "JPG", "file_size": "450.20 KB" }}{ "status": "error", "error": "Invalid base64 string provided for decoding."}