Base32 Encoder API Documentation¶
Overview¶
The Base32 Encoder API encodes a given text input into Base32 format.
It supports three input modes:
- Body Mode: Direct text input in the request body.
- URL Mode: Remote file URL input (asynchronous processing).
- File Mode: Uploaded file input (asynchronous processing).
The API returns a Base32-encoded text file with .txt extension and MIME type text/plain.
For asynchronous operations, a job ID is provided to check status later.
Endpoint (POST)¶
POST https://api.apidatatools.com/base32-encoder-api
Headers¶
| Header | Description | Required | Example |
|---|---|---|---|
Content-Type | Input content type | Yes | application/json |
x-source-type | Input source type (body, url, or file) | Optional (default: body) | body |
x-api-key | API key | Yes | <api_key> |
Accepted File Extensions¶
This tool accepts the following file extensions for URL or file mode:
["txt", "log"]
Input Example (Body Mode)¶
Hello World
Input Example (URL Mode)¶
{
"url": "https://example.com/sample.txt"
}
Input Example (File Mode)¶
{
"file": "user_uploads/sample.txt"
}
Example Request¶
Synchronous (Body Input)¶
curl -X POST "https://api.apidatatools.com/base32-encoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: body" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"content": "Hello World"}'
Asynchronous (Remote File URL)¶
curl -X POST "https://api.apidatatools.com/base32-encoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: url" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"url": "https://example.com/sample.txt"}'
Asynchronous (Input File)¶
curl -X POST "https://api.apidatatools.com/base32-encoder-api" \
-H "Content-Type: application/json" \
-H "x-source-type: file" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"file": "user_uploads/sample.txt"}'
Example Response¶
Successful (Body Mode)¶
{
"status": "success",
"request_id": "b7e3f9d2-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
"preview": "JBSWY3DPEBLW64TMMQ======"
}
Async Job Accepted¶
{
"status": "accepted",
"job_id": "c1a2b3d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status_url": "https://api.apidatatools.com/jobs/c1a2b3d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"request_id": "b7e3f9d2-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Error Handling¶
| Error Code | HTTP Status | Description | Example |
|---|---|---|---|
BASE32_ENCODING_FAILED | 400 | Failed to encode input to Base32 | {"status":"error","error":"BASE32_ENCODING_FAILED","details":{"message":"Failed to encode to Base32."}} |
INVALID_BODY | 400 | Body must be valid JSON | {"status":"error","error":"INVALID_BODY","details":{"message":"Body must be valid JSON."}} |
INVALID_URL | 400 | Missing or invalid URL | {"status":"error","error":"INVALID_URL","details":{"message":"Missing or invalid 'url'."}} |
URL_UNREACHABLE | 400 | Could not reach remote URL | {"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."}} |
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 | Unsupported file extension | {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension"}} |
INVALID_SOURCE_TYPE | 400 | Must be url or file | {"status":"error","error":"INVALID_SOURCE_TYPE","details":{"message":"Must be 'url' or 'file'."}} |
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, use the following endpoint:
GET https://api.apidatatools.com/jobs/{job_id}
Example Status Response for Async¶
Queued¶
{
"job_id": "c1a2b3d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status": "queued",
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
{
"job_id": "c1a2b3d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status": "success",
"created_at": 1712345678,
"updated_at": 1712345689,
"result": {
"status": "success",
"request_id": "b7e3f9d2-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
"preview": "JBSWY3DPEBLW64TMMQ======"
}
}
Failed¶
{
"job_id": "c1a2b3d4-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status": "failed",
"error": {
"code": "BASE32_ENCODING_FAILED",
"message": "Failed to encode to Base32.",
"details": {"message": "Invalid input encoding"}
}
}
Notes for Developers¶
- The API supports synchronous and asynchronous modes based on the
x-source-typeheader. - For Body Mode, the response is immediate with a downloadable file link.
- For URL or File Mode, the API returns a job ID and status URL for later retrieval.
- Each response includes a unique
request_idfor tracking. - The preview field contains the first 100 KB of encoded output.
- Ensure file extensions match the allowed list (
txt,log) for URL or file inputs. - Use the Status API to poll job progress until completion.