YAML Validator API¶
Overview¶
Validate YAML content synchronously, or submit a URL or pre-uploaded file for asynchronous processing.
Endpoint¶
POST https://api.apidatatools.com/yaml-validator-api
Authentication¶
Include your API key in the x-api-key header with every request.
Input modes¶
- body — Send YAML text in the request body. This mode is synchronous.
- url — Submit a URL to a YAML file. This mode is asynchronous.
- file — Submit the exact storage key returned by the upload workflow. This mode is asynchronous.
Headers¶
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | string | Yes | — | Your API key. |
x-source-type | string | No | body; body, url, or file | Selects the input mode. Header names are case-insensitive. |
Accepted file extensions¶
URL and file inputs must use one of these extensions:
.yml, .yaml, .txt, .log
Request body¶
For body mode, send raw YAML text. For example:
name: Ada
active: true
For url mode, send a JSON object containing the URL:
{"url":"https://example.com/input.yaml"}
For file mode, send a JSON object containing the exact storage key returned by the upload workflow:
{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}
curl examples¶
Body mode¶
curl -X POST "https://api.apidatatools.com/yaml-validator-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: body" \
--data-raw $'name: Ada\nactive: true\n'
URL mode¶
curl -X POST "https://api.apidatatools.com/yaml-validator-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
-H "Content-Type: application/json" \
--data '{"url":"https://example.com/input.yaml"}'
File mode¶
curl -X POST "https://api.apidatatools.com/yaml-validator-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: file" \
-H "Content-Type: application/json" \
--data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous requests return HTTP 200. The response includes request_id, status, and preview. For data-producing results, preview is serialized JSON.
{
"request_id": "REQUEST_ID",
"status": "success",
"preview": "SERIALIZED_JSON"
}
If a synchronous result is file-producing, the response includes file as well:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "PREVIEW"
}
URL and file requests return HTTP 202 when the job is accepted:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Async job status¶
Poll the job using the returned job_id:
GET https://api.apidatatools.com/jobs/{job_id}
Include x-api-key on the status request. The status response includes request_id, job_id, status, created_at, and updated_at.
Queued and processing jobs include a 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
}
The same shape applies when status is processing.
Successful jobs include result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1700000000,
"updated_at": 1700000002,
"result": {
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "PREVIEW"
}
}
Failed jobs include error:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1700000000,
"updated_at": 1700000002,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {
"message": "Error message"
}
}
}
Error handling¶
Error responses use this envelope. Additional fields may appear inside details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Description of the error"
}
}
The following HTTP statuses are defined by the request and status handlers:
| HTTP status | Error codes | When it can occur |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY | Invalid input mode, body encoding, or empty request body. |
400 | INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION | Invalid asynchronous request body, URL, file reference, or file extension; or an inaccessible URL or file. |
400 | Tool-specific validation errors, INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | Tool validation failure or an error looking up or accessing a job. |
401 | UNAUTHORIZED | Authentication context is missing or invalid. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | User or endpoint not found. |
413 | PAYLOAD_TOO_LARGE, FILE_TOO_LARGE | Body or input file exceeds the applicable limit. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | Plan quota or rate limit exceeded. |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR, CONFIG_ERROR, PLAN_CONFIG_ERROR | Plan, service configuration, or processing error. |
Asynchronous worker failures such as DOWNLOAD_FAILED and UPLOAD_FAILED appear as error codes in a failed job’s status response; they are not HTTP statuses for the original accepted request.
Notes¶
- Body mode is synchronous. URL and file modes are asynchronous.
- Body-size, file-size, quota, rate, and output-retention limits depend on your plan. See Tool limits.
- Download URLs are temporary, and retention depends on your plan.