Skip to content

YAML to HTML API Documentation

Overview

The YAML to HTML API converts one or more YAML documents into a structured HTML table.
Each YAML document is validated, flattened into key-value pairs, and rendered as a row in an HTML table.
The output is a complete HTML document containing a styled table representation of the YAML data.

This API supports three input modes:

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

The API can operate synchronously (for body input) or asynchronously (for URL or file input).


Endpoint (POST)

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

Headers

Header Description Required Example
Content-Type MIME type of the request body Yes text/plain
x-source-type Input source type: body, url, or file Optional (defaults to body) body
x-api-key API key Yes <api_key>

Accepted File Extensions

This tool accepts the following file extensions for YAML input:

yml, yaml, txt, log


Input Example (Body Mode)

---
name: Alice
age: 30
skills:
  - Python
  - Data Analysis
---
name: Bob
age: 25
skills:
  - JavaScript
  - UI Design

Input Example (URL Mode)

{
  "url": "https://example.com/data/sample.yaml"
}

Input Example (File Mode)

{
  "file": "user_uploads/upl_abc123/sample.yaml"
}

Example Request

Synchronous (Body Input)

curl -X POST "https://api.apidatatools.com/yaml-to-html-api" \
  -H "Content-Type: text/plain" \
  -H "x-source-type: body" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '<YAML_INPUT>'

Asynchronous (Remote File URL)

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

Asynchronous (Input File)

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

Example Response

Successful (Body Mode)

{
  "status": "success",
  "request_id": "req_12345",
  "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.html",
  "preview": "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"utf-8\"><title>YAML to HTML Table</title>..."
}

Async Job Accepted

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

Error Handling

Error Code HTTP Status Description Example
INVALID_YAML 400 YAML validation failed {"status":"error","error":"INVALID_YAML","details":{"message":"YAML validation failed."}}
YAML_FLATTEN_FAILED 400 Failed to flatten YAML structure {"status":"error","error":"YAML_FLATTEN_FAILED","details":{"message":"Failed to flatten YAML structure for HTML conversion."}}
HTML_CONVERSION_FAILED 400 Failed to convert YAML to HTML table {"status":"error","error":"HTML_CONVERSION_FAILED","details":{"message":"Failed to convert YAML to HTML table."}}
EMPTY_BODY 400 Request body is empty {"status":"error","error":"EMPTY_BODY","details":{"message":"Request body is empty."}}
INVALID_BODY_ENCODING 400 Failed to decode base64 body {"status":"error","error":"INVALID_BODY_ENCODING","details":{"message":"Failed to base64-decode request body."}}
PAYLOAD_TOO_LARGE 413 Body size exceeds plan limit {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit."}}
INVALID_URL 400 Invalid or missing 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 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":"File exceeds plan limit."}}
INVALID_FILE_EXTENSION 400 Unsupported file extension {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension."}}
FILE_UNAVAILABLE 400 File not accessible {"status":"error","error":"FILE_UNAVAILABLE","details":{"message":"Could not access file."}}
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 (URL or File mode):

Endpoint

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

Example Status Response for Async

Queued

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

Success

{
  "job_id": "job_67890",
  "status": "success",
  "created_at": 1712345678,
  "updated_at": 1712345690,
  "result": {
    "request_id": "req_12345",
    "status": "success",
    "file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.html",
    "preview": "<!DOCTYPE html><html lang=\"en\"><head>..."
  }
}

Failed

{
  "job_id": "job_67890",
  "status": "failed",
  "error": {
    "code": "INVALID_YAML",
    "message": "YAML validation failed.",
    "details": {"line": 2, "column": 5}
  }
}

Notes for Developers

  • The API automatically validates YAML syntax before conversion.
  • Each YAML document becomes one row in the HTML table.
  • The output HTML is uploaded to a secure storage and returned as a downloadable link.
  • For large files or remote URLs, use asynchronous mode (x-source-type: url or x-source-type: file).
  • The request_id is included in every response for traceability.
  • To monitor async jobs, use the Status API endpoint with the provided job_id.
  • Preview content is truncated to 100 KB for efficiency.
  • Ensure your plan limits allow sufficient file size and retention hours for output storage.