> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://beta-docs.payabli.com/api-reference/import/ocr-a-base64-encoded-string/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server. # OCR a base64-encoded string POST https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/{typeResult} Content-Type: application/json Reference: https://beta-docs.payabli.com/api-reference/import/ocr-a-base64-encoded-string ## Authentication - `requestToken` header (required) — API Key authentication via header ## Servers - `https://api-sandbox.payabli.com/api` (Sandbox, default) - `https://api.payabli.com/api` (Production) ## Request ### Path parameters - `typeResult` (string, required) — The type of object to create in Payabli. Accepted values are `bill` and `invoice`. ### Body (application/json) This endpoint expects a FileContentImageOnly. - `ftype` (enum, optional) — The MIME type of the file (if content is provided) - Allowed values: `pdf`, `doc`, `docx`, `jpg`, `jpeg`, `png`, `gif`, `txt` - `filename` (string, optional) — The name of the file to be uploaded - `furl` (string, optional) — Optional URL link to the file - `fContent` (string, optional) — Base64-encoded file content ## Response ### 200 OCR document processing result - `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. - `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'. - `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/api-reference/api-responses). - `responseData` (OcrResponseData, optional) — Details of the OCR processing result ## Errors ### 400 Bad Request Error Bad request/ invalid data - `any` ### 401 Unauthorized Error Unauthorized request. - `any` ### 500 Internal Server Error Internal API Error - `any` ### 503 Service Unavailable Error Database connection error - `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. - `responseData` (map from string to any, optional) — The object containing the response data. - `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'. ## Types ### OcrResponseData - `resultData` (OcrResultData, optional) ### OcrResultData - `billNumber` (string, optional) - `netAmount` (double, optional) - `billDate` (datetime, optional) - `dueDate` (datetime, optional) - `comments` (string, optional) - `billItems` (list of OcrBillItem, optional) - `mode` (integer, optional) - `accountingField1` (string, optional) - `accountingField2` (string, optional) - `additionalData` (OcrBillItemAdditionalData, optional) - `vendor` (OcrVendor, optional) - `endDate` (datetime, optional) - `frequency` (string, optional) - `terms` (string, optional) - `status` (integer, optional) - `lotNumber` (string, optional) - `attachments` (list of OcrAttachment, optional) ### OcrBillItem - `itemTotalAmount` (double, optional) - `itemTaxAmount` (double, optional) - `itemTaxRate` (double, optional) - `itemProductCode` (string, optional) - `itemProductName` (string, optional) - `itemDescription` (string, optional) - `itemCommodityCode` (string, optional) - `itemUnitOfMeasure` (string, optional) - `itemCost` (double, optional) - `itemQty` (integer, optional) - `itemMode` (integer, optional) - `itemCategories` (list of string, optional) ### OcrBillItemAdditionalData - `category` (string, optional) - `currency_code` (string, optional) - `type` (string, optional) - `reference_number` (string, optional) ### OcrVendor - `vendorNumber` (string, optional) - `name1` (string, optional) - `name2` (string, optional) - `ein` (string, optional) - `phone` (string, optional) - `email` (string, optional) - `address1` (string, optional) - `address2` (string, optional) - `city` (string, optional) - `state` (string, optional) - `zip` (string, optional) - `country` (string, optional) - `mcc` (string, optional) - `locationCode` (string, optional) - `contacts` (list of Contacts, optional) - `billingData` (OcrVendorBillingData, optional) - `paymentMethod` (string, optional) - `vendorStatus` (integer, optional) - `remitAddress1` (string, optional) - `remitAddress2` (string, optional) - `remitCity` (string, optional) - `remitState` (string, optional) - `remitZip` (string, optional) - `remitCountry` (string, optional) - `payeeName1` (string, optional) - `payeeName2` (string, optional) - `customerVendorAccount` (string, optional) - `internalReferenceId` (long, optional) - `customField1` (string, optional) - `customField2` (string, optional) - `additionalData` (OcrVendorAdditionalData, optional) ### OcrAttachment - `ftype` (string, optional) - `filename` (string, optional) - `fileDescriptor` (string, optional) - `furl` (string, optional) - `fContent` (string, optional) ### Contacts - `contactEmail` (string, optional) — Contact email address. - `contactName` (string, optional) — Contact name. - `contactPhone` (string, optional) — Contact phone number. - `contactTitle` (string, optional) — Contact title. ### OcrVendorBillingData - `id` (integer, optional) - `bankName` (string, optional) - `routingAccount` (string, optional) - `accountNumber` (string, optional) - `typeAccount` (string, optional) - `bankAccountHolderName` (string, optional) - `bankAccountHolderType` (string, optional) - `bankAccountFunction` (integer, optional) ### OcrVendorAdditionalData - `web` (string, optional) ## Examples **Request** ```json {} ``` **Response** ```json { "isSuccess": true, "responseText": "responseText", "responseCode": 1, "responseData": { "resultData": { "billNumber": "billNumber", "netAmount": 1.1, "billDate": "2024-01-15T09:30:00Z", "dueDate": "2024-01-15T09:30:00Z", "comments": "comments", "billItems": [ { "itemTotalAmount": 1.1, "itemTaxAmount": 1.1, "itemTaxRate": 1.1, "itemProductCode": "itemProductCode", "itemProductName": "itemProductName", "itemDescription": "itemDescription", "itemCommodityCode": "itemCommodityCode", "itemUnitOfMeasure": "itemUnitOfMeasure", "itemCost": 1.1, "itemQty": 1, "itemMode": 1, "itemCategories": [ "itemCategories", "itemCategories" ] }, { "itemTotalAmount": 1.1, "itemTaxAmount": 1.1, "itemTaxRate": 1.1, "itemProductCode": "itemProductCode", "itemProductName": "itemProductName", "itemDescription": "itemDescription", "itemCommodityCode": "itemCommodityCode", "itemUnitOfMeasure": "itemUnitOfMeasure", "itemCost": 1.1, "itemQty": 1, "itemMode": 1, "itemCategories": [ "itemCategories", "itemCategories" ] } ], "mode": 1, "accountingField1": "accountingField1", "accountingField2": "accountingField2", "additionalData": { "category": "category", "currency_code": "currency_code", "type": "type", "reference_number": "reference_number" }, "vendor": { "vendorNumber": "vendorNumber", "name1": "name1", "name2": "name2", "ein": "ein", "phone": "phone", "email": "email", "address1": "address1", "address2": "address2", "city": "city", "state": "state", "zip": "zip", "country": "country", "mcc": "mcc", "locationCode": "locationCode", "contacts": [ {}, {} ], "billingData": { "id": 1, "bankName": "bankName", "routingAccount": "routingAccount", "accountNumber": "accountNumber", "typeAccount": "typeAccount", "bankAccountHolderName": "bankAccountHolderName", "bankAccountHolderType": "bankAccountHolderType", "bankAccountFunction": 1 }, "paymentMethod": "paymentMethod", "vendorStatus": 1, "remitAddress1": "remitAddress1", "remitAddress2": "remitAddress2", "remitCity": "remitCity", "remitState": "remitState", "remitZip": "remitZip", "remitCountry": "remitCountry", "payeeName1": "payeeName1", "payeeName2": "payeeName2", "customerVendorAccount": "customerVendorAccount", "internalReferenceId": 1000000, "customField1": "customField1", "customField2": "customField2", "additionalData": { "web": "web" } }, "endDate": "2024-01-15T09:30:00Z", "frequency": "frequency", "terms": "terms", "status": 1, "lotNumber": "lotNumber", "attachments": [ { "ftype": "ftype", "filename": "filename", "fileDescriptor": "fileDescriptor", "furl": "furl", "fContent": "fContent" }, { "ftype": "ftype", "filename": "filename", "fileDescriptor": "fileDescriptor", "furl": "furl", "fContent": "fContent" } ] } } } ``` **SDK Code** ```python import requests url = "https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult" payload = {} headers = { "requestToken": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult'; const options = { method: 'POST', headers: {requestToken: '', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult") .header("requestToken", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult"); var request = new RestRequest(Method.POST); request.AddHeader("requestToken", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Import/ocrDocumentJson/typeResult")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` > If you're a software company, you're a payments company™