Base64 Decoder API¶
Overview¶
Decode Base64 text into a downloadable file. The endpoint supports synchronous body input and asynchronous URL or pre-uploaded-file input.
For body mode, send the Base64 text as the raw request body. The decoder ignores spaces, tabs, carriage returns, and line feeds; other invalid Base64 input can fail decoding.
Endpoint¶
POST https://api.apidatatools.com/base64-decoder-api
Authentication¶
Include your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Input modes¶
| Mode | Behavior |
|---|---|
body | Synchronous. Decodes raw Base64 text from the request body. This is the default mode. |
url | Asynchronous. Fetches and decodes a file from a URL. |
file | Asynchronous. Decodes a pre-uploaded file referenced by its storage key. |
Headers¶
Header names are case-insensitive. The spellings below are lowercase.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | string | Yes | Your API key | Authenticates the request. |
x-source-type | string | No | body; body, url, or file | Selects the input mode. |
x-record-path | string | No | Not established for this endpoint | Listed in endpoint metadata, but no Base64-decoder-specific behavior is established by the supplied source. |
x-root-name | string | No | Not established for this endpoint | Listed in endpoint metadata, but no Base64-decoder-specific behavior is established by the supplied source. |
x-tab-space | string | No | Not established for this endpoint | Listed in endpoint metadata, but no Base64-decoder-specific behavior is established by the supplied source. |
Accepted file extensions¶
For URL and file modes, the accepted extensions are .txt and .log.
Request body¶
Body mode¶
Send raw Base64 text as the request body. Do not wrap it in JSON.
URL mode¶
Send a JSON object with a url field:
{
"url": "https://example.com/input.txt"
}
File mode¶
Send a JSON object with a file field containing the exact storage key returned by the upload workflow:
{
"file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}
Do not add a storage-key prefix.
curl examples¶
Body mode¶
curl --request POST \
'https://api.apidatatools.com/base64-decoder-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: body' \
--data-raw 'SGVsbG8sIHdvcmxkIQ=='
URL mode¶
curl --request POST \
'https://api.apidatatools.com/base64-decoder-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: url' \
--data-raw '{"url":"https://example.com/input.txt"}'
File mode¶
curl --request POST \
'https://api.apidatatools.com/base64-decoder-api' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: file' \
--data-raw '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous body mode¶
A successful body-mode response has HTTP 200 and returns a downloadable file:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "Decoded output preview"
}
The preview is a preview of the output; it is not necessarily the complete decoded content.
Asynchronous URL and file modes¶
A successfully accepted asynchronous request returns HTTP 202:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Async job status¶
Poll the status URL with an authenticated GET request:
GET https://api.apidatatools.com/jobs/{job_id}
Include x-api-key on the request. For example:
curl --request GET \
'https://api.apidatatools.com/jobs/JOB_ID' \
--header 'x-api-key: YOUR_API_KEY'
The status response includes request_id, job_id, status, created_at, and updated_at.
Queued or processing¶
For either queued or processing, the response includes:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 0,
"updated_at": 0,
"message": "Your job is being processed.",
"retry_after": 2
}
The status value is the current state: queued or processing.
Success¶
On completion, the response includes a result object:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 0,
"updated_at": 0,
"result": {
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "Decoded output preview"
}
}
Failed¶
If processing fails, the response includes an error object. Its details can contain additional error information:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 0,
"updated_at": 0,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {
"message": "Error message"
}
}
}
Error handling¶
Errors use this envelope. Additional fields may appear inside details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
The following statuses are established by the supplied endpoint and status-handler source:
| HTTP status | Error codes | When it applies |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, BASE64_DECODE_FAILED | Unsupported input mode, invalidly encoded request body, empty request body, or Base64 decoding failure. |
400 | INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION | Invalid asynchronous request body or URL/file input. |
400 | INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | Job-status request errors. |
401 | UNAUTHORIZED | Authentication failed or required authorization context is missing. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | User or endpoint was not found. |
413 | PAYLOAD_TOO_LARGE | Body-mode request exceeds the plan’s body-size limit. |
413 | FILE_TOO_LARGE | URL or file input exceeds the effective plan limit. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | Plan quota or request-rate limit was reached. |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR | Plan configuration is unavailable or an internal processing error occurred. |
500 | CONFIG_ERROR, PLAN_CONFIG_ERROR | Asynchronous job configuration or plan limits are invalid. |
Asynchronous worker failures, including DOWNLOAD_FAILED and UPLOAD_FAILED, are reported in the job’s failed status response. They are not the HTTP status of the original accepted request.
Notes¶
- Body mode is synchronous; URL and file modes are asynchronous.
- Body-size, file-size, quota, rate, and output-retention limits depend on the plan. See tool limits.
- Download URLs are temporary. Their availability depends on plan retention limits.