XML to Excel API¶
Overview¶
Convert XML input to an Excel file. Body mode processes the XML synchronously. URL and file modes submit an asynchronous job.
Endpoint¶
POST https://api.apidatatools.com/xml-to-excel-api
Authentication¶
Include your API key in the x-api-key header.
Input modes¶
| Mode | Behavior |
|---|---|
body | Sends raw XML text for synchronous conversion. This is the default. |
url | Submits a URL to an asynchronous conversion job. |
file | Submits a pre-uploaded file reference to an asynchronous conversion job. |
Headers¶
| 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. Header names are case-insensitive. |
Accepted file extensions¶
URL and file modes accept these extensions:
.txt.xml.log
Request body¶
Body mode¶
Send the XML document as raw text. The request body must not be empty. Body-size limits depend on your plan.
URL mode¶
Send a JSON object containing the input URL:
{
"url": "https://example.com/input.xml"
}
File mode¶
Send a JSON object containing 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/xml-to-excel-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: body" \
--data-raw '<root><item>Example</item></root>'
URL mode¶
curl -X POST "https://api.apidatatools.com/xml-to-excel-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
--data-raw '{"url":"https://example.com/input.xml"}'
File mode¶
curl -X POST "https://api.apidatatools.com/xml-to-excel-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 conversion returns HTTP 200 with a file URL and preview:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "PREVIEW"
}
The download URL is temporary; retention depends on your plan.
URL and file modes¶
A successfully accepted job 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 a submitted job with:
GET https://api.apidatatools.com/jobs/{job_id}
Include your API key in the x-api-key header. The status response includes request_id, job_id, status, created_at, and updated_at. The status-specific fields are:
Queued or processing¶
{
"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
}
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": 0,
"updated_at": 0,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "PREVIEW"
}
}
The result’s download URL is temporary; retention depends on your 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": {}
}
}
The details object may contain additional error information.
Example status request:
curl "https://api.apidatatools.com/jobs/JOB_ID" \
-H "x-api-key: YOUR_API_KEY"
Error handling¶
Errors use this envelope. Additional fields may be included in details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
| HTTP status | Error codes | When it applies |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY | The source type is unsupported, body decoding fails, or the request body is empty. |
400 | INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION | An asynchronous request body or input URL/file is invalid or unavailable. |
400 | INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | A job status request has a missing or unavailable job ID, or access to the job is denied. |
400 | Converter-specific errors | The converter rejects the input. |
401 | UNAUTHORIZED | Authentication context is missing or invalid. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | The authenticated user or requested endpoint is not found. |
413 | PAYLOAD_TOO_LARGE, FILE_TOO_LARGE | The request body or input file exceeds the applicable plan limit. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | The plan’s quota or rate limit has been reached. |
500 | PLAN_NOT_FOUND, CONFIG_ERROR, PLAN_CONFIG_ERROR, INTERNAL_ERROR | Plan configuration is unavailable, asynchronous job configuration is incomplete, or processing fails. |
Asynchronous jobs can also finish with errors such as INVALID_JOB, DOWNLOAD_FAILED, or UPLOAD_FAILED. These appear in the job’s failed status response rather than as the initial submission’s HTTP status.
Notes¶
- Body-size, file-size, quota, rate, and download-retention limits depend on your plan. See tool limits.
- URL and file modes are asynchronous. Use the returned
status_urlto check job progress. - Download URLs are temporary, and file retention depends on your plan.