SnapSheet API Documentation
Integrate powerful OCR capabilities into your applications with our simple REST API. Convert images to structured CSV and Excel data programmatically.
API Overview
The SnapSheet API provides a single endpoint for converting images to structured data formats. Our API is built on Google's Gemini 2.5 Flash model for high-accuracy OCR processing.
97%+ Accuracy
Industry-leading OCR accuracy
30s Timeout
Fast processing with timeout protection
10MB Limit
Support for large document images
Convert Image Endpoint
POST /api/convert-image
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
image | File | Yes | Image file (JPEG, PNG, GIF, BMP, WebP) |
format | String | Yes | "csv" or "excel" for output format |
Response Format
{ "csv": "Name,Age,City\nJohn,25,New York\nJane,30,London", "message": "CSV conversion completed successfully" } // OR for Excel format { "excel": "Date,Bill No,Particulars,Amount\n01/01/2024,INV001,Services,1000", "message": "Excel (Busy) conversion completed successfully" }
Code Examples
JavaScript/Node.js
const formData = new FormData(); formData.append('image', imageFile); formData.append('format', 'csv'); const response = await fetch('/api/convert-image', { method: 'POST', body: formData, }); const data = await response.json(); console.log(data.csv);
Python
import requests files = {'image': open('document.jpg', 'rb')} data = {'format': 'csv'} response = requests.post( 'https://snapsheet.heyadrsh.tech/api/convert-image', files=files, data=data ) result = response.json() print(result['csv'])
cURL
curl -X POST https://snapsheet.heyadrsh.tech/api/convert-image \ -F "image=@document.jpg" \ -F "format=csv"
Error Handling
The API returns appropriate HTTP status codes and error messages for different scenarios:
400 Bad Request
Invalid file type, missing parameters, or file too large
408 Request Timeout
Processing took longer than 30 seconds
422 Unprocessable Entity
No readable data found in the image
429 Too Many Requests
Rate limit exceeded, please try again later
500 Internal Server Error
Unexpected server error occurred