Jupiter OMR

Jupiter OMR API Documentation

Welcome to the Jupiter OMR API documentation. This guide will help you integrate optical mark recognition (OMR) capabilities into your applications.

Authentication

Jupiter OMR uses API key authentication. You can obtain an API key and client ID from your dashboard under the API Keys section.

All API requests must include both your API key in the X-API-Key header and your client ID in the X-Client-ID header:

Authentication Examples

Examples of how to authenticate with the API

interface ApiResponse<T> {
data: T;
status: number;
}

const response = await fetch('https://jupiter.digitalbkk.cloud/api/v1/sheets', {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const data: ApiResponse<Sheet[]> = await response.json();
console.log(data);

Base URL

The base URL for all API endpoints:

https://jupiter.digitalbkk.cloud/api/v1

Usage and Billing

The API is pay-as-you-go. There are no subscription plans, and no request rate limit is published or enforced by the API. Chargeable requests deduct their price from your wallet balance when the request is made, so a request that is later rejected or fails to process is still charged. Top up your wallet in the dashboard.

RequestCost (USD)
Upload a sheet for processing$0.03
Reprocess a sheet$0.03
Process a sheet directly$0.03
Create a template$0.05
Update a template$0.05
Upload a template image$0.05

Creating a template from a new image is a two-step flow: uploading the template image and saving the template are each charged $0.05. Reading data is free: listing and fetching sheets, answers, templates and template images are not charged.

When your balance is too low for a chargeable request, the API answers with 402 Payment Required and a message that includes your current balance and the cost of the request.

Supported Files

Sheet and template images can be JPG, JPEG or PNG files up to 10 MB each. Upload one sheet per request. Results are returned as JSON, and the web app also exports them as CSV or TXT.

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of an API request:

Code RangeDescription
2xxSuccess - The request was successfully received and processed
4xxClient Error - Invalid input, authentication issues, or missing parameters
5xxServer Error - Something went wrong on our end

Common Error Codes

CodeDescription
401Invalid or missing API key
402Insufficient balance for a chargeable request
403API key doesn't have permission
404Sheet, template or other resource not found
500Internal server error

Error Response Format

When an error occurs, you'll receive a JSON response with details:

Error Response Format

Example error response

interface ValidationError {
loc: (string | number)[];  // Location of the error (e.g., ["body", "field_name"])
msg: string;              // Error message
type: string;             // Error type identifier
}

interface ErrorResponse {
detail: ValidationError[];
}

// Example error response
{
"detail": [
  {
    "loc": ["body", "sheet_type"],
    "msg": "Field required",
    "type": "value_error.missing"
  },
  {
    "loc": ["body", "file"],
    "msg": "File type not supported",
    "type": "value_error.file"
  }
]
}

Validation Errors

The API performs validation on request parameters and will return detailed error messages when validation fails. Common validation errors include:

  • Missing required fields
  • Invalid field values or formats
  • File type or size restrictions
  • Authentication or permission issues

Best Practices for Error Handling

  1. Always check response status codes - Don't assume requests will succeed
  2. Parse error responses - Extract useful information from error messages
  3. Handle insufficient balance - A 402 response means the wallet needs a top-up; do not retry until it is funded
  4. Implement exponential backoff - When retrying failed requests caused by network or server errors
  5. Log errors appropriately - Store error details for debugging
  6. Show user-friendly messages - Transform API errors into readable messages for end-users

Sheets API

The Sheets API allows you to process and manage OMR answer sheets.

List Sheets

Retrieve all sheets with pagination.

List Sheets

Get all sheets with pagination

interface SheetSummary {
id: number;
sheet_type?: string;
src_filename: string;
template_reference_identifier?: string;
received_at: string;
processed_at?: string;
status: 'pending' | 'processing' | 'completed' | 'failed';
valid_answers_count: number;
has_issue: boolean;
is_normal: boolean;
}

const response = await fetch('https://jupiter.digitalbkk.cloud/api/v1/sheets?skip=0&limit=100', {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const sheets: SheetSummary[] = await response.json();
console.log(sheets);

Get Sheet

Retrieve a specific sheet with its answers and processed debug images.

Get Sheet

Get a specific sheet by ID with answers and debug images

interface SheetAnswer {
id: number;
sheet_id: number;
question: number;
answer: string;
}

interface SheetSummary {
total_questions: number;
valid_answers: number;
invalid_answers: number;
total_bubbles_scanned: number;
is_normal: boolean;
processing_time?: number;
sheet_type: 'SHEET_25' | 'SHEET_50' | 'SHEET_100' | 'CUSTOM';
upload_time: string;
completion_time?: string;
processing_method: string;
}

interface Sheet {
id: number;
sheet_type?: string;
src_filename: string;
template_reference_identifier?: string;
received_at: string;
processed_at?: string;
status: 'pending' | 'processing' | 'completed' | 'failed';
processed_images?: {
  original?: string;
  coordinates_detection?: string;
};
answers: SheetAnswer[];
summary?: SheetSummary;
}

const sheetId = 123;
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}`, {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const sheet: Sheet = await response.json();
console.log(sheet);

Create Sheet

Upload and process a new OMR sheet using a specific template.

Create Sheet

Upload and process a new OMR sheet

interface SheetUploadResponse {
sheet_id: number;
status: 'pending' | 'processing' | 'completed' | 'failed';
}

const formData = new FormData();
formData.append('template_reference_identifier', 'standard_100q_5opt_v1');
formData.append('file', file); // Your image file
formData.append('threshold_percentage', '0.5'); // Optional

const response = await fetch('https://jupiter.digitalbkk.cloud/api/v1/sheets', {
method: 'POST',
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
},
body: formData
});

const result: SheetUploadResponse = await response.json();
console.log(result);

Update Sheet

Update an existing sheet.

Update Sheet

Update an existing sheet

interface UpdateSheetRequest {
name?: string;
content?: Record<string, any>;
}

const sheetId: string = 'sheet_123';
const updates: UpdateSheetRequest = {
name: 'Updated Sheet Name',
content: {
  // Updated sheet content
}
};

const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}`, {
method: 'PUT',
headers: {
  'X-API-Key': 'your_api_key',
  'Content-Type': 'application/json'
},
body: JSON.stringify(updates)
});

const updatedSheet: Sheet = await response.json();
console.log(updatedSheet);

Delete Sheet

Delete a sheet from your workspace.

Delete Sheet

Delete a sheet

const sheetId: string = 'sheet_123';
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}`, {
method: 'DELETE',
headers: {
  'X-API-Key': 'your_api_key'
}
});

if (response.ok) {
console.log('Sheet deleted successfully');
}

Reprocess Sheet

Reprocess an existing sheet.

Reprocess Sheet

Reprocess an existing sheet

const sheetId = 123;
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}/reprocess`, {
method: 'POST',
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id',
  'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
  threshold_percentage: '0.5' // Optional
})
});

const result = await response.json();
console.log(result);

Get Sheet Answers

Get all answers for a specific sheet.

Get Sheet Answers

Get answers for a specific sheet

interface SheetAnswers {
[key: string]: string;
}

const sheetId = 123;
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}/answers`, {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const answers: SheetAnswers = await response.json();
console.log(answers);

Debug Sheet

Get debug information for a specific sheet.

Debug Sheet

Get debug information for a sheet

const sheetId = 123;
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheets/${sheetId}/debug`, {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const debugInfo = await response.json();
console.log(debugInfo);

Sheet Templates API

The Sheet Templates API allows you to manage OMR sheet templates with their bubble coordinates.

Create Template

Create a new sheet template with its bubble coordinates.

Create Template

Create a new sheet template

interface BubbleCoordinate {
question_number: number;
option_label: string;
x_coordinate: number;
y_coordinate: number;
radius: number;
}

interface SheetTemplateCreate {
name: string;
reference_identifier: string;
num_questions: number;
options_config: string[];
coordinates: BubbleCoordinate[];
}

const newTemplate: SheetTemplateCreate = {
name: 'Standard 100Q Template',
reference_identifier: 'standard_100q_v1',
num_questions: 100,
options_config: ['A', 'B', 'C', 'D', 'E'],
coordinates: [
  {
    question_number: 1,
    option_label: 'A',
    x_coordinate: 100,
    y_coordinate: 200,
    radius: 7
  }
  // ... more coordinates
]
};

const response = await fetch('https://jupiter.digitalbkk.cloud/api/v1/sheet-templates', {
method: 'POST',
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id',
  'Content-Type': 'application/json'
},
body: JSON.stringify(newTemplate)
});

const createdTemplate = await response.json();
console.log(createdTemplate);

List Templates

Retrieve all sheet templates available to the current user.

List Templates

Get all available templates

interface BubbleCoordinate {
id: number;
sheet_template_id: number;
question_number: number;
option_label: string;
x_coordinate: number;
y_coordinate: number;
radius: number;
created_at: string;
updated_at: string;
}

interface SheetTemplate {
id: number;
name: string;
reference_identifier: string;
num_questions: number;
options_config: string[];
user_id?: number;
created_at: string;
updated_at: string;
coordinates: BubbleCoordinate[];
}

const response = await fetch('https://jupiter.digitalbkk.cloud/api/v1/sheet-templates?skip=0&limit=100', {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const templates: SheetTemplate[] = await response.json();
console.log(templates);

Get Template

Retrieve a specific template by its reference identifier.

Get Template

Get a specific template by reference ID

const referenceId = 'standard_100q_v1';
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheet-templates/${referenceId}`, {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const template: SheetTemplate = await response.json();
console.log(template);

Get Template Coordinates

Retrieve bubble coordinates for a specific template.

Get Template Coordinates

Get bubble coordinates for a template

interface OMRCoordinates {
data: {
  [questionNumber: string]: {
    [optionLabel: string]: [number, number, number]; // [x, y, radius]
  };
};
}

const referenceId = 'standard_100q_v1';
const response = await fetch(`https://jupiter.digitalbkk.cloud/api/v1/sheet-templates/${referenceId}/omr-coordinates`, {
headers: {
  'X-API-Key': 'your_api_key',
  'X-Client-ID': 'your_client_id'
}
});

const coordinates: OMRCoordinates = await response.json();
console.log(coordinates);