JSON Unescape API¶
Overview¶
Submit text for JSON unescaping. Body mode processes the request synchronously; URL and file modes create an asynchronous job.
Endpoint¶
POST https://api.apidatatools.com/json-unescape-api
Authentication¶
Include your API key in the x-api-key header.
Input modes¶
| Mode | Processing | Input |
|---|---|---|
body | Synchronous | Raw text in the request body |
url | Asynchronous | JSON object containing a URL |
file | Asynchronous | JSON object containing a pre-uploaded file reference |
Headers¶
Header names are case-insensitive. The spellings below are the documented lowercase forms.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | Your API key | Authenticates the request. |
x-source-type | String | No | Defaults to body; accepted values: body, url, file | Selects the input mode. |
Accepted file extensions¶
URL and file inputs must use one of these extensions:
txtjsonlog
Request body or parameters¶
Body mode¶
Send the input as raw text in the request body.
URL mode¶
Send a JSON object with a url property:
{"url":"https://example.com/input.json"}
The URL must be reachable over HTTP or HTTPS and use an accepted file extension.
File mode¶
Send a JSON object with a file property containing the exact storage key associated with a file from the upload workflow:
{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}
curl examples¶
Body mode¶
curl -X POST 'https://api.apidatatools.com/json-unescape-api' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'x-source-type: body' \
--data-raw 'Hello\\nworld'
URL mode¶
curl -X POST 'https://api.apidatatools.com/json-unescape-api' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'x-source-type: url' \
--data-raw '{"url":"https://example.com/input.json"}'
File mode¶
curl -X POST 'https://api.apidatatools.com/json-unescape-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¶
Synchronous success responses include request_id and status. The remaining fields depend on whether the conversion returns data or a file.
For data-producing results, preview contains serialized JSON:
{
"request_id": "REQUEST_ID",
"status": "success",
"preview": "\"converted output\""
}
For file-producing results, the response also includes file, a temporary download URL:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_KEY",
"preview": "Output preview"
}
URL and file modes¶
These modes return HTTP 202 Accepted when a job is created:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Async job status¶
Retrieve a job’s status with:
GET https://api.apidatatools.com/jobs/{job_id}
Include x-api-key on this request as well. Status responses include request_id, job_id, status, created_at, and updated_at. The timestamps are integers.
Queued or processing¶
Queued and processing jobs include a message and retry interval:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 1760000000,
"updated_at": 1760000000,
"message": "Your job is being processed.",
"retry_after": 2
}
The same shape applies when status is processing.
Success¶
A successful job includes result, containing the job result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1760000000,
"updated_at": 1760000002,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_KEY",
"preview": "Output preview"
}
}
Failed¶
A failed job includes an error object:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1760000000,
"updated_at": 1760000002,
"error": {
"code": "DOWNLOAD_FAILED",
"message": "Error connecting to URL",
"details": {
"message": "Error connecting to URL"
}
}
}
The error code and message depend on the job failure.
Error handling¶
Errors use this envelope; details may include additional fields:
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Description of the error"
}
}
The following HTTP statuses are defined for errors:
| 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; conversion errors; and status-request errors INVALID_JOB_ID, DDB_ERROR, 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 |
For asynchronous jobs, INVALID_JOB, DOWNLOAD_FAILED, and UPLOAD_FAILED can appear as failure codes in the job status response.
Notes¶
- Request-body and file-size limits, quotas, and rate limits depend on your plan. See tool limits.
- Download URLs are temporary; file retention depends on your plan.