XML Validator API¶
Overview¶
The XML Validator API accepts XML text for synchronous processing, or an input file supplied by URL or pre-uploaded file reference for asynchronous processing.
Endpoint¶
POST https://api.apidatatools.com/xml-validator-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 | Synchronous. Send the XML content as raw text. This is the default mode. |
url | Asynchronous. Send a JSON object containing the input URL. |
file | Asynchronous. Send a JSON object containing the exact storage key returned by the upload workflow. |
Headers¶
Header names are case-insensitive. The lowercase spellings below are documented.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | No default | 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¶
URL and file inputs must use one of these extensions: .txt, .xml, or .log.
Request body¶
For body mode, send raw XML text.
For url mode, send a JSON object with a url string, for example {"url":"https://example.com/input.xml"}.
For file mode, send a JSON object with a file string containing the exact storage key associated with an upload, for example {"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}. Do not add a prefix to the key.
curl examples¶
Body mode¶
curl -X POST "https://api.apidatatools.com/xml-validator-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: body" \
--data-raw '<root><item>Example</item></root>'
URL mode¶
curl -X POST "https://api.apidatatools.com/xml-validator-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-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 request returns HTTP 200 with request_id and status: "success". The response also includes preview. For a data-producing success, preview is serialized JSON. For a file-producing success, the response also includes file, a download URL.
URL and file requests return HTTP 202 with:
| Field | Description |
|---|---|
status | "accepted" |
job_id | Identifier for the asynchronous job. |
status_url | URL for checking the job status. |
request_id | Identifier for the request. |
Download URLs are temporary. File retention depends on your plan.
Async job status¶
Check a job with:
GET https://api.apidatatools.com/jobs/{job_id}
Include the same x-api-key header used to submit the job.
A successful status lookup returns the job’s request_id, job_id, status, created_at, and updated_at. The timestamps are Unix epoch seconds. The remaining fields depend on the job state:
| Job state | Additional response fields |
|---|---|
queued | message: "Your job is being processed."; retry_after: 2 |
processing | message: "Your job is being processed."; retry_after: 2 |
success | result, containing status: "success", file (download URL), and preview |
failed | error, containing code, message, and details |
Error handling¶
Error responses use status: "error", an error code, a request_id, and details.message. Additional fields may appear in details.
The following HTTP statuses 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, INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR, and tool-specific execution errors |
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 |
Asynchronous jobs can also end in a failed state with codes such as INVALID_JOB, DOWNLOAD_FAILED, or UPLOAD_FAILED. These are job failure codes, not additional HTTP statuses for the job-status response.
Notes¶
- Request-body size, input-file size, quota, rate limits, and download retention depend on your plan. See API tool limits.
- URL and file modes run asynchronously; body mode runs synchronously.