Skip to content

YAML Minify API

Overview

The YAML Minify API accepts YAML text and returns a minified result. Use body mode for synchronous processing, or URL and file modes to submit an asynchronous job.

Endpoint

POST https://api.apidatatools.com/yaml-minify-api

Authentication

Include your API key in the x-api-key header with every request.

Input modes

Mode Behavior
body Synchronous processing of raw YAML text. This is the default mode.
url Asynchronous processing of a file at a URL.
file Asynchronous processing of a previously uploaded file.

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; body, url, or file Selects the input mode.

Accepted file extensions

URL and file mode accept these extensions:

  • .yml
  • .yaml
  • .txt
  • .log

Request body

Body mode

Send the YAML document as raw text in the request body. Do not wrap it in JSON.

URL mode

Send a JSON object with a url property:

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

File mode

Send a JSON object with a file property containing the exact storage key associated with a file uploaded through the upload workflow:

{
  "file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}

curl examples

Body mode

curl -X POST "https://api.apidatatools.com/yaml-minify-api" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-source-type: body" \
  --data-binary @- <<'YAML'
name: example
enabled: true
YAML

URL mode

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

File mode

curl -X POST "https://api.apidatatools.com/yaml-minify-api" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-source-type: file" \
  -d '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'

Success responses

Synchronous body mode

A successful body-mode response is HTTP 200. The response includes request_id, status, and preview. The preview is serialized JSON.

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "preview": "..."
}

When the result is returned as a file, the response also includes file, a temporary download URL:

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

Asynchronous URL and file modes

A successful job submission returns HTTP 202:

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

Async job status

Check an asynchronous job with:

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

Include x-api-key with the request. The status response includes request_id, job_id, status, created_at, and updated_at. Timestamps are Unix timestamps.

Queued or processing

For queued and processing jobs, the response also includes message and retry_after:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "queued",
  "created_at": 1710000000,
  "updated_at": 1710000000,
  "message": "Your job is being processed.",
  "retry_after": 2
}

The same shape applies when status is processing.

Success

A completed job includes result, containing the job result:

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 1710000000,
  "updated_at": 1710000002,
  "result": {
    "status": "success",
    "file": "https://downloads.apidatatools.com/...",
    "preview": "..."
  }
}

Failed

A failed job includes an error object. Its details value contains the job error details:

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

Error handling

Error responses use this envelope:

{
  "status": "error",
  "error": "ERROR_CODE",
  "request_id": "REQUEST_ID",
  "details": {
    "message": "Error message"
  }
}

Additional fields may be included in details.

Request and authentication errors

HTTP status Error code Meaning
401 UNAUTHORIZED Authentication context is missing or invalid.
404 USER_NOT_FOUND The authenticated user could not be found.
500 PLAN_NOT_FOUND The user’s plan configuration could not be found.
429 QUOTA_EXCEEDED The plan’s request quota has been exhausted.
429 RATE_LIMITED The request rate limit has been exceeded.
400 INVALID_SOURCE_TYPE x-source-type is not body, url, or file.
400 INVALID_BODY_ENCODING The request body could not be decoded.
400 EMPTY_BODY The request body is empty.
413 PAYLOAD_TOO_LARGE The body exceeds the size limit for the plan.
404 UNKNOWN_FUNCTION The endpoint is not supported.
500 INTERNAL_ERROR The request could not be processed.

URL and file submission errors

HTTP status Error code Meaning
500 CONFIG_ERROR Asynchronous job submission is unavailable due to a configuration issue.
400 INVALID_BODY The body must be a valid JSON object.
500 PLAN_CONFIG_ERROR The plan’s file-size limit configuration is invalid.
400 INVALID_URL The URL is missing, invalid, or not an allowed HTTP(S) URL.
400 URL_UNREACHABLE The URL could not be reached.
400 URL_NOT_OK The URL returned a status other than 200 or 206.
400 INVALID_FILE The file reference is missing or invalid.
400 FILE_UNAVAILABLE The referenced uploaded file could not be accessed.
413 FILE_TOO_LARGE The file exceeds the applicable plan limit.
400 INVALID_FILE_EXTENSION The file extension is unsupported for this API.

Job status and processing errors

Errors from the job-status endpoint, including INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR, are returned as HTTP 400 by the status API.

Processing errors such as INVALID_JOB, DOWNLOAD_FAILED, and UPLOAD_FAILED can appear as error codes in a job’s failed status response. They describe the job outcome, not the HTTP status of the original submission. A failed job can also report FILE_TOO_LARGE or INTERNAL_ERROR.

Notes

  • Body mode is synchronous; URL and file modes are asynchronous.
  • Body-size and file-size limits depend on your plan. See API tool limits.
  • Download URLs are temporary. File retention depends on your plan; see API tool limits.
  • In file mode, use the exact storage key returned by the upload workflow.