API Documentation
Use the itsOCR API to extract text from images programmatically.
Authentication
All API requests require authentication using a Bearer token. You can create API tokens in your Settings.
Authorization: Bearer itsocr_your_token_hereBase URL
https://itsocr.com/api/v1OCR Endpoint
POST
/ocrExtract text from an image. Supports JPEG, PNG, GIF, WebP, and other common image formats.
Request
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | The image file to process |
| prompt | String | No | Custom prompt for OCR (overrides default) |
Response
{
"success": true,
"id": "550e8400-e29b-41d4-a716-446655440000",
"text": "Extracted text from the image...",
"processingTimeMs": 1234,
"fileName": "document.jpg",
"fileSize": 102400,
"mimeType": "image/jpeg"
}Example
cURL
curl -X POST https://itsocr.com/api/v1/ocr \ -H "Authorization: Bearer itsocr_your_token_here" \ -F "file=@document.jpg"
JavaScript / Node.js
import fs from 'fs';
// Read file and create a Blob
const fileBuffer = fs.readFileSync('document.jpg');
const blob = new Blob([fileBuffer], { type: 'image/jpeg' });
const formData = new FormData();
formData.append('file', blob, 'document.jpg');
const response = await fetch('https://itsocr.com/api/v1/ocr', {
method: 'POST',
headers: {
'Authorization': 'Bearer itsocr_your_token_here'
},
body: formData
});
const result = await response.json();
console.log(result.text);Python
import requests
with open('document.jpg', 'rb') as f:
response = requests.post(
'https://itsocr.com/api/v1/ocr',
headers={'Authorization': 'Bearer itsocr_your_token_here'},
files={'file': f}
)
result = response.json()
print(result['text'])Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad request (missing file, invalid format, etc.) |
| 401 | Invalid or missing API token |
| 429 | Rate limit exceeded (monthly quota reached) |
| 500 | Server error |
{
"success": false,
"error": "Error message describing what went wrong"
}Rate Limits
API usage is subject to your plan's monthly limits. Check your current usage in the Dashboard.
| Plan | Images/Month | Max File Size |
|---|---|---|
| Free | 10 | 5 MB |
| Pro | 500 | 20 MB |
| Enterprise | Unlimited | 50 MB |
Need Help?
If you have questions or need assistance, please contact us at support@itsocr.com.