Base64 Decoder API Documentation¶
Overview¶
The Base64 Decoder API decodes a Base64-encoded string into plain UTF-8 text.
It supports three input modes:
- Body Mode – Directly send Base64 text in the request body.
- URL Mode – Provide a remote file URL containing Base64 text (processed asynchronously).
- File Mode – Provide a previously uploaded file reference (processed asynchronously).
The decoded output is returned as a downloadable .txt file with a UTF-8 preview.
Endpoint (POST)¶
POST https://api.apidatatools.com/base64-decoder-api
Headers¶
| Header | Type | Required | Description |
|---|---|---|---|
Content-Type | application/json | Yes | Must be application/json for body mode. |
x-api-key | string | Yes | Your API key for authentication. |
x-source-type | string | Optional | Defines input mode: body (default), url, or file. |
Accepted File Extensions¶
| Mode | Allowed Extensions |
|---|---|
| URL/File | .txt, .log |
Input Example (Body Mode)¶
SGVsbG8gV29ybGQh
Input Example (URL Mode)¶
{
"url": "https://example.com/sample_base64.txt"
}
Input Example (File Mode)¶
{
"file": "user123/uploads/upl_abc123/sample_base64.txt"
}
Example Request¶
Synchronous (Body Input)¶
curl -X POST "https://api.apidatatools.com/base64-decoder-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "U29tZSBkYXRhIHRvIGRlY29kZQ=="}'
Asynchronous (Remote File URL)¶
curl -X POST "https://api.apidatatools.com/base64-decoder-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/data/sample_base64.txt"}'
Asynchronous (Input File)¶
curl -X POST "https://api.apidatatools.com/base64-decoder-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: file" \
-H "Content-Type: application/json" \
-d '{"file": "user123/uploads/upl_abc123/sample_base64.txt"}'
Example Response¶
Successful (Body Mode)¶
{
"status": "success",
"request_id": "b7a2e8f0-1234-4c9a-9f2e-abc123456789",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abcdef1234567890.txt",
"preview": "Some data to decode..."
}
Async Job Accepted¶
{
"status": "accepted",
"job_id": "job_1234567890abcdef",
"status_url": "https://api.apidatatools.com/jobs/job_1234567890abcdef",
"request_id": "b7a2e8f0-1234-4c9a-9f2e-abc123456789"
}
Error Handling¶
| Error Code | HTTP Status | Description | Example |
|---|---|---|---|
BASE64_DECODING_FAILED | 400 | Input could not be decoded or is empty. | {"status":"error","error":"BASE64_DECODING_FAILED","details":{"message":"Empty input cannot be decoded."}} |
INVALID_BODY | 400 | Invalid JSON body. | {"status":"error","error":"INVALID_BODY","details":{"message":"Body must be valid JSON."}} |
INVALID_URL | 400 | URL missing or invalid. | {"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 | URL returned non-200 HTTP response. | {"status":"error","error":"URL_NOT_OK","details":{"message":"URL returned HTTP 404, expected 200."}} |
FILE_TOO_LARGE | 413 | File exceeds plan limit. | {"status":"error","error":"FILE_TOO_LARGE","details":{"message":"Remote file exceeds plan limit."}} |
INVALID_FILE_EXTENSION | 400 | File extension not allowed. | {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Extension '.exe' is not allowed."}} |
INVALID_FILE | 400 | File reference missing or invalid. | {"status":"error","error":"INVALID_FILE","details":{"message":"Missing or invalid 'file'."}} |
FILE_UNAVAILABLE | 400 | File not found in storage. | {"status":"error","error":"FILE_UNAVAILABLE","details":{"message":"Could not access file."}} |
PAYLOAD_TOO_LARGE | 413 | Request body exceeds plan limit. | {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds 5120KB limit for your plan."}} |
UNKNOWN_FUNCTION | 404 | Endpoint not found. | {"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¶
Endpoint:
GET https://api.apidatatools.com/jobs/{job_id}
Example Status Response for Async¶
Queued¶
{
"job_id": "job_1234567890abcdef",
"status": "queued",
"created_at": 1712345678,
"updated_at": 1712345678,
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
{
"job_id": "job_1234567890abcdef",
"status": "success",
"created_at": 1712345678,
"updated_at": 1712345690,
"result": {
"status": "success",
"request_id": "b7a2e8f0-1234-4c9a-9f2e-abc123456789",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abcdef1234567890.txt",
"preview": "Decoded text preview..."
}
}
Failed¶
{
"job_id": "job_1234567890abcdef",
"status": "failed",
"created_at": 1712345678,
"updated_at": 1712345680,
"error": {
"code": "BASE64_DECODING_FAILED",
"message": "Failed to decode Base64.",
"details": {
"message": "Incorrect padding"
}
}
}
Notes for Developers¶
- The API supports synchronous decoding for small Base64 strings and asynchronous processing for remote or uploaded files.
- All responses include a unique
request_idfor traceability. - For asynchronous jobs, use the returned
status_urlto poll job progress. - Output files are stored temporarily and accessible via the returned download URL.
- Ensure that the input Base64 string is properly formatted and not empty.
- Allowed file extensions for URL/File mode are strictly validated (
.txt,.log). - The preview field in responses is limited to the first 100 KB of decoded text.