JSON to TSV API¶
Overview¶
Convert JSON input to TSV. Body mode runs synchronously; URL and file modes create an asynchronous job.
Endpoint¶
| Method | URL |
|---|---|
POST | https://api.apidatatools.com/json-to-tsv-api |
Authentication¶
Include your API key in the x-api-key header on every request:
x-api-key: YOUR_API_KEY
Input modes¶
| Mode | Behavior |
|---|---|
body | Sends JSON text in the request body and processes it synchronously. This is the default mode. |
url | Sends a URL to an input file. The API creates an asynchronous job. |
file | Sends a pre-uploaded file’s storage key. The API creates an asynchronous job. |
Headers¶
Header names are case-insensitive.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | No default | API key used for authentication. |
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 use one of these extensions:
.txt.json.log
Request body¶
Body mode¶
Send JSON text as the raw request body. The body is processed synchronously.
URL mode¶
Send a JSON object with a url field containing the input file’s URL:
{
"url": "https://example.com/input.json"
}
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"
}
Do not add a path prefix to the storage key.
curl examples¶
Body mode¶
Send raw JSON text:
curl -X POST "https://api.apidatatools.com/json-to-tsv-api" \
-H "x-api-key: YOUR_API_KEY" \
--data-raw '{"name":"Ada","role":"Engineer"}'
URL mode¶
curl -X POST "https://api.apidatatools.com/json-to-tsv-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 example value with the exact storage key returned by the upload workflow.
curl -X POST "https://api.apidatatools.com/json-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 synchronous conversion returns HTTP 200 with a file link and preview:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "..."
}
Asynchronous URL or file mode¶
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¶
Poll the status URL returned when submitting a URL or file job:
GET https://api.apidatatools.com/jobs/{job_id}
Include the x-api-key header. A successful status request returns HTTP 200.
The status response includes request_id, job_id, status, created_at, and updated_at. Its remaining fields depend on the job state.
Queued or processing¶
Both states include the same pending-job message and retry interval:
{
"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
}
When processing, status is "processing"; the other fields have the same shape.
Success¶
On success, the response includes a result object:
{
"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": "..."
}
}
Failed¶
On failure, the response includes an error object:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1700000000,
"updated_at": 1700000001,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {}
}
}
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"
}
}
The following HTTP statuses and error codes are established for this API:
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION, DDB_ERROR, INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN |
401 | UNAUTHORIZED |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION |
413 | PAYLOAD_TOO_LARGE, FILE_TOO_LARGE |
429 | QUOTA_EXCEEDED, RATE_LIMITED |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR, CONFIG_ERROR, PLAN_CONFIG_ERROR |
An asynchronous job can also fail with DOWNLOAD_FAILED or UPLOAD_FAILED. These codes appear in the failed job’s status response.
Notes¶
- Body-size, file-size, quota, rate, and output-retention limits depend on your plan. See tool limits.
- Download URLs are temporary; their retention depends on your plan.