JSON Validator API¶
Overview¶
Validates JSON input. Body mode processes the request synchronously; URL and file modes create an asynchronous job.
Endpoint¶
| Method | URL |
|---|---|
POST | https://api.apidatatools.com/json-validator-api |
Authentication¶
Include your API key in the x-api-key header with every request.
Input modes¶
| Mode | Behavior |
|---|---|
body | Synchronous. This is the default mode. |
url | Asynchronous. Submits a URL for processing and returns a job ID. |
file | Asynchronous. Submits a previously uploaded file reference and returns a job ID. |
Headers¶
Header names are case-insensitive. The lowercase spellings below are used in examples.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | Your API key | Authenticates the request. |
x-source-type | String | No | body; supported 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
File-size limits depend on your plan. See tool limits.
Request body¶
Body mode¶
Send non-empty JSON text as the raw request body. The body is processed synchronously. Body-size limits depend on your plan; see tool limits.
URL mode¶
Send a JSON object with a url string. The URL must be reachable over HTTP or HTTPS and use an accepted file extension.
{
"url": "https://example.com/input.json"
}
File mode¶
Send a JSON object with a file string containing the exact storage key returned by the upload workflow. Do not add a prefix to the key.
{
"file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}
curl examples¶
Body mode¶
curl -X POST "https://api.apidatatools.com/json-validator-api" \
-H "x-api-key: YOUR_API_KEY" \
--data-raw '{"name":"Ada","active":true}'
URL mode¶
curl -X POST "https://api.apidatatools.com/json-validator-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-validator-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¶
A synchronous success returns HTTP 200. The response includes request_id and status: "success". The converter’s result is returned in one of these forms:
- Data-producing result: includes
preview, a string containing serialized JSON. - File-producing result: includes
file, a temporary download URL, andpreview.
URL and file modes return HTTP 202 with the asynchronous job fields shown below.
Async job status¶
URL and file requests return an acceptance response with this shape:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Retrieve the job status with:
curl "https://api.apidatatools.com/jobs/JOB_ID" \
-H "x-api-key: YOUR_API_KEY"
The status endpoint returns the job ID, request ID, status, and timestamps. For queued and processing jobs, it also returns a message and retry_after:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 0,
"updated_at": 0,
"message": "Your job is being processed.",
"retry_after": 2
}
The processing response has the same shape, with "status": "processing".
A successful job includes its result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 0,
"updated_at": 0,
"result": {
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "PREVIEW"
}
}
A failed job includes an error object:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 0,
"updated_at": 0,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {
"message": "Error message"
}
}
}
The examples show response shapes; timestamp values and job identifiers are assigned at runtime. Job result download URLs are temporary, and retention depends on your plan.
Error handling¶
HTTP errors use an envelope containing status, error, request_id, and details.message. Additional fields may appear in details.
| HTTP status | Error codes | When it applies |
|---|---|---|
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, INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | Invalid input or source type; URL/file problems; or a job-status lookup error. |
401 | UNAUTHORIZED | Missing authorization context. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | User or endpoint not found. |
413 | PAYLOAD_TOO_LARGE, FILE_TOO_LARGE | Request body or input file exceeds the applicable plan limit. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | Plan quota or rate limit exceeded. |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR, CONFIG_ERROR, PLAN_CONFIG_ERROR | Plan configuration or processing error. |
The asynchronous job-creation errors INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, FILE_TOO_LARGE, and INVALID_FILE_EXTENSION are returned in the standard error envelope. Errors that occur while processing a job are reported by the status endpoint as a failed job.
Notes¶
- Body mode is synchronous; URL and file modes are asynchronous.
- Body-size and file-size limits depend on your plan. See tool limits.
- Download URLs are temporary. Retention depends on your plan.