Excel to XML API¶
Overview¶
Convert an Excel workbook to XML. Body mode processes the workbook synchronously. URL and file modes submit an asynchronous job.
Endpoint¶
POST https://api.apidatatools.com/excel-to-xml-api
Authentication¶
Include your API key in the x-api-key header.
Input modes¶
| Mode | Description |
|---|---|
body | Send the workbook as a binary request body. This is the default mode and runs synchronously. |
url | Submit a URL to a workbook for asynchronous processing. |
file | Submit a pre-uploaded workbook’s storage key for asynchronous processing. |
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 modes accept Excel files with the .xls or .xlsx extension.
Request body¶
- Body mode: Send the workbook’s binary contents as the request body.
- URL mode: Send a JSON object with a
urlproperty containing the workbook URL. - File mode: Send a JSON object with a
fileproperty containing the exact storage key returned by the upload workflow.
curl examples¶
Body mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-xml-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: body' \
--data-binary '@workbook.xlsx'
URL mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-xml-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: url' \
--data '{"url":"https://example.com/workbook.xlsx"}'
File mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-xml-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: file' \
--data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous body mode¶
A successful body-mode request returns HTTP 200 with a file URL and a preview:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "XML preview"
}
Asynchronous URL and file modes¶
A successfully submitted URL- or file-mode 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 a submitted 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.
For queued and processing jobs, the response also includes a message and retry interval:
{
"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 queued or processing as applicable.
For a successful job, the response includes result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1700000000,
"updated_at": 1700000001,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "XML preview"
}
}
For a failed job, the response includes error with a code, message, and details:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1700000000,
"updated_at": 1700000001,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {
"message": "Error message"
}
}
}
Error handling¶
Errors use this envelope. Additional properties may appear in details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
The following HTTP statuses are established by the request and status handlers:
| HTTP status | Error codes / conditions |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY; invalid URL or file input; invalid request body for URL/file mode; URL unreachable or URL response not accepted; invalid file extension; and tool execution errors. Status lookup tool errors—including INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR—also return 400. |
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; async setup or plan-configuration errors (CONFIG_ERROR, PLAN_CONFIG_ERROR) |
Asynchronous processing can also fail with codes such as INVALID_JOB, DOWNLOAD_FAILED, or UPLOAD_FAILED. These are reported in the failed job’s status response; they are not HTTP statuses for the original submission.
Notes¶
- Body-size limits, file-size limits, quota, rate limits, and output retention depend on your plan. See tool limits.
- Output download URLs are temporary; availability depends on your plan’s retention period.
- File mode requires the exact storage key associated with the uploaded file.