robo-meister / flow-scribe-api
FlowScribe OCR PHP SDK for connecting to the Robo-Meister OCR API
v0.0.1
2026-05-31 14:49 UTC
Requires
- php: >=8.2
- ext-curl: *
- ext-fileinfo: *
- ext-json: *
README
PHP client for connecting to the Robo-Meister FlowScribe OCR API.
Install
composer require robo-meister/flow-scribe-api
For local development from this repository, add the package as a path repository:
{
"repositories": [
{
"type": "path",
"url": "shared-profile/sdk/flowscribe-ocr/php"
}
],
"require": {
"robo-meister/flow-scribe-api": "*"
}
}
Usage
use Robo\FlowScribeOcr\FlowScribeOcrClient; $client = new FlowScribeOcrClient( baseUrl: 'https://ocr.robo-meister.com' ); $health = $client->health(); $metadata = $client->metadata(); $result = $client->processDocument(__DIR__ . '/invoice.pdf', [ 'document_type' => 'invoice', 'mode' => 'fuse', 'journal_csv' => true, ]); if (($result['exit_code'] ?? 1) === 0) { $parsed = $result['parsed'] ?? []; $csv = $result['csv'] ?? null; }
Custom dictionary config
Pass either a JSON file path:
$result = $client->processDocument(__DIR__ . '/invoice.pdf', [ 'config_path' => __DIR__ . '/custom-dictionary.json', ]);
Or pass an array that the SDK serializes as config.json for the multipart upload:
$result = $client->processDocument(__DIR__ . '/invoice.pdf', [ 'config' => [ 'fields' => [ 'invoiceNumber' => ['keywords' => ['Invoice #']], ], ], ]);
Authenticated integration jobs
Authenticated integration routes require an access token generated by the Robo Connector link flow. The SDK sends the token as a bearer token.
use Robo\FlowScribeOcr\FlowScribeOcrClient; $client = new FlowScribeOcrClient( baseUrl: 'https://ocr.robo-meister.com', accessToken: getenv('FLOWSCRIBE_ACCESS_TOKEN') ?: null ); $queued = $client->ingestFlowScribe(__DIR__ . '/invoice.pdf', [ 'document_type' => 'invoice', ]); $jobId = $queued['data']['job']['id']; $status = $client->flowScribeStatus($jobId);
For the RC invoice OCR bridge, use ingestRcInvoice() and rcInvoiceStatus().
Errors
HTTP and transport failures throw FlowScribeOcrException:
use Robo\FlowScribeOcr\FlowScribeOcrException; try { $result = $client->processDocument(__DIR__ . '/invoice.pdf'); } catch (FlowScribeOcrException $exception) { $statusCode = $exception->getStatusCode(); $responseBody = $exception->getResponseBody(); }