Base16 Decoder API Documentation¶
Overview¶
The Base16 Decoder API decodes a Base16 (hexadecimal) encoded string into UTF-8 text.
It supports three input modes:
- Body Mode (synchronous decoding)
- URL Mode (asynchronous job creation for remote files)
- File Mode (asynchronous job creation for uploaded files)
The decoded output is returned as a downloadable .txt file with a UTF-8 preview.
Endpoint (POST)¶
POST https://api.apidatatools.com/base16-decoder-api
Headers¶
| Header | Description | Required | Example |
|---|---|---|---|
Content-Type | Specifies request content type | Yes | application/json |
x-source-type | Input source type: body, url, or file | Optional (default: body) | x-source-type: body |
x-api-key | Your API key for authentication | Yes | abcd1234xyz |
Accepted File Extensions¶
For URL or File mode, the following extensions are supported:
.txt, .log
Input Example (Body Mode)¶
48656C6C6F20576F726C64
Input Example (URL Mode)¶
{
"url": "https://example.com/sample_hex.txt"
}
Input Example (File Mode)¶
{
"file": "user_uploads/sample_hex.txt"
}
Example Request¶
Synchronous (Body Input)¶
curl -X POST "https://api.apidatatools.com/base16-decoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: body" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"content": "48656C6C6F20576F726C64"}'
Asynchronous (Remote File URL)¶
curl -X POST "https://api.apidatatools.com/base16-decoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: url" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"url": "https://example.com/sample_hex.txt"}'
Asynchronous (Input File)¶
curl -X POST "https://api.apidatatools.com/base16-decoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: file" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"file": "user_uploads/sample_hex.txt"}'
Example Response¶
Successful (Body Mode)¶
{
"status": "success",
"request_id": "b1e2d3f4-5678-90ab-cdef-1234567890ab",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
"preview": "Hello World"
}
Async Job Accepted¶
{
"status": "accepted",
"job_id": "job_1234567890abcdef",
"status_url": "https://api.apidatatools.com/jobs/job_1234567890abcdef",
"request_id": "b1e2d3f4-5678-90ab-cdef-1234567890ab"
}
Error Handling¶
| Error Code | HTTP Status | Description | Example |
|---|---|---|---|
BASE16_DECODING_FAILED | 400 | Invalid or empty Base16 input | {"status":"error","error":"BASE16_DECODING_FAILED","details":{"message":"Failed to decode Base16."}} |
EMPTY_BODY | 400 | Request body is empty | {"status":"error","error":"EMPTY_BODY","details":{"message":"Request body is empty."}} |
INVALID_BODY_ENCODING | 400 | Failed to decode base64 body | {"status":"error","error":"INVALID_BODY_ENCODING","details":{"message":"Failed to base64-decode request body."}} |
INVALID_URL | 400 | Invalid or missing URL in URL mode | {"status":"error","error":"INVALID_URL","details":{"message":"Missing or invalid 'url'."}} |
URL_UNREACHABLE | 400 | Remote URL cannot be reached | {"status":"error","error":"URL_UNREACHABLE","details":{"message":"Could not reach URL."}} |
URL_NOT_OK | 400 | Remote URL returned non-200 status | {"status":"error","error":"URL_NOT_OK","details":{"message":"URL returned HTTP 404, expected 200."}} |
INVALID_FILE | 400 | Missing or invalid file path | {"status":"error","error":"INVALID_FILE","details":{"message":"Missing or invalid 'file'."}} |
INVALID_FILE_EXTENSION | 400 | Unsupported file extension | {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension."}} |
FILE_TOO_LARGE | 413 | File exceeds plan limit | {"status":"error","error":"FILE_TOO_LARGE","details":{"message":"File exceeds plan limit."}} |
PAYLOAD_TOO_LARGE | 413 | Body exceeds plan limit | {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit."}} |
UNKNOWN_FUNCTION | 404 | Invalid API endpoint | {"status":"error","error":"UNKNOWN_FUNCTION","details":{"message":"Unsupported API endpoint."}} |
INTERNAL_ERROR | 500 | Unexpected internal error | {"status":"error","error":"INTERNAL_ERROR","details":{"message":"Failed to process your request"}} |
Async Job Status¶
To check the status of an asynchronous job (URL or File mode):
Endpoint¶
GET https://api.apidatatools.com/jobs/{job_id}
Example Status Response for Async¶
Queued¶
{
"job_id": "job_1234567890abcdef",
"status": "queued",
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
{
"job_id": "job_1234567890abcdef",
"status": "success",
"created_at": 1712345678,
"updated_at": 1712345689,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
"request_id": "b1e2d3f4-5678-90ab-cdef-1234567890ab",
"preview": "Hello World"
}
}
Failed¶
{
"job_id": "job_1234567890abcdef",
"status": "failed",
"error": {
"code": "BASE16_DECODING_FAILED",
"message": "Failed to decode Base16.",
"details": {"message": "Invalid hex input."}
}
}
Notes for Developers¶
- The API supports synchronous decoding for direct body input and asynchronous processing for remote or uploaded files.
- Each response includes a unique
request_idfor tracking. - For asynchronous operations, use the
status_urlto poll job progress. - Output files are stored securely and expire based on the user’s plan retention policy.
- Ensure that input data is valid hexadecimal text; invalid or empty strings will trigger decoding errors.
- The preview field contains the first 100 KB of decoded text for quick inspection.