Skip to content

Base64 to YAML API

Overview

Decode Base64-encoded YAML and validate the decoded YAML. Body mode runs synchronously; URL and file modes create an asynchronous job.

Endpoint

Property Value
Method POST
URL https://api.apidatatools.com/base64-to-yaml-api

Authentication

Include your API key in the x-api-key header:

x-api-key: YOUR_API_KEY

Input modes

Select a mode with x-source-type:

Mode Behavior
body Send raw Base64 text in the request body. The conversion runs synchronously. This is the default mode.
url Send a JSON object containing a URL to a Base64-encoded input file. The request creates an asynchronous job.
file Send a JSON object containing the exact storage key returned by the upload workflow. The request creates an asynchronous job.

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 Default: body. Values: body, url, file. Selects the input mode.
x-record-path string No No endpoint-specific value. This converter does not use this header.
x-root-name string No No endpoint-specific value. This converter does not use this header.
x-tab-space string No No endpoint-specific value. This converter does not use this header.

Accepted file extensions

For URL and file modes, the input file extension must be .txt or .log.

Request body

Body mode

Send the Base64-encoded YAML as raw text—not as a JSON string. For example, the following Base64 text decodes to name: Ada:

bmFtZTogQWRhCg==

Whitespace in the Base64 input is ignored.

URL mode

Send a JSON object with a url property:

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

File mode

Send a JSON object with a file property. Use the exact storage key returned by the upload workflow:

{
  "file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}

curl examples

Body mode

curl -X POST "https://api.apidatatools.com/base64-to-yaml-api" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-source-type: body" \
  --data-raw 'bmFtZTogQWRhCg=='

URL mode

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

File mode

curl -X POST "https://api.apidatatools.com/base64-to-yaml-api" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-source-type: file" \
  -H "Content-Type: application/json" \
  --data-raw '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'

Success responses

Synchronous body-mode response

A successful body-mode request returns HTTP 200 with a file-producing response:

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "TEMPORARY_DOWNLOAD_URL",
  "preview": "name: Ada\n"
}

The file value is a temporary download URL. The preview contains a portion of the converted YAML.

Asynchronous URL/file response

A successfully accepted URL- or file-mode 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

Check an asynchronous job with:

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

Include x-api-key on the GET request as well. The status response includes request_id, job_id, status, created_at, and updated_at.

Queued or processing

For queued and processing jobs, the response also includes the processing message and retry interval:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "queued",
  "created_at": 1730000000,
  "updated_at": 1730000000,
  "message": "Your job is being processed.",
  "retry_after": 2
}

The status value may be queued or processing.

Success

A completed job includes a result object:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 1730000000,
  "updated_at": 1730000002,
  "result": {
    "status": "success",
    "file": "TEMPORARY_DOWNLOAD_URL",
    "preview": "name: Ada\n"
  }
}

Failed

A failed job includes an error object:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "failed",
  "created_at": 1730000000,
  "updated_at": 1730000002,
  "error": {
    "code": "BASE64_DECODE_FAILED",
    "message": "Failed to decode Base64 input.",
    "details": {
      "message": "Invalid input"
    }
  }
}

The error code, message, and details depend on the failure.

Error handling

Error responses use this envelope. Additional fields may appear inside details.

{
  "status": "error",
  "error": "ERROR_CODE",
  "request_id": "REQUEST_ID",
  "details": {
    "message": "Description of the error."
  }
}

Request and conversion errors

HTTP status Error codes
400 INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, BASE64_DECODE_FAILED, INVALID_YAML, MISSING_INPUT_FILE
413 PAYLOAD_TOO_LARGE
500 INTERNAL_ERROR, PLAN_NOT_FOUND
401 UNAUTHORIZED
404 USER_NOT_FOUND
429 QUOTA_EXCEEDED, RATE_LIMITED

URL/file job-creation errors

These errors are returned when the asynchronous request is being validated:

HTTP status Error codes
400 INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION
413 FILE_TOO_LARGE
500 CONFIG_ERROR, PLAN_CONFIG_ERROR

Errors that occur while a job is being processed, such as DOWNLOAD_FAILED, UPLOAD_FAILED, or FILE_TOO_LARGE, are reported in the job’s failed status rather than as an HTTP response to the original request. Checking the job status itself can return HTTP 400 for INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, or DDB_ERROR.

Notes

  • Body-size and file-size limits, quotas, rate limits, and download retention depend on your plan. See tool limits.
  • Download URLs are temporary; retention depends on your plan.
  • URL and file modes require an input file with a .txt or .log extension.