Excel to JSON API¶
Overview¶
Convert an Excel workbook to JSON. Body mode processes the workbook synchronously. URL and file modes submit an asynchronous job.
Endpoint¶
| Method | URL |
|---|---|
POST | https://api.apidatatools.com/excel-to-json-api |
Authentication¶
Include your API key in the x-api-key header with every request.
Input modes¶
| Mode | Description | Processing |
|---|---|---|
body | Send the Excel workbook as the raw request body. | Synchronous |
url | Provide a URL to an Excel workbook. | Asynchronous |
file | Provide a pre-uploaded file’s storage key. | Asynchronous |
Headers¶
Header names are case-insensitive. Use the lowercase spellings shown here.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | string | Yes | — | Your API key. |
x-source-type | string | No | Default: body. Values: body, url, file. Selects the input mode. |
Accepted file extensions¶
URL and file modes accept .xls and .xlsx files.
Request body¶
Body mode¶
Send the workbook as binary request-body data. Use curl --data-binary to preserve the file bytes.
URL mode¶
Send a JSON object with a url field containing the workbook’s HTTP or HTTPS URL:
{
"url": "https://example.com/input.xlsx"
}
File mode¶
Send a JSON object with a file field containing the exact storage key returned by the upload workflow:
{
"file": "S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"
}
curl examples¶
Body mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-json-api \
--header 'x-api-key: YOUR_API_KEY' \
--data-binary @input.xlsx
URL mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-json-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: url' \
--data '{"url":"https://example.com/input.xlsx"}'
File mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-json-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 response has HTTP status 200. The preview value is serialized JSON.
{
"request_id": "REQUEST_ID",
"status": "success",
"preview": "SERIALIZED_JSON"
}
Asynchronous URL and file modes¶
A successful job submission has HTTP status 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:
curl --request GET \
--url https://api.apidatatools.com/jobs/JOB_ID \
--header 'x-api-key: YOUR_API_KEY'
The status endpoint returns the job’s request_id, job_id, status, created_at, and updated_at. The response also includes state-specific fields.
Queued or processing¶
For either queued or processing, the response 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 queued or processing, according to the job’s current state.
Success¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1700000000,
"updated_at": 1700000001,
"result": {
"status": "success",
"file": "TEMPORARY_DOWNLOAD_URL",
"preview": "PREVIEW"
}
}
Failed¶
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1700000000,
"updated_at": 1700000001,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {}
}
}
Error handling¶
Errors use this envelope. Additional fields may appear inside details.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Error message"
}
}
HTTP errors¶
| HTTP status | Error codes | Applies to |
|---|---|---|
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 mode, body, URL, or file input. |
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 or server error. |
Job-status lookup errors INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, and DDB_ERROR are returned with HTTP 400 by the status endpoint.
Asynchronous processing errors such as DOWNLOAD_FAILED, UPLOAD_FAILED, and INVALID_JOB are reported in the job’s failed status response. Check the job status endpoint for the error code and message.
Notes¶
- Body-size, file-size, quota, rate, and download-retention limits depend on your plan. See tool limits.
- Download URLs are temporary; retention depends on your plan.
- URL and file requests are asynchronous; poll the returned
status_urlto check progress and retrieve the result.