Rapid OCR API

Rapid OCR API is a fast, lightweight REST service that converts images to text using optical character recognition (OCR). It is built on RapidOCR and exposed via FastAPI. Send an image URL or base64-encoded image and receive the extracted text in response.

Getting Started

Deploy a Rapid OCR API instance at app.osaas.io/dashboard/service/rapidai-rapidocrapi.

Prerequisites

Configuration Options

Field Required Description
name Yes Alphanumeric instance name

No additional configuration is required — the service starts with sensible defaults.

Step-by-Step Guide

1. Create the instance

Via the OSC dashboard:

  1. Go to app.osaas.io/dashboard/service/rapidai-rapidocrapi
  2. Click Create instance
  3. Enter a name (e.g. myocr) and click Create
  4. Wait for the instance to reach Running status

Via CLI:

osc create rapidai-rapidocrapi myocr

2. Send an OCR request

Once the instance is running, its URL is shown on the service page. Use the /ocr endpoint to extract text from an image:

curl -s -X POST \
  https://<instance-url>/ocr \
  -H "Content-Type: application/json" \
  -d '{"image_path": "https://example.com/invoice.png"}'

The response returns the recognised text in JSON format.

Usage Example

Extract text from a locally encoded image:

import base64, requests

with open("screenshot.png", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()

response = requests.post(
    "https://<instance-url>/ocr",
    json={"image_base64": b64}
)
print(response.json())

API Reference

The service exposes a FastAPI application with interactive API documentation at https://<instance-url>/docs.

Endpoint Method Description
/ocr POST Extract text from an image (URL or base64)
/health GET Health check
/docs GET Interactive Swagger UI

Resources