JSON to HTML API¶
Overview¶
Convert JSON text to HTML. Body mode processes the submitted text synchronously. URL and file modes submit an asynchronous job.
Endpoint¶
POST https://api.apidatatools.com/json-to-html-api
Authentication¶
Include your API key in the x-api-key header with every request:
x-api-key: YOUR_API_KEY
Input modes¶
Select a mode with the x-source-type header:
- body — Submit raw JSON text for synchronous processing. This is the default.
- url — Submit a URL to a supported input file for asynchronous processing.
- file — Submit a pre-uploaded file reference for asynchronous processing.
Header names are case-insensitive. Use the lowercase spellings shown here.
Headers¶
| 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. |
Accepted file extensions¶
For url and file modes, the input file must have one of these extensions: .txt, .json, or .log.
Request body¶
- Body mode: Send the JSON input as raw text in the request body. The body must not be empty.
- URL mode: Send a JSON object with a
urlstring containing the input file’s HTTP or HTTPS URL. - File mode: Send a JSON object with a
filestring containing the exact storage key returned by the upload workflow.
curl examples¶
Body mode¶
The x-source-type header may be omitted because body is the default.
curl -X POST "https://api.apidatatools.com/json-to-html-api" \
-H "x-api-key: YOUR_API_KEY" \
--data-raw '{"name":"Ada","active":true}'
URL mode¶
curl -X POST "https://api.apidatatools.com/json-to-html-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
--data-raw '{"url":"https://example.com/input.json"}'
File mode¶
Replace the placeholder with the exact storage key returned by the upload workflow. Do not add a prefix.
curl -X POST "https://api.apidatatools.com/json-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 request returns HTTP 200. The response includes request_id, status, and preview. The preview is serialized JSON.
For a file-producing result, the response also includes file, a temporary download URL:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/...",
"preview": "..."
}
For a data-producing result, the response has no file field:
{
"request_id": "REQUEST_ID",
"status": "success",
"preview": "{\n ...\n}"
}
Asynchronous URL and file modes¶
A successful job submission 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 submitted job with GET https://api.apidatatools.com/jobs/{job_id}. Include your API key.
curl -X GET "https://api.apidatatools.com/jobs/JOB_ID" \
-H "x-api-key: YOUR_API_KEY"
The status endpoint returns HTTP 200 for a successfully retrieved job. created_at and updated_at are timestamps.
Queued¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 0,
"updated_at": 0,
"message": "Your job is being processed.",
"retry_after": 2
}
Processing¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "processing",
"created_at": 0,
"updated_at": 0,
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 0,
"updated_at": 0,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/...",
"preview": "..."
}
}
Failed¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 0,
"updated_at": 0,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {}
}
}
Error handling¶
Error responses use this envelope. Additional fields may appear inside details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
Request and account errors¶
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY |
401 | UNAUTHORIZED |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION |
413 | PAYLOAD_TOO_LARGE |
429 | QUOTA_EXCEEDED, RATE_LIMITED |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR |
URL and file job submission errors¶
| 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 |
Job status errors¶
The status endpoint returns HTTP 400 for these job lookup or access errors: INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR. Authentication and account errors may also apply.
Processing failures are reported in the job’s failed status response. Their error codes can include INVALID_JOB, FILE_TOO_LARGE, DOWNLOAD_FAILED, UPLOAD_FAILED, and INTERNAL_ERROR.
Notes¶
- Body mode is synchronous; URL and file modes are asynchronous.
- Request body, file size, quota, rate, and output retention limits depend on the plan. See tool limits.
- Download URLs are temporary, and their retention period depends on the plan.