YAML to CSV API¶
Overview¶
Convert YAML input to CSV. Body mode processes the input synchronously; URL and pre-uploaded file modes create asynchronous jobs.
Endpoint¶
POST https://api.apidatatools.com/yaml-to-csv-api
Authentication¶
Include your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Input modes¶
| Mode | Processing | Input |
|---|---|---|
body | Synchronous | Raw YAML text in the request body |
url | Asynchronous | JSON object containing a URL to the input file |
file | Asynchronous | JSON object containing the exact storage key returned by the upload workflow |
Headers¶
Header names are case-insensitive. The lowercase spellings below are the documented forms.
| 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 modes accept input files with these extensions:
.yml.yaml.txt.log
Request body¶
Body mode¶
Send raw YAML text as the request body. This mode is synchronous.
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 identify a file with an accepted extension.
File mode¶
Send a JSON object with a file property. Its value must be the exact storage key associated with a file uploaded through the upload workflow.
{
"file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}
curl examples¶
Replace YOUR_API_KEY with your API key. For URL mode, replace the example URL with a reachable file URL.
Body mode¶
curl -X POST 'https://api.apidatatools.com/yaml-to-csv-api' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'x-source-type: body' \
--data-raw 'name: Ada
role: engineer'
URL mode¶
curl -X POST 'https://api.apidatatools.com/yaml-to-csv-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-csv-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 body mode¶
A successful synchronous response returns HTTP 200 and includes request_id, status, file, and preview.
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "CSV preview"
}
Asynchronous URL and file modes¶
A successfully accepted asynchronous request returns HTTP 202:
{
"status": "accepted",
"job_id": "JOB_ID",
"status_url": "https://api.apidatatools.com/jobs/JOB_ID",
"request_id": "REQUEST_ID"
}
Acceptance means the job was queued; check its status endpoint for completion.
Async job status¶
Poll GET https://api.apidatatools.com/jobs/{job_id} using the same API key authentication:
curl -X GET 'https://api.apidatatools.com/jobs/JOB_ID' \
-H 'x-api-key: YOUR_API_KEY'
The status response includes request_id, job_id, status, created_at, and updated_at. The timestamps are Unix epoch seconds. The response fields depend on the job state:
Queued or processing:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 1760000000,
"updated_at": 1760000000,
"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": 1760000000,
"updated_at": 1760000002,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "CSV preview"
}
}
Failed:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1760000000,
"updated_at": 1760000002,
"error": {
"code": "ERROR_CODE",
"message": "Description of the failure",
"details": {}
}
}
The error details may contain additional information.
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 grounded in the request and status handlers:
| HTTP status | Error codes | Applies to |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION | Invalid request input or URL/file validation failure. |
400 | INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | Job status request errors. |
401 | UNAUTHORIZED | Authentication failure. |
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, CONFIG_ERROR, PLAN_CONFIG_ERROR, INTERNAL_ERROR | Plan configuration, service configuration, or processing failure. |
Asynchronous jobs can also fail with INVALID_JOB, DOWNLOAD_FAILED, or UPLOAD_FAILED. These codes appear in the failed job’s status response; they are job outcomes rather than HTTP statuses for the initial 202 response.
Notes¶
- Body-size, file-size, quota, rate, and output-retention limits depend on your plan. See tool limits.
- Output download URLs are temporary. Their retention period depends on your plan.