Skip to content

YAML to HTML API

Overview

Convert YAML input to HTML.

Body mode processes the YAML synchronously. URL and file modes submit an asynchronous job.

Endpoint

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

Authentication

Include your API key in the x-api-key header on every request:

x-api-key: YOUR_API_KEY

Input modes

Mode Description Processing
body Send YAML text in the request body. Synchronous
url Send a URL to a YAML file in a JSON request body. Asynchronous
file Send a pre-uploaded file reference in a JSON request body. Asynchronous

Headers

Header names are case-insensitive. Use the lowercase spellings shown here.

Header Type Required Default / values Description
x-api-key string Yes Your API key Authenticates the request.
x-source-type string No Defaults to body; body, url, or file Selects the input mode.

Accepted file extensions

URL and file modes accept these extensions:

  • .yml
  • .yaml
  • .txt
  • .log

Request body

Body mode

Send raw YAML text as the request body.

URL mode

Send a JSON object with a url field:

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

File mode

Send a JSON object with a file field. Its value must be 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/yaml-to-html-api' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-source-type: body' \
  --data-raw 'title: Example
items:
  - one
  - two'

URL mode

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

File mode

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

Success responses

Synchronous body mode

A successful conversion returns HTTP 200. This converter produces a file, so the response includes request_id, status, file, and preview.

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "https://downloads.apidatatools.com/OUTPUT_FILE",
  "preview": "HTML preview"
}

The download URL is temporary; its retention period depends on your plan.

Asynchronous URL and file modes

A successfully accepted job 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 a job by sending an authenticated GET request to:

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

For example:

curl -X GET 'https://api.apidatatools.com/jobs/JOB_ID' \
  -H 'x-api-key: YOUR_API_KEY'

The status endpoint returns HTTP 200 when it returns a job state.

Queued or processing

For queued and processing jobs, the response includes:

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

status is queued or processing, as applicable. The timestamps are Unix timestamps.

Success

A completed job includes its result:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 1720000000,
  "updated_at": 1720000001,
  "result": {
    "status": "success",
    "file": "https://downloads.apidatatools.com/OUTPUT_FILE",
    "preview": "HTML preview"
  }
}

Failed

A failed job includes an error object:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "failed",
  "created_at": 1720000000,
  "updated_at": 1720000001,
  "error": {
    "code": "ERROR_CODE",
    "message": "Error message",
    "details": {
      "message": "Error message"
    }
  }
}

The details object can contain additional error information.

Error handling

HTTP error responses use this envelope. Additional fields may appear in details.

{
  "status": "error",
  "error": "ERROR_CODE",
  "request_id": "REQUEST_ID",
  "details": {
    "message": "Error message"
  }
}
HTTP status Error codes Applies to
400 INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION Invalid mode, body, URL, or file input.
400 INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR Job-status request errors.
400 Tool-specific conversion errors Synchronous conversion errors. The response uses the tool error code and message.
401 UNAUTHORIZED Authentication failed or authorizer context is unavailable.
404 USER_NOT_FOUND, UNKNOWN_FUNCTION The user or requested API endpoint was not found.
413 PAYLOAD_TOO_LARGE, FILE_TOO_LARGE A request body or input file exceeds the applicable plan limit.
429 QUOTA_EXCEEDED, RATE_LIMITED Plan quota or rate limit was reached.
500 PLAN_NOT_FOUND, CONFIG_ERROR, PLAN_CONFIG_ERROR, INTERNAL_ERROR Plan configuration, async job configuration, or processing error.

Some errors occur during asynchronous processing and are reported as a failed job through the status endpoint rather than as the original request’s HTTP response. These include INVALID_JOB, DOWNLOAD_FAILED, and UPLOAD_FAILED; FILE_TOO_LARGE can also appear as a failed job.

Notes

  • Body-size, file-size, quota, rate, and download-retention limits depend on your plan. See API tool limits.
  • Download URLs are temporary. Retention depends on your plan.