Skip to content

YAML to XML API

Overview

Convert YAML input to XML. Body mode processes the YAML synchronously. URL and pre-uploaded file modes create an asynchronous job.

Endpoint

POST https://api.apidatatools.com/yaml-to-xml-api

Authentication

Include your API key in the x-api-key header on every request:

x-api-key: YOUR_API_KEY

Input modes

Mode Description Processing
body Send YAML text in the request body. Synchronous
url Provide a URL to a YAML file. Asynchronous
file Provide the storage key for a previously uploaded file. Asynchronous

Headers

Header names are case-insensitive. The documented lowercase spelling is shown below.

Header Type Required Default / values Description
x-api-key String Yes Your API key Authenticates the request.
x-source-type String No Default: body. Values: body, url, file Selects the input mode.

Accepted file extensions

URL and file modes accept files with these extensions:

.yml, .yaml, .txt, .log

Request body

Body mode

Send raw YAML text as the request body. The body must not be empty.

URL mode

Send a JSON object with a url property:

{
  "url": "https://example.com/input.yaml"
}

The URL must be reachable over HTTP or HTTPS and have an accepted file extension.

File mode

Send a JSON object with a file property. Its value must be the exact storage key returned by your upload workflow.

{
  "file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}

curl examples

Body mode

curl -X POST 'https://api.apidatatools.com/yaml-to-xml-api' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-source-type: body' \
  --data-raw $'name: Ada\nactive: true'

URL mode

curl -X POST 'https://api.apidatatools.com/yaml-to-xml-api' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-source-type: url' \
  --data-raw '{"url":"https://example.com/input.yaml"}'

File mode

curl -X POST 'https://api.apidatatools.com/yaml-to-xml-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 success

Body mode returns HTTP 200. The response includes the request ID, success status, an output file URL, and a preview.

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "https://downloads.apidatatools.com/OUTPUT_FILE",
  "preview": "..."
}

The download URL is temporary; its retention period depends on your plan.

Asynchronous job accepted

URL and file modes return HTTP 202 with a job ID and a URL for checking the job status.

{
  "status": "accepted",
  "job_id": "JOB_ID",
  "status_url": "https://api.apidatatools.com/jobs/JOB_ID",
  "request_id": "REQUEST_ID"
}

Async job status

Check a job with:

GET https://api.apidatatools.com/jobs/{job_id}

Include your API key with the request:

curl 'https://api.apidatatools.com/jobs/JOB_ID' \
  -H 'x-api-key: YOUR_API_KEY'

The status endpoint returns HTTP 200 for the job states below.

Queued or processing

Both states include a message and retry_after value:

{
  "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
}

For a processing job, status is "processing"; the other fields have the same shape.

Success

{
  "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

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "failed",
  "created_at": 1700000000,
  "updated_at": 1700000001,
  "error": {
    "code": "ERROR_CODE",
    "message": "Error message",
    "details": {}
  }
}

The details object can contain additional error information.

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"
  }
}

HTTP errors

HTTP status Error code(s) When it applies
400 INVALID_SOURCE_TYPE x-source-type is not body, url, or file.
400 INVALID_BODY_ENCODING The request body cannot be decoded.
400 EMPTY_BODY The request body is empty.
400 INVALID_BODY An asynchronous-mode body is not valid JSON or is not a JSON object.
400 INVALID_URL The URL is missing, invalid, or not an allowed HTTP or HTTPS URL.
400 URL_UNREACHABLE The URL cannot be reached.
400 URL_NOT_OK The URL responds with a status other than 200 or 206.
400 INVALID_FILE The file key is missing or invalid.
400 FILE_UNAVAILABLE The referenced file cannot be accessed.
400 INVALID_FILE_EXTENSION The URL or file key does not have an accepted extension.
400 Tool validation errors The converter reports an input or conversion error. The error code and message depend on the error.
401 UNAUTHORIZED Authentication context is missing or invalid.
404 USER_NOT_FOUND, UNKNOWN_FUNCTION The authenticated user or requested API endpoint was not found.
413 PAYLOAD_TOO_LARGE The body exceeds the limit for the applicable plan.
413 FILE_TOO_LARGE The remote or uploaded file exceeds the applicable file limit.
429 QUOTA_EXCEEDED, RATE_LIMITED The plan quota is exhausted or the request rate limit is exceeded.
500 PLAN_NOT_FOUND, INTERNAL_ERROR, CONFIG_ERROR, PLAN_CONFIG_ERROR Plan configuration, asynchronous job configuration, or request processing failed.

The status endpoint reports job lookup and access errors using the same error envelope. Its implementation returns HTTP 400 for these tool errors: INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR.

Asynchronous job failures can include INVALID_JOB, DOWNLOAD_FAILED, UPLOAD_FAILED, FILE_TOO_LARGE, or INTERNAL_ERROR. These appear in the job’s error object when the job status is failed.

Notes

  • Body-size, file-size, quota, rate, and download-retention limits depend on your plan. See Tool limits.
  • Download URLs are temporary, and their retention period depends on your plan.
  • URL and file modes require an accepted file extension and return an asynchronous job response.