Skip to content

YAML to Base64 API

Overview

Convert YAML text to Base64 using a synchronous request, or submit a URL or pre-uploaded file for asynchronous processing.

Endpoint

Method URL
POST https://api.apidatatools.com/yaml-to-base64-api

Authentication

Send your API key in the x-api-key header.

Input modes

Select a mode with x-source-type:

  • body — Send YAML text directly. This is the default and runs synchronously.
  • url — Send a URL in a JSON body. The request runs asynchronously.
  • file — Send a pre-uploaded file’s storage key in a JSON body. The request runs asynchronously.

Headers

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. Header names are case-insensitive.

Accepted file extensions

For URL and file modes, the input file must use one of these extensions:

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

Request body

Body mode

Send raw YAML text as the request body.

URL mode

Send a JSON object with a url field:

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

File mode

Send a JSON object with a file field. Its value must be 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-to-base64-api' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'x-source-type: body' \
  --data 'name: Ada
language: YAML'

URL mode

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

File mode

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

Success responses

Synchronous body mode

A successful synchronous response includes request_id, status, and preview. The preview for a data-producing response is serialized JSON:

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

If the synchronous result is returned as a file, the response includes file as well:

{
  "request_id": "REQUEST_ID",
  "status": "success",
  "file": "TEMPORARY_DOWNLOAD_URL",
  "preview": "PREVIEW"
}

Download URLs are temporary; retention depends on your plan.

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

Async job status

Check an asynchronous job with:

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. Timestamps are Unix timestamps.

For queued and processing jobs, the response also includes:

{
  "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 status value is either queued or processing.

A successful job includes its 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"
  }
}

A failed job includes an error object:

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

Error handling

Error responses use this envelope. details may contain additional fields.

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

The following HTTP statuses are defined for request and status-check errors:

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

Conversion errors are returned with HTTP 400; their error codes depend on the conversion error. For asynchronous jobs, DOWNLOAD_FAILED, UPLOAD_FAILED, INVALID_JOB, FILE_TOO_LARGE, and other processing failures are reported in the job’s failed status response rather than as the original request’s HTTP status.

Notes

  • Body mode is synchronous. URL and file modes are asynchronous.
  • Request-body, file-size, quota, rate, and retention limits depend on your plan. See tool limits.
  • Download URLs are temporary, and their retention period depends on your plan.