JSON to Excel API¶
Overview¶
Convert JSON input to an Excel file. Submit JSON directly for synchronous processing, or submit a URL or pre-uploaded file reference for asynchronous processing.
Endpoint¶
Method: POST
URL: https://api.apidatatools.com/json-to-excel-api
Authentication¶
Include your API key in the x-api-key header.
Input modes¶
| Mode | Processing | Description |
|---|---|---|
body | Synchronous | Send the JSON document as the raw request body. This is the default mode. |
url | Asynchronous | Submit a URL to a JSON file. |
file | Asynchronous | Submit the exact storage key associated with a file from the upload workflow. |
URL and file modes return a job ID. Poll the job status endpoint to check progress and retrieve the result.
Headers¶
| Header | Type | Required | Default / values | Description |
|---|---|---|---|---|
x-api-key | String | Yes | — | API key used to authenticate the request. |
x-source-type | String | No | body; body, url, or file | Selects the input mode. Header names are case-insensitive. |
Accepted file extensions¶
For URL and file modes, the input file must use one of these extensions:
.txt.json.log
Request body¶
Body mode¶
Send the JSON document itself as raw text. For example:
{"name":"Ada","score":98}
URL mode¶
Send a JSON object with a url field:
{"url":"https://example.com/data.json"}
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 -X POST "https://api.apidatatools.com/json-to-excel-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: body" \
--data '{"name":"Ada","score":98}'
URL mode¶
curl -X POST "https://api.apidatatools.com/json-to-excel-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: url" \
--data '{"url":"https://example.com/data.json"}'
File mode¶
curl -X POST "https://api.apidatatools.com/json-to-excel-api" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-source-type: file" \
--data '{"file":"S3_KEY_RETURNED_BY_THE_UPLOAD_WORKFLOW"}'
Success responses¶
Synchronous body mode¶
A successful conversion returns HTTP 200 with a file URL and a preview:
{
"request_id": "REQUEST_ID",
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "PREVIEW"
}
The download URL is temporary. File retention depends on your plan.
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¶
Poll the status URL returned when the job is accepted:
curl "https://api.apidatatools.com/jobs/JOB_ID" \
-H "x-api-key: YOUR_API_KEY"
The status response includes request_id, job_id, status, created_at, and updated_at. The timestamps are integers. The remaining fields depend on the job state.
Queued and processing¶
Both states include a 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
}
For an in-progress job, status is "processing"; the other fields have the same shape.
Success¶
A successful job includes its result:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "success",
"created_at": 1710000000,
"updated_at": 1710000001,
"result": {
"status": "success",
"file": "https://downloads.apidatatools.com/OUTPUT_FILE",
"preview": "PREVIEW"
}
}
Failed¶
A failed job includes an error object. Its details may include additional fields:
{
"request_id": "REQUEST_ID",
"job_id": "JOB_ID",
"status": "failed",
"created_at": 1710000000,
"updated_at": 1710000001,
"error": {
"code": "ERROR_CODE",
"message": "Error message",
"details": {
"message": "Error message"
}
}
}
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"
}
}
Request and authentication errors¶
| HTTP status | Error codes |
|---|---|
400 | INVALID_SOURCE_TYPE, INVALID_BODY_ENCODING, EMPTY_BODY |
401 | UNAUTHORIZED |
404 | USER_NOT_FOUND, UNKNOWN_FUNCTION |
413 | PAYLOAD_TOO_LARGE |
429 | QUOTA_EXCEEDED, RATE_LIMITED |
500 | PLAN_NOT_FOUND, INTERNAL_ERROR |
Converter-specific input errors are also returned with HTTP 400; their codes depend on the conversion error.
URL and file mode errors¶
| HTTP status | Error codes |
|---|---|
400 | INVALID_BODY, INVALID_URL, URL_UNREACHABLE, URL_NOT_OK, INVALID_FILE, FILE_UNAVAILABLE, INVALID_FILE_EXTENSION |
413 | FILE_TOO_LARGE |
500 | CONFIG_ERROR, PLAN_CONFIG_ERROR |
Job status errors¶
Errors returned by the job status endpoint use HTTP 400 for these codes:
INVALID_JOB_IDJOB_NOT_FOUNDFORBIDDENDDB_ERROR
Asynchronous processing failures are reported in the job’s failed status response. Possible codes include INVALID_JOB, FILE_TOO_LARGE, DOWNLOAD_FAILED, UPLOAD_FAILED, and INTERNAL_ERROR.
Notes¶
- Body mode is synchronous; URL and file modes are asynchronous.
- Body-size, file-size, quota, rate, and download-retention limits depend on your plan. See API plan limits.
- File download URLs are temporary, and their retention period depends on your plan.