Skip to content

XML to TSV API

Overview

Convert XML input to tab-separated values (TSV). Body mode processes the supplied text synchronously. URL and pre-uploaded file modes create an asynchronous job.

Endpoint

Method URL
POST https://api.apidatatools.com/xml-to-tsv-api

Authentication

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

x-api-key: YOUR_API_KEY

Input modes

Select a mode with x-source-type:

  • body — Send XML text in the request body. This mode is synchronous and is the default.
  • url — Send a JSON body containing a URL to the XML file. This mode is asynchronous.
  • file — Send a JSON body containing the exact storage key returned by the upload workflow. This mode is asynchronous.

Headers

Header names are case-insensitive.

Header Type Required Default / values Description
x-api-key string Yes — API key used to authenticate 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 accepted extensions are txt, xml, and log.

Request body

Body mode

Send the XML document as raw text in the request body. The body must not be empty.

URL mode

Send a JSON object with a url property:

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

The URL must use HTTP or HTTPS and refer to a file with an accepted extension.

File mode

Send a JSON object with a file property 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/xml-to-tsv-api" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-source-type: body" \
  --data '<root><item>Example</item></root>'

URL mode

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

File mode

curl -X POST "https://api.apidatatools.com/xml-to-tsv-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 with a file URL and a preview:

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "https://downloads.apidatatools.com/TEMPORARY_FILE",
  "preview": "CONVERTER_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

Poll the returned status URL using:

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

Include the x-api-key header. The status endpoint returns these job shapes:

Queued or processing

{
  "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
}

The status is queued or processing. The created_at and updated_at values are Unix timestamps in seconds.

Success

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

Failed

{
  "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

HTTP error responses use this envelope. Additional properties may be present inside details.

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

The following HTTP statuses are defined by the API implementation for these errors:

HTTP status Error codes
400 DDB_ERROR, EMPTY_BODY, INVALID_BODY_ENCODING, INVALID_FILE, INVALID_FILE_EXTENSION, INVALID_JOB_ID, INVALID_SOURCE_TYPE, INVALID_URL, URL_NOT_OK, URL_UNREACHABLE
401 UNAUTHORIZED
404 JOB_NOT_FOUND, UNKNOWN_FUNCTION, USER_NOT_FOUND
413 FILE_TOO_LARGE, PAYLOAD_TOO_LARGE
429 QUOTA_EXCEEDED, RATE_LIMITED
500 CONFIG_ERROR, INTERNAL_ERROR, PLAN_CONFIG_ERROR, PLAN_NOT_FOUND

Errors from the job-status endpoint’s job lookup and access checks, including DDB_ERROR, FORBIDDEN, INVALID_JOB_ID, and JOB_NOT_FOUND, are returned as HTTP 400 by that endpoint.

Asynchronous jobs can also end in a failed state with error codes such as DOWNLOAD_FAILED, FILE_TOO_LARGE, INVALID_JOB, UPLOAD_FAILED, or INTERNAL_ERROR. Poll the job status endpoint to read a job’s failure details.

Notes

  • Body mode is synchronous; URL and file modes are asynchronous.
  • Request-body and file-size limits, quotas, rate limits, and download retention depend on your plan. See tool limits.
  • Download URLs are temporary, and their retention period depends on your plan.