Skip to content

Base64 to YAML API Documentation

Overview

The Base64 to YAML API converts Base64-encoded YAML content into plain YAML text.
It supports three input modes:

  • Body Mode: Direct Base64 string in the request body.
  • URL Mode: Remote file URL containing Base64-encoded YAML.
  • File Mode: Previously uploaded file reference containing Base64-encoded YAML.

The API validates the decoded YAML structure before returning the output.
If the YAML is valid, the result is stored temporarily and returned as a downloadable link.


Endpoint (POST)

POST https://api.apidatatools.com/base64-to-yaml-api

Headers

Header Description Required Example
Content-Type Must be application/json for body input Yes application/json
x-source-type Defines input mode: body, url, or file Optional (default: body) x-source-type: url
x-api-key API key for authentication Yes <api_key>

Accepted File Extensions

This tool accepts files with the following extensions when using URL or File mode:

.txt, .log


Input Example (Body Mode)

YmFzZTY0X2VuY29kZWRfY29udGVudA==
Where the value is a Base64-encoded YAML string.


Input Example (URL Mode)

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

Input Example (File Mode)

{
  "file": "user_uploads/upl_12345/sample_base64_yaml.txt"
}

Example Request

Synchronous (Body Input)

curl -X POST "https://api.apidatatools.com/base64-to-yaml-api" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d 'YmFzZTY0X2VuY29kZWRfY29udGVudA=='

Asynchronous (Remote File URL)

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

Asynchronous (Input File)

curl -X POST "https://api.apidatatools.com/base64-to-yaml-api" \
  -H "Content-Type: application/json" \
  -H "x-source-type: file" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"file": "user_uploads/upl_12345/sample_base64_yaml.txt"}'

Example Response

Successful (Body Mode)

{
  "status": "success",
  "request_id": "req_abc123",
  "file": "https://downloads.apidatatools.com/apidatatools_convert_abcdef123456.yaml",
  "preview": "key: value\nanother_key: another_value\n..."
}

Async Job Accepted

{
  "status": "accepted",
  "job_id": "job_12345",
  "status_url": "https://api.apidatatools.com/jobs/job_12345",
  "request_id": "req_abc123"
}

Error Handling

Error Code HTTP Status Description Example
INVALID_BASE64 400 Input is not valid Base64 {"status":"error","error":"INVALID_BASE64","details":{"message":"Base64 decoding failed."}}
INVALID_UTF8 400 Decoded Base64 is not valid UTF-8 {"status":"error","error":"INVALID_UTF8","details":{"message":"Decoded Base64 is not valid UTF-8 YAML."}}
INVALID_YAML 400 YAML structure invalid {"status":"error","error":"INVALID_YAML","details":{"message":"Decoded YAML is not well-formed."}}
INVALID_URL 400 URL missing or invalid {"status":"error","error":"INVALID_URL","details":{"message":"Missing or invalid 'url'."}}
URL_UNREACHABLE 400 Remote file cannot be reached {"status":"error","error":"URL_UNREACHABLE","details":{"message":"Could not reach URL."}}
URL_NOT_OK 400 Remote file returned non-200 HTTP code {"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 supported {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension."}}
FILE_UNAVAILABLE 400 File not accessible in storage {"status":"error","error":"FILE_UNAVAILABLE","details":{"message":"Could not access file."}}
PAYLOAD_TOO_LARGE 413 Body exceeds allowed size {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit."}}
INTERNAL_ERROR 500 Unexpected server 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 Status API:

Endpoint

GET https://api.apidatatools.com/jobs/{job_id}

Example Status Response for Async

Queued

{
  "job_id": "job_12345",
  "status": "queued",
  "message": "Your job is being processed.",
  "retry_after": 2
}

Success

{
  "job_id": "job_12345",
  "status": "success",
  "created_at": 1712345678,
  "updated_at": 1712345689,
  "result": {
    "request_id": "req_abc123",
    "status": "success",
    "file": "https://downloads.apidatatools.com/apidatatools_convert_abcdef123456.yaml",
    "preview": "key: value\nanother_key: another_value\n..."
  }
}

Failed

{
  "job_id": "job_12345",
  "status": "failed",
  "error": {
    "code": "INVALID_YAML",
    "message": "Decoded YAML is not well-formed.",
    "details": {"line": 3, "column": 5}
  }
}

Notes for Developers

  • The API automatically validates YAML syntax before returning results.
  • The output file is temporarily stored and accessible via a secure download link.
  • For large files or remote sources, use x-source-type: url or x-source-type: file to trigger asynchronous processing.
  • Each response includes a unique request_id for tracking and debugging.
  • The preview field contains up to 100 KB of the decoded YAML for quick inspection.
  • Async jobs can be monitored using the /jobs/{job_id} endpoint until completion.