Skip to content

Base85 Encoder API Documentation

Overview

The Base85 Encoder API allows developers to encode any text input into Base85 format.
This API supports three input modes:

  • Body Mode – Direct text input in the request body.
  • URL Mode – Remote file accessible via HTTP/HTTPS.
  • File Mode – Previously uploaded file stored in the system.

All responses include a unique request_id for tracking and debugging.
For URL and File modes, the operation is asynchronous, and a job ID is returned to check status later.


Endpoint (POST)

POST https://api.apidatatools.com/base85-encoder-api

Headers

Header Description Example
Content-Type Must be application/json for body input application/json
x-source-type Defines input mode: body, url, or file body
x-api-key API key for authenticated access <API_KEY>

Accepted File Extensions

This tool supports the following file extensions for URL and File modes:

.txt, .log


Input Example (Body Mode)

Hello World

Input Example (URL Mode)

{
  "url": "https://example.com/sample.txt"
}

Input Example (File Mode)

{
  "file": "user123/uploads/sample.txt"
}

Example Request

Synchronous (Body Input)

curl -X POST "https://api.apidatatools.com/base85-encoder-api" \
  -H "Content-Type: application/json" \
  -H "x-source-type: body" \
  -H "x-api-key: YOUR_API_KEY" \
  -d 'Encode this text'

Asynchronous (Remote File URL)

curl -X POST "https://api.apidatatools.com/base85-encoder-api" \
  -H "Content-Type: application/json" \
  -H "x-source-type: url" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"url": "https://example.com/input.txt"}'

Asynchronous (Input File)

curl -X POST "https://api.apidatatools.com/base85-encoder-api" \
  -H "Content-Type: application/json" \
  -H "x-source-type: file" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"file": "user123/uploads/input.txt"}'

Example Response

Successful (Body Mode)

{
  "status": "success",
  "request_id": "c9f8b2e1-4d3a-4a2b-9e5b-123456789abc",
  "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
  "preview": "BOu!rD]j7BEbo80"
}

Async Job Accepted

{
  "status": "accepted",
  "job_id": "job-12345-abcde",
  "status_url": "https://api.apidatatools.com/jobs/job-12345-abcde",
  "request_id": "c9f8b2e1-4d3a-4a2b-9e5b-123456789abc"
}

Error Handling

Error Code HTTP Status Description Example
BASE85_ENCODING_FAILED 400 Failed to encode input to Base85 {"status":"error","error":"BASE85_ENCODING_FAILED","details":{"message":"Invalid input"}}
INVALID_BODY_ENCODING 400 Body could not be decoded from Base64 {"status":"error","error":"INVALID_BODY_ENCODING","details":{"message":"Failed to base64-decode request body"}}
EMPTY_BODY 400 Request body is empty {"status":"error","error":"EMPTY_BODY","details":{"message":"Request body is empty"}}
PAYLOAD_TOO_LARGE 413 Body exceeds allowed size {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit"}}
INVALID_URL 400 Invalid or missing URL in URL mode {"status":"error","error":"INVALID_URL","details":{"message":"URL must be valid http/https"}}
URL_UNREACHABLE 400 Remote file could not be reached {"status":"error","error":"URL_UNREACHABLE","details":{"message":"Could not reach URL"}}
URL_NOT_OK 400 Remote file returned non-200 status {"status":"error","error":"URL_NOT_OK","details":{"message":"URL returned HTTP 404"}}
FILE_TOO_LARGE 413 File exceeds plan limit {"status":"error","error":"FILE_TOO_LARGE","details":{"message":"File exceeds plan limit"}}
INVALID_FILE_EXTENSION 400 Unsupported file extension {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Extension not allowed"}}
INVALID_SOURCE_TYPE 400 Source type must be body, 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": "job-12345-abcde",
  "status": "queued",
  "message": "Your job is being processed.",
  "retry_after": 2
}

Success

{
  "job_id": "job-12345-abcde",
  "status": "success",
  "created_at": 1712345678,
  "updated_at": 1712345689,
  "result": {
    "request_id": "c9f8b2e1-4d3a-4a2b-9e5b-123456789abc",
    "status": "success",
    "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.txt",
    "preview": "BOu!rD]j7BEbo80"
  }
}

Failed

{
  "job_id": "job-12345-abcde",
  "status": "failed",
  "error": {
    "code": "BASE85_ENCODING_FAILED",
    "message": "Failed to encode to Base85.",
    "details": {"message": "Invalid input"}
  }
}

Notes for Developers

  • Always include x-source-type header to specify input mode.
  • For large files or remote URLs, prefer URL or File mode to avoid body size limits.
  • The preview field contains the first 100KB of the encoded output for quick inspection.
  • The full encoded file is stored securely and accessible via the returned download URL.
  • Use the status_url provided in the async response to poll job status.
  • Ensure your API key has sufficient plan limits for file size and retention duration.