Excel to CSV API¶
Overview¶
Convert an Excel workbook to CSV. Body mode processes the workbook synchronously; URL and file modes submit an asynchronous job.
Endpoint¶
POST https://api.apidatatools.com/excel-to-csv-api
Authentication¶
Include your API key in the x-api-key header on every request.
Input modes¶
| Mode | Description |
|---|---|
body | Send the Excel workbook as a binary request body. This mode is synchronous and is the default. |
url | Submit a URL to an Excel workbook for asynchronous processing. |
file | Submit a pre-uploaded file reference for asynchronous processing. |
Headers¶
Header names are case-insensitive. The spellings shown here are lowercase.
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | None | API key used to authenticate the request. |
x-source-type | String | No | body; body, url, or file | Selects the input mode. |
Accepted file extensions¶
URL and file mode accept Excel files with the .xls or .xlsx extension.
Request body¶
Body mode¶
Send the workbook’s binary contents as the request body. Use curl --data-binary to preserve the file bytes.
URL mode¶
Send a JSON object with a url property containing the workbook URL:
{
"url": "https://example.com/input.xlsx"
}
File mode¶
Send a JSON object with a file property 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-csv-api \
--header 'x-api-key: YOUR_API_KEY' \
--data-binary @input.xlsx
URL mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-csv-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: url' \
--data-binary '{"url":"https://example.com/input.xlsx"}'
File mode¶
curl --request POST \
--url https://api.apidatatools.com/excel-to-csv-api \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-source-type: file' \
--data-binary '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous body mode¶
A successful conversion returns HTTP 200 with request_id, status, file, and preview. The file value is a temporary download URL; the preview is a string.
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/TEMPORARY_FILE",
"preview": "CSV preview"
}
Asynchronous 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 an asynchronous 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. The timestamps are Unix timestamps.
Queued or processing¶
For queued and processing jobs, the response also includes message and retry_after:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "queued",
"created_at": 1710000000,
"updated_at": 1710000000,
"message": "Your job is being processed.",
"retry_after": 2
}
Success¶
A successful job includes result, containing the job’s success status, file URL, and preview:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1710000000,
"updated_at": 1710000002,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/TEMPORARY_FILE",
"preview": "CSV preview"
}
}
Failed¶
A failed job includes an error object with a code, message, and details:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1710000000,
"updated_at": 1710000002,
"error": {
"code": "DOWNLOAD_FAILED",
"message": "Unable to download the input file.",
"details": {}
}
}
Error handling¶
Error responses use this envelope. details may contain additional fields.
{
"status": "error",
"error": "ERROR_CODE",
"request_id": "REQUEST_ID",
"details": {
"message": "Description of the error."
}
}
HTTP errors¶
| HTTP status | Error codes | When it can occur |
|---|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY | The source type is unsupported, binary 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 reference is invalid, inaccessible, or has an unsupported extension. |
400 | Tool-specific errors | The converter rejects the input. |
400 | INVALID_JOB_ID, JOB_NOT_FOUND, FORBIDDEN, DDB_ERROR | The job status request has a missing or unknown job ID, the job belongs to another user, or the status lookup fails. |
401 | UNAUTHORIZED | Authentication information is missing or invalid. |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION | The authenticated user or requested API endpoint is not found. |
413 | PAYLOAD_TOO_LARGE | The synchronous request body exceeds the limit for the plan. |
413 | FILE_TOO_LARGE | An asynchronous input exceeds the applicable file-size limit. |
429 | QUOTA_EXCEEDED, RATE_LIMITED | The plan’s request quota or rate limit has been reached. |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR | Plan configuration is unavailable or request processing fails. |
500 | CONFIG_ERROR, PLAN_CONFIG_ERROR | Asynchronous job configuration or plan limits are unavailable. |
Asynchronous jobs can also fail with INVALID_JOB, DOWNLOAD_FAILED, or UPLOAD_FAILED. These appear in the job’s failed status response; they are job outcomes, not HTTP status codes for the initial job-creation response.
Notes¶
- Body mode accepts binary input; use
curl --data-binarywhen sending a workbook. - URL and file modes are asynchronous. Poll the returned
status_urlto check job progress and retrieve the result. - File download URLs are temporary. Retention, body-size, file-size, quota, and rate limits depend on your plan. See API plan limits.