Skip to content

Base64 to XML API

Overview

Decode Base64-encoded XML and validate the resulting XML document. The body mode runs synchronously; URL and pre-uploaded file modes run asynchronously.

Endpoint

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

Authentication

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

Input modes

Select a mode with x-source-type:

  • body — Send Base64-encoded XML as raw text. This is the default and runs synchronously.
  • url — Submit a JSON body containing a URL to a .txt or .log file. This runs asynchronously.
  • file — Submit a JSON body containing the exact storage key returned by the upload workflow. This runs asynchronously.

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 Your API key Authenticates the request.
x-source-type String No Default: body. Values: body, url, file Selects the input mode.
x-record-path String No Not used by this endpoint Has no effect on Base64-to-XML conversion.
x-root-name String No Not used by this endpoint Has no effect; this endpoint does not rewrite the XML.
x-tab-space String No Not used by this endpoint Has no effect; this endpoint does not format the XML.

Accepted file extensions

For URL and file modes, the accepted extensions are .txt and .log.

Request body

Body mode

Send the Base64-encoded XML document as raw text. The decoded content must be valid XML.

URL mode

Send a JSON object with a url value:

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

The URL must point to a file with an accepted extension.

File mode

Send a JSON object with a file value containing the exact storage key associated with the uploaded file:

{
  "file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}

Do not add a prefix to the storage key.

curl examples

Body mode

curl --request POST \
  'https://api.apidatatools.com/base64-to-xml-api' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-source-type: body' \
  --header 'Content-Type: text/plain' \
  --data 'PHJvb3QvPg=='

URL mode

curl --request POST \
  'https://api.apidatatools.com/base64-to-xml-api' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-source-type: url' \
  --header 'Content-Type: application/json' \
  --data '{"url":"https://example.com/input.txt"}'

The file’s contents should be Base64-encoded XML.

File mode

curl --request POST \
  'https://api.apidatatools.com/base64-to-xml-api' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'x-source-type: file' \
  --header 'Content-Type: application/json' \
  --data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'

The uploaded file’s contents should be Base64-encoded XML.

Success responses

Synchronous body mode

A successful file-producing request returns HTTP 200:

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

file is a temporary download URL. Its availability period depends on the plan.

Asynchronous URL and file modes

A successfully accepted 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; it does not mean conversion has completed.

Async job status

Poll the status URL returned when the job is accepted:

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

Authenticate the request with x-api-key. For example:

JOB_ID='JOB_ID'

curl --request GET \
  "https://api.apidatatools.com/jobs/${JOB_ID}" \
  --header 'x-api-key: YOUR_API_KEY'

The status response includes request_id, job_id, status, created_at, and updated_at. The timestamps are Unix timestamps in seconds.

Queued

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

Processing

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

Success

{
  "request_id": "REQUEST_ID",
  "job_id": "JOB_ID",
  "status": "success",
  "created_at": 0,
  "updated_at": 0,
  "result": {
    "status": "success",
    "file": "TEMPORARY_DOWNLOAD_URL",
    "preview": "Decoded XML preview"
  }
}

The result’s download URL is temporary; retention depends on the plan.

Failed

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

The error.details object may contain additional error details.

Error handling

Errors use this envelope:

{
  "status": "error",
  "error": "ERROR_CODE",
  "request_id": "REQUEST_ID",
  "details": {
    "message": "Description of the error"
  }
}

Additional fields may appear in details. For synchronous conversion errors and status endpoint tool errors, the HTTP status is 400. Authentication, request validation, and async submission errors use the statuses listed below.

HTTP status Error codes and circumstances
400 INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY, BASE64_DECODE_FAILED, INVALID_XML, XML_DTD_FORBIDDEN; async submission errors INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION; status endpoint errors INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR.
401 UNAUTHORIZED — authentication failed or required authorization context is missing.
404 UNKNOWN_FUNCTION, USER_NOT_FOUND.
413 PAYLOAD_TOO_LARGE for body mode, or FILE_TOO_LARGE for URL/file mode. Applicable size limits depend on the plan.
429 QUOTA_EXCEEDED, RATE_LIMITED.
500 PLAN_NOT_FOUND, INTERNAL_ERROR; async submission errors CONFIG_ERROR, PLAN_CONFIG_ERROR.

URL/file jobs can also fail after acceptance. Examples include DOWNLOAD_FAILED and UPLOAD_FAILED; these appear in the failed job’s status response rather than as an error response to the original 202 request. Limits and retention are plan-dependent; see tool limits.

Notes

  • Body mode expects text containing Base64, not binary XML. The decoded content is validated as XML; this endpoint does not format or rewrite it.
  • Body-size and file-size limits depend on the plan. See tool limits.
  • Async download URLs are temporary, and their retention period depends on the plan.