Skip to content

CSV to HTML API

Overview

Converts CSV text to HTML. Body mode runs synchronously; URL and file modes create an asynchronous job.

Endpoint

Method: POST
URL: https://api.apidatatools.com/csv-to-html-api

Authentication

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

x-api-key: YOUR_API_KEY

Input modes

Mode Description
body Send CSV text in the request body. This is the default and runs synchronously.
url Send a JSON body containing a URL to an input file. Runs asynchronously.
file Send a JSON body containing the exact storage key returned by the upload workflow. Runs asynchronously.

Headers

Header names are case-insensitive.

Header Type Required Default / values Description
x-api-key String Yes None API key used to authenticate the request.
x-source-type String No body; body, url, or file Selects the input mode.

Accepted file extensions

For URL and file modes, the input file must have one of these extensions:

  • .txt
  • .csv
  • .log

Request body

Body mode

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

URL mode

Send a JSON object with a url field:

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

The URL must be valid HTTP or HTTPS, reachable, and return HTTP 200 or 206. The file extension must be accepted.

File mode

Send a JSON object with a file field containing the exact storage key returned by the upload workflow:

{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}

The file must be available and have an accepted extension.

curl examples

Body mode

curl --request POST 'https://api.apidatatools.com/csv-to-html-api' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-source-type: body' \
  --data-raw 'name,age
Ada,36
Lin,29'

URL mode

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

File mode

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

Success responses

Synchronous body mode

A successful file-producing response has HTTP 200 and includes request_id, status, file, and preview:

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

The file value is a temporary download URL. Its availability 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"
}

Acceptance means the job was created; retrieve its status to check the result.

Async job status

Retrieve a job’s current status with:

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

The request requires the x-api-key header. For example:

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

The status endpoint returns HTTP 200 for the job states below.

Queued or processing

Both queued and processing responses include the same fields; status identifies the current state:

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

Success

A successful job includes its result under result:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 1700000000,
  "updated_at": 1700000001,
  "result": {
    "status": "success",
    "file": "https://downloads.apidatatools.com/OUTPUT_FILE",
    "preview": "OUTPUT_PREVIEW"
  }
}

Failed

A failed job includes its error code, message, and details under error:

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

Error handling

Error responses use this envelope. Additional fields may be included in details.

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

Synchronous request and authentication errors

HTTP status Error codes
400 INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY; tool-specific input errors
401 UNAUTHORIZED
404 USER_NOT_FOUND, UNKNOWN_FUNCTION
413 PAYLOAD_TOO_LARGE
429 QUOTA_EXCEEDED, RATE_LIMITED
500 PLAN_NOT_FOUND, INTERNAL_ERROR

Asynchronous job creation errors

HTTP status Error codes
400 INVALID_SOURCE_TYPE, 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 encountered while processing an accepted job, such as DOWNLOAD_FAILED or UPLOAD_FAILED, appear in the job’s failed status rather than as the original request’s HTTP response.

Job-status lookup errors INVALID_JOB_ID, DDB_ERROR, JOB_NOT_FOUND, and FORBIDDEN return HTTP 400.

Notes

  • Body-size limits, file-size limits, quota, rate limits, and download retention depend on your plan. See the tool limits.
  • Download URLs are temporary; their retention period depends on your plan.
  • URL and file inputs are subject to file-size limits and accepted-extension checks.