curl -X GET https://api.tableflow.com/v2/extractions/uT2bJNWN75YPU95r/download-original \
-H "Authorization: Bearer YOUR_API_KEY" \
--output original-file.pdf
const axios = require("axios");
const fs = require("fs");
async function downloadOriginalFile(extractionId, outputPath) {
try {
const response = await axios.get(
`https://api.tableflow.com/v2/extractions/${extractionId}/download-original`,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
responseType: "stream",
}
);
// Save the file directly to the specified path
const writer = fs.createWriteStream(outputPath);
response.data.pipe(writer);
return new Promise((resolve, reject) => {
writer.on("finish", () => resolve(outputPath));
writer.on("error", reject);
});
} catch (error) {
console.error("Error downloading file:", error.message);
throw error;
}
}
// Example usage
downloadOriginalFile("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
.then(filePath => {
console.log(`File downloaded successfully to: ${filePath}`);
})
.catch(error => {
console.error(`Failed to download file: ${error.message}`);
});
import requests
def download_original_file(extraction_id, output_path):
"""
Download the original file for an extraction
Args:
extraction_id (str): The ID of the extraction
output_path (str): Path where to save the file
Returns:
str: Path where the file was saved
"""
url = f"https://api.tableflow.com/v2/extractions/{extraction_id}/download-original"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
# Download the file
response = requests.get(url, headers=headers)
response.raise_for_status()
# Save the file to the specified location
with open(output_path, 'wb') as f:
f.write(response.content)
return output_path
# Example usage
try:
file_path = download_original_file("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
print(f"File downloaded successfully to: {file_path}")
except requests.exceptions.HTTPError as e:
print(f"Error downloading file: {e}")
{
"error": "No extraction ID provided"
}
Extractions
Download Extraction Original File
Download the original file that was uploaded for extraction
GET
/
v2
/
extractions
/
{id}
/
download-original
curl -X GET https://api.tableflow.com/v2/extractions/uT2bJNWN75YPU95r/download-original \
-H "Authorization: Bearer YOUR_API_KEY" \
--output original-file.pdf
const axios = require("axios");
const fs = require("fs");
async function downloadOriginalFile(extractionId, outputPath) {
try {
const response = await axios.get(
`https://api.tableflow.com/v2/extractions/${extractionId}/download-original`,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
responseType: "stream",
}
);
// Save the file directly to the specified path
const writer = fs.createWriteStream(outputPath);
response.data.pipe(writer);
return new Promise((resolve, reject) => {
writer.on("finish", () => resolve(outputPath));
writer.on("error", reject);
});
} catch (error) {
console.error("Error downloading file:", error.message);
throw error;
}
}
// Example usage
downloadOriginalFile("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
.then(filePath => {
console.log(`File downloaded successfully to: ${filePath}`);
})
.catch(error => {
console.error(`Failed to download file: ${error.message}`);
});
import requests
def download_original_file(extraction_id, output_path):
"""
Download the original file for an extraction
Args:
extraction_id (str): The ID of the extraction
output_path (str): Path where to save the file
Returns:
str: Path where the file was saved
"""
url = f"https://api.tableflow.com/v2/extractions/{extraction_id}/download-original"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
# Download the file
response = requests.get(url, headers=headers)
response.raise_for_status()
# Save the file to the specified location
with open(output_path, 'wb') as f:
f.write(response.content)
return output_path
# Example usage
try:
file_path = download_original_file("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
print(f"File downloaded successfully to: {file_path}")
except requests.exceptions.HTTPError as e:
print(f"Error downloading file: {e}")
{
"error": "No extraction ID provided"
}
Downloads the original file that was uploaded for a specific extraction. This endpoint returns the raw file data with the appropriate content type.
Usage Notes
- This endpoint returns the raw file data, not a JSON response
- The content type will match the original file type (e.g., application/pdf for PDFs)
Request
string
required
The ID of the extraction to download the original file for.
curl -X GET https://api.tableflow.com/v2/extractions/uT2bJNWN75YPU95r/download-original \
-H "Authorization: Bearer YOUR_API_KEY" \
--output original-file.pdf
const axios = require("axios");
const fs = require("fs");
async function downloadOriginalFile(extractionId, outputPath) {
try {
const response = await axios.get(
`https://api.tableflow.com/v2/extractions/${extractionId}/download-original`,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
responseType: "stream",
}
);
// Save the file directly to the specified path
const writer = fs.createWriteStream(outputPath);
response.data.pipe(writer);
return new Promise((resolve, reject) => {
writer.on("finish", () => resolve(outputPath));
writer.on("error", reject);
});
} catch (error) {
console.error("Error downloading file:", error.message);
throw error;
}
}
// Example usage
downloadOriginalFile("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
.then(filePath => {
console.log(`File downloaded successfully to: ${filePath}`);
})
.catch(error => {
console.error(`Failed to download file: ${error.message}`);
});
import requests
def download_original_file(extraction_id, output_path):
"""
Download the original file for an extraction
Args:
extraction_id (str): The ID of the extraction
output_path (str): Path where to save the file
Returns:
str: Path where the file was saved
"""
url = f"https://api.tableflow.com/v2/extractions/{extraction_id}/download-original"
headers = {
"Authorization": "Bearer YOUR_API_KEY"
}
# Download the file
response = requests.get(url, headers=headers)
response.raise_for_status()
# Save the file to the specified location
with open(output_path, 'wb') as f:
f.write(response.content)
return output_path
# Example usage
try:
file_path = download_original_file("uT2bJNWN75YPU95r", "downloads/invoice.pdf")
print(f"File downloaded successfully to: {file_path}")
except requests.exceptions.HTTPError as e:
print(f"Error downloading file: {e}")
Response
The response is the raw file data with the appropriate Content-Type header. The Content-Disposition header will include the original filename. For example, if the original file was a PDF named “invoice.pdf”, the response headers might look like:Content-Type: application/pdf
Content-Disposition: attachment; filename="invoice.pdf"
Error Responses
string
Error message describing what went wrong.
{
"error": "No extraction ID provided"
}
⌘I