YAML to TSV API Documentation¶
Overview¶
The YAML to TSV API converts YAML content into TSV (Tab-Separated Values) format.
It supports: - Single or multi-document YAML inputs. - Flattening nested YAML structures into tabular rows. - Output as downloadable TSV file with a preview.
This API can operate in:
- Body Mode (Synchronous) — Direct YAML content in request body.
- URL Mode (Asynchronous) — Remote YAML file via public HTTP/HTTPS URL.
- File Mode (Asynchronous) — Previously uploaded file reference.
Base URL:
https://api.apidatatools.com/yaml-to-tsv-api
Endpoint (POST)¶
POST https://api.apidatatools.com/yaml-to-tsv-api
Headers¶
| Header | Description | Required | Example |
|---|---|---|---|
Content-Type | MIME type of request body | Yes | text/plain |
x-source-type | Input source type: body, url, or file | Optional (defaults to body) | url |
x-api-key | API key | Yes | <API_KEY> |
Accepted File Extensions¶
Allowed extensions for this tool:
yml, yaml, txt, log
Input Example (Body Mode)¶
---
name: Alice
age: 30
skills:
- Python
- Data Analysis
---
name: Bob
age: 25
skills:
- JavaScript
- UI Design
Input Example (URL Mode)¶
{
"url": "https://example.com/data/sample.yaml"
}
Input Example (File Mode)¶
{
"file": "user_uploads/upl_abc123/sample.yaml"
}
Example Request¶
Synchronous (Body Input)¶
curl -X POST "https://api.apidatatools.com/yaml-to-tsv-api" \
-H "Content-Type: text/plain" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: body" \
-d '<YAML_INPUT>
Asynchronous (Remote File URL)¶
curl -X POST "https://api.apidatatools.com/yaml-to-tsv-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
-d '{"url": "https://example.com/data/sample.yaml"}'
Asynchronous (Input File)¶
curl -X POST "https://api.apidatatools.com/yaml-to-tsv-api" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: file" \
-d '{"file": "user_uploads/upl_abc123/sample.yaml"}'
Example Response¶
Successful (Body Mode)¶
{
"status": "success",
"request_id": "req_12345",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.tsv",
"preview": "name\tage\tskills_0\tskills_1\nAlice\t30\tPython\tData Analysis\nBob\t25\tJavaScript\tUI Design\n"
}
Async Job Accepted¶
{
"status": "accepted",
"job_id": "job_67890",
"status_url": "https://api.apidatatools.com/jobs/job_67890",
"request_id": "req_12345"
}
Error Handling¶
| Error Code | HTTP Status | Description | Example |
|---|---|---|---|
INVALID_YAML | 400 | YAML validation failed | {"status":"error","error":"INVALID_YAML","details":{"message":"YAML validation failed."}} |
YAML_FLATTEN_FAILED | 400 | Failed to flatten YAML structure | {"status":"error","error":"YAML_FLATTEN_FAILED","details":{"message":"Failed to flatten YAML structure for TSV conversion."}} |
TSV_CONVERSION_FAILED | 400 | Conversion to TSV failed | {"status":"error","error":"TSV_CONVERSION_FAILED","details":{"message":"Failed to convert YAML to TSV."}} |
INVALID_BODY_ENCODING | 400 | Body encoding invalid | {"status":"error","error":"INVALID_BODY_ENCODING","details":{"message":"Failed to base64-decode request body."}} |
EMPTY_BODY | 400 | Request body empty | {"status":"error","error":"EMPTY_BODY","details":{"message":"Request body is empty."}} |
PAYLOAD_TOO_LARGE | 413 | Body exceeds plan limit | {"status":"error","error":"PAYLOAD_TOO_LARGE","details":{"message":"Request body exceeds limit."}} |
INVALID_URL | 400 | Invalid or missing URL | {"status":"error","error":"INVALID_URL","details":{"message":"Missing or invalid 'url'."}} |
URL_UNREACHABLE | 400 | URL cannot be reached | {"status":"error","error":"URL_UNREACHABLE","details":{"message":"Could not reach URL."}} |
URL_NOT_OK | 400 | URL returned non-200 status | {"status":"error","error":"URL_NOT_OK","details":{"message":"URL returned HTTP 404, expected 200."}} |
FILE_TOO_LARGE | 413 | File exceeds plan limit | {"status":"error","error":"FILE_TOO_LARGE","details":{"message":"Remote file exceeds plan limit."}} |
INVALID_FILE | 400 | Invalid file reference | {"status":"error","error":"INVALID_FILE","details":{"message":"Missing or invalid 'file'."}} |
INVALID_FILE_EXTENSION | 400 | Unsupported file extension | {"status":"error","error":"INVALID_FILE_EXTENSION","details":{"message":"Invalid or unsupported file extension."}} |
JOB_NOT_FOUND | 404 | Job not found in status API | {"status":"error","error":"JOB_NOT_FOUND","details":{"message":"Job not found"}} |
INTERNAL_ERROR | 500 | Unexpected server error | {"status":"error","error":"INTERNAL_ERROR","details":{"message":"Failed to process your request"}} |
Async Job Status¶
To check the status of an asynchronous job, use the Status API.
Endpoint:
GET https://api.apidatatools.com/jobs/{job_id}
Example Status Response for Async¶
Queued¶
{
"job_id": "job_67890",
"status": "queued",
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
{
"job_id": "job_67890",
"status": "success",
"created_at": 1712345678,
"updated_at": 1712345690,
"result": {
"request_id": "req_12345",
"status": "success",
"file": "https://downloads.apidatatools.com/apidatatools_convert_abc123.tsv",
"preview": "name\tage\tskills_0\tskills_1\nAlice\t30\tPython\tData Analysis\nBob\t25\tJavaScript\tUI Design\n"
}
}
Failed¶
{
"job_id": "job_67890",
"status": "failed",
"error": {
"code": "INVALID_YAML",
"message": "YAML validation failed.",
"details": {"line": 2, "column": 5}
}
}
Notes for Developers¶
- The API automatically validates YAML syntax before conversion.
- Multi-document YAML inputs are supported; each document becomes a row in TSV.
- For large files or remote URLs, use asynchronous mode (
x-source-type: urlorfile). - The
previewfield contains the first 100 KB of TSV output. - The
request_idis included in every response for traceability. - Asynchronous jobs can be monitored via the
/jobs/{job_id}endpoint. - Output files are stored temporarily and accessible via secure download links.
- Ensure your plan limits allow for the file size being processed.