API Documentation
Complete reference for the Smooth Ocean OCR API
API Base URL:
https://api.smooth-ocean.tech/
Integrate powerful document processing into your applications with our easy-to-use API. Support for multiple programming languages and comprehensive error handling.
POST /upload-single-sync
Upload and process documents synchronously
This endpoint accepts a file upload and returns the OCR results immediately.
📋 Required Headers
x_api_key(required) — Your API authentication keyx_parser_key(required) — Parser configuration key
📤 Request Body
file(required) — The document file to process (PDF)
💻 Code Examples
curl --request POST \
--url https://api.smooth-ocean.tech/upload-single-sync \
--header 'content-type: multipart/form-data' \
--header 'x_api_key: YOUR_API_KEY' \
--header 'x_parser_key: YOUR_PARSER_KEY' \
--form file=@/path/to/your/document.pdf
import requests
url = "https://api.smooth-ocean.tech/upload-single-sync"
headers = {
"x_api_key": "YOUR_API_KEY",
"x_parser_key": "YOUR_PARSER_KEY"
}
with open('/path/to/your/document.pdf', 'rb') as file:
files = {'file': file}
response = requests.post(url, headers=headers, files=files)
print(response.json())
const formData = new FormData();
formData.append('file', fileInput.files[0]);
fetch('https://api.smooth-ocean.tech/upload-single-sync', {
method: 'POST',
headers: {
'x_api_key': 'YOUR_API_KEY',
'x_parser_key': 'YOUR_PARSER_KEY'
},
body: formData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import java.io.*;
import java.net.http.*;
import java.nio.file.*;
public class OCRClient {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
Path filePath = Paths.get("/path/to/your/document.pdf");
byte[] fileBytes = Files.readAllBytes(filePath);
String boundary = "----WebKitFormBoundary" + System.currentTimeMillis();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.smooth-ocean.tech/upload-single-sync"))
.header("x_api_key", "YOUR_API_KEY")
.header("x_parser_key", "YOUR_PARSER_KEY")
.header("Content-Type", "multipart/form-data; boundary=" + boundary)
.POST(HttpRequest.BodyPublishers.ofByteArray(
buildMultipartBody(fileBytes, boundary)
))
.build();
HttpResponse<String> response = client.send(
request,
HttpResponse.BodyHandlers.ofString()
);
System.out.println(response.body());
}
}
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
file, err := os.Open("/path/to/your/document.pdf")
if err != nil {
panic(err)
}
defer file.Close()
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, err := writer.CreateFormFile("file", "document.pdf")
if err != nil {
panic(err)
}
io.Copy(part, file)
writer.Close()
req, err := http.NewRequest("POST", "https://api.smooth-ocean.tech/upload-single-sync", body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("x_api_key", "YOUR_API_KEY")
req.Header.Set("x_parser_key", "YOUR_PARSER_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
fmt.Println(string(respBody))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.smooth-ocean.tech/upload-single-sync",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"x_api_key: YOUR_API_KEY",
"x_parser_key: YOUR_PARSER_KEY"
],
CURLOPT_POSTFIELDS => [
'file' => new CURLFile('/path/to/your/document.pdf')
]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
using System;
using System.Net.Http;
using System.IO;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("x_api_key", "YOUR_API_KEY");
client.DefaultRequestHeaders.Add("x_parser_key", "YOUR_PARSER_KEY");
var content = new MultipartFormDataContent();
var fileContent = new ByteArrayContent(File.ReadAllBytes(@"C:\path\to\document.pdf"));
content.Add(fileContent, "file", "document.pdf");
var response = await client.PostAsync(
"https://api.smooth-ocean.tech/upload-single-sync",
content
);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
✅ Success Response
Returns a JSON object containing the processed OCR results:
{
{
"status_code": 200,
"message": "OCR processing completed successfully",
"data": {
"job_id": 2147689085,
"job_status": "success",
"parsedData": {
parser data
},
"totalAttempts": 1,
"total_pages": 2,
"initiated_at": 1760304337258
}
}
}
Error Codes
Understanding API response codes and error messages
| Status Code | Error Type | Response | Description |
|---|---|---|---|
| 200 | Success | "status_code": 200, "message": "OCR processing completed successfully", "data": ocr_result, |
Job processed successfully without any errors. |
| 400 | Rejection | { "status_code": 400, "message": "No file uploaded", "error": "Bad Request" } |
Unsupported file type: <Uploaded file type> Allowed types: {.pdf} |
| 400 | Rejection | { "status_code": 400, "message": "Only one file can be uploaded per request", "error": "Bad Request" } |
Multiple files were uploaded in a single request. |
| 400 | Rejection | {"status_code": 400, "message": f"File size exceeds maximum limit of 10 MB", "error": "Bad Request"} |
The file size exceeds the maximum limit of 10 MB. |
| 400 | Rejection | { "status_code": 400, "message": "Missing x_api_key key", "error": "Forbidden" } |
The x_api_key header is missing from the request. |
| 400 | Rejection | { "status_code": 400, "message": "Missing x_parser_key key", "error": "Forbidden" } |
The x_parser_key header is missing from the request. |
| 402 | Rejection | { "status_code": 402, "message": "Insufficient credits", "error": "Payment Required" } |
The client associated with the provided API key has insufficient credits. |
| 403 | Rejection | { "status_code": 403, "message": "Parser key not allowed for this API key", "error": "Access denied" } |
The provided parser key is not authorized for use with the given API key. |
| 403 | Rejection | { "status_code": 403, "message": "Terms and Conditions not accepted. Please accept terms to use the API.", "error": "Access denied" } |
The client must accept the Terms and Conditions before using the API. |
| 403 | Rejection | { "status_code": 403, "message": "Client inactive", "error": "Access denied" } |
The client associated with the provided API key is inactive. |
| 500 | Rejection | { "status_code": 500, "message": "Internal server error during OCR processing", "error": "Internal Server Error" } |
An unexpected error occurred on the server while processing the OCR request. |