Skip to content

HTML Decoder API

Overview

The HTML Decoder API accepts text for synchronous processing, or a URL or uploaded-file reference for asynchronous processing.

Endpoint

POST https://api.apidatatools.com/html-decoder-api

Authentication

Send your API key in the x-api-key header.

Input modes

Mode Behavior
body Synchronous processing. This is the default mode.
url Asynchronous processing of a file at a URL.
file Asynchronous processing of a previously uploaded file.

Headers

Header names are case-insensitive. The spellings below are the documented lowercase forms.

Header Type Required Default / values Description
x-api-key string Yes No default Your API key.
x-source-type string No Default: body. Values: body, url, file Selects the input mode.

Accepted file extensions

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

Request body

Body mode

Send the input as raw text. The request body must not be empty.

URL mode

Send a JSON object with a url string:

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

File mode

Send a JSON object with a file string containing 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/html-decoder-api' \
  -H 'x-api-key: YOUR_API_KEY' \
  --data-raw '&'

URL mode

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

File mode

curl -X POST 'https://api.apidatatools.com/html-decoder-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 synchronous response has HTTP status 200. The response includes request_id, status, and preview. For data-producing results, preview is serialized JSON.

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "preview": "PREVIEW"
}

If a synchronous result is file-producing, the response includes file as well:

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "TEMPORARY_DOWNLOAD_URL",
  "preview": "PREVIEW"
}

Asynchronous URL and file modes

A successful job submission returns HTTP status 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 submitted job with:

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

Send the same x-api-key header. For example:

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

The status response includes request_id, job_id, status, created_at, and updated_at. Timestamps are Unix time values.

Queued and processing

Both queued and processing responses include the same message and retry interval:

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

For a processing job, status is "processing".

Success

A completed job includes its result:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 1710000000,
  "updated_at": 1710000002,
  "result": {
    "status": "success",
    "file": "TEMPORARY_DOWNLOAD_URL",
    "preview": "PREVIEW"
  }
}

Failed

A failed job includes an error code, message, and details:

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

Error handling

Errors use this envelope. Additional fields may appear inside details.

{
  "status": "error",
  "error": "ERROR_CODE",
  "request_id": "REQUEST_ID",
  "details": {
    "message": "Error message"
  }
}

Synchronous request and account errors

Error HTTP status
UNAUTHORIZED 401
USER_NOT_FOUND 404
PLAN_NOT_FOUND 500
QUOTA_EXCEEDED 429
RATE_LIMITED 429
INVALID_SOURCE_TYPE 400
INVALID_BODY_ENCODING 400
EMPTY_BODY 400
PAYLOAD_TOO_LARGE 413
UNKNOWN_FUNCTION 404
INTERNAL_ERROR 500

URL and file submission errors

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

Job status and processing errors

Job status lookup errors INVALID_JOB_ID, DDB_ERROR, JOB_NOT_FOUND, and FORBIDDEN are returned with HTTP status 400.

INVALID_JOB, DOWNLOAD_FAILED, UPLOAD_FAILED, and INTERNAL_ERROR can also appear as errors stored on a failed job. These describe job processing failures; the status response reports the job state and does not assign those stored errors an HTTP status.

Notes

  • Request-body and file-size limits, quota, rate limits, and download retention depend on your plan. See the tool limits page.
  • Download URLs are temporary; their retention period depends on your plan.