OCR

Run OCR (Sync)

POST
Run OCR on an Base64 encoded image or PDF. This endpoint will block until the OCR is complete.

Request

This endpoint expects an object.
mimeType
stringRequired
MIME type of the image. Supported types are image/png, image/jpeg, and application/pdf.
image
stringRequired
Base64 encoded image or PDF. PNG, JPG, and PDF are supported. 10MB max.
vendorNetwork
enumOptional
Limit OCR vendor search to a specific network
Allowed values: allplatformentity
entityId
stringOptional
When using the Entity vendor network, specify the entity to use if. EntityId on an auth token will take precedence over this parameter.

Response

This endpoint returns an object
invoice
object
vendor
object
check
objectOptional
bankAccount
objectOptional
POST
1curl -X POST https://api.mercoa.com/ocr \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "mimeType": "image/png",
6 "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII",
7 "vendorNetwork": "entity",
8 "entityId": "entity_8f86116b-3b4d-4ded-99ef-3bc929d8c33c"
9}'
200Successful
1{
2 "invoice": {
3 "id": "inv_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9",
4 "status": "DRAFT",
5 "paymentDestinationConfirmed": false,
6 "hasDocuments": true,
7 "hasSourceEmail": true,
8 "approvers": [],
9 "approvalPolicy": [],
10 "metadata": {},
11 "createdAt": "2021-01-01T00:00:00Z",
12 "updatedAt": "2021-01-01T00:00:00Z",
13 "amount": 100,
14 "currency": "USD",
15 "invoiceDate": "2021-01-01T00:00:00Z",
16 "dueDate": "2021-01-31T00:00:00Z",
17 "invoiceNumber": "INV-123",
18 "noteToSelf": "For the month of January",
19 "serviceStartDate": "2021-01-01T00:00:00Z",
20 "serviceEndDate": "2021-01-31T00:00:00Z",
21 "payerId": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
22 "payer": {
23 "acceptedTos": true,
24 "accountType": "business",
25 "createdAt": "2024-01-01T00:00:00Z",
26 "email": "customer@acme.com",
27 "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
28 "isCustomer": true,
29 "isNetworkPayee": false,
30 "isNetworkPayor": false,
31 "isPayee": false,
32 "isPayor": true,
33 "name": "Acme Inc.",
34 "profile": {
35 "business": {
36 "legalBusinessName": "Acme Inc.",
37 "taxIDProvided": true,
38 "email": "customer@acme.com",
39 "businessType": "llc",
40 "phone": {
41 "countryCode": "1",
42 "number": "4155551234"
43 },
44 "address": {
45 "addressLine1": "123 Main St",
46 "city": "San Francisco",
47 "stateOrProvince": "CA",
48 "postalCode": "94105",
49 "addressLine2": "Unit 1",
50 "country": "US"
51 },
52 "ownersProvided": true
53 }
54 },
55 "status": "verified",
56 "updatedAt": "2024-01-02T00:00:00Z",
57 "counterpartyType": [
58 "ENTITY"
59 ],
60 "foreignId": "MY-DB-ID-12345",
61 "paymentMethods": [
62 {
63 "type": "bankAccount",
64 "accountName": "My Checking Account",
65 "accountNumber": "99988767623",
66 "accountType": "CHECKING",
67 "bankName": "Chase",
68 "createdAt": "2021-01-01T00:00:00Z",
69 "id": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
70 "isDefaultDestination": true,
71 "isDefaultSource": true,
72 "routingNumber": "12345678",
73 "status": "VERIFIED",
74 "supportedCurrencies": [
75 "USD"
76 ],
77 "updatedAt": "2021-01-01T00:00:00Z"
78 }
79 ]
80 },
81 "vendorId": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
82 "vendor": {
83 "acceptedTos": false,
84 "accountType": "business",
85 "createdAt": "2024-01-01T00:00:00Z",
86 "email": "vendor@bigboxstore.com",
87 "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
88 "isCustomer": false,
89 "isNetworkPayee": false,
90 "isNetworkPayor": false,
91 "isPayee": true,
92 "isPayor": false,
93 "name": "Big Box Store",
94 "profile": {
95 "business": {
96 "legalBusinessName": "Big Box Store",
97 "taxIDProvided": false,
98 "email": "vendor@bigboxstore.com",
99 "businessType": "publicCorporation",
100 "ownersProvided": false
101 }
102 },
103 "status": "unverified",
104 "updatedAt": "2024-01-02T00:00:00Z",
105 "counterpartyType": [
106 "ENTITY"
107 ],
108 "foreignId": "MY-DB-ID-90909",
109 "paymentMethods": [
110 {
111 "type": "bankAccount",
112 "accountName": "Vendor Checking Account",
113 "accountNumber": "55934059697648",
114 "accountType": "CHECKING",
115 "bankName": "Chase",
116 "createdAt": "2021-01-01T00:00:00Z",
117 "id": "pm_7610541f-4619-4033-8620-cfccfb811293",
118 "isDefaultDestination": true,
119 "isDefaultSource": true,
120 "routingNumber": "66554433",
121 "status": "NEW",
122 "supportedCurrencies": [
123 "USD"
124 ],
125 "updatedAt": "2021-01-01T00:00:00Z"
126 }
127 ]
128 },
129 "comments": [],
130 "lineItems": [
131 {
132 "id": "inli_26672f38-eb9a-48f1-a7a0-f1b855e38cd7",
133 "currency": "USD",
134 "createdAt": "2021-01-01T00:00:00Z",
135 "updatedAt": "2021-01-01T00:00:00Z",
136 "amount": 100,
137 "description": "Product A",
138 "name": "Product A",
139 "quantity": 1,
140 "unitPrice": 100,
141 "serviceStartDate": "2021-01-01T00:00:00Z",
142 "serviceEndDate": "2021-01-31T00:00:00Z",
143 "metadata": {
144 "key1": "value1",
145 "key2": "value2"
146 },
147 "glAccountId": "600394"
148 }
149 ]
150 },
151 "vendor": {
152 "acceptedTos": false,
153 "accountType": "business",
154 "createdAt": "2024-01-01T00:00:00Z",
155 "email": "vendor@bigboxstore.com",
156 "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
157 "isCustomer": false,
158 "isNetworkPayee": false,
159 "isNetworkPayor": false,
160 "isPayee": true,
161 "isPayor": false,
162 "name": "Big Box Store",
163 "profile": {
164 "business": {
165 "legalBusinessName": "Big Box Store",
166 "taxIDProvided": false,
167 "email": "vendor@bigboxstore.com",
168 "businessType": "publicCorporation",
169 "ownersProvided": false
170 }
171 },
172 "status": "unverified",
173 "updatedAt": "2024-01-02T00:00:00Z",
174 "counterpartyType": [
175 "ENTITY"
176 ],
177 "foreignId": "MY-DB-ID-90909",
178 "paymentMethods": [
179 {
180 "type": "bankAccount",
181 "accountName": "Vendor Checking Account",
182 "accountNumber": "55934059697648",
183 "accountType": "CHECKING",
184 "bankName": "Chase",
185 "createdAt": "2021-01-01T00:00:00Z",
186 "id": "pm_7610541f-4619-4033-8620-cfccfb811293",
187 "isDefaultDestination": true,
188 "isDefaultSource": true,
189 "routingNumber": "66554433",
190 "status": "NEW",
191 "supportedCurrencies": [
192 "USD"
193 ],
194 "updatedAt": "2021-01-01T00:00:00Z"
195 }
196 ]
197 },
198 "check": {
199 "addressLine1": "123 Main St",
200 "city": "New York",
201 "country": "US",
202 "createdAt": "2021-01-01T00:00:00Z",
203 "id": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
204 "isDefaultDestination": true,
205 "isDefaultSource": false,
206 "payToTheOrderOf": "John Doe",
207 "postalCode": "10001",
208 "stateOrProvince": "NY",
209 "supportedCurrencies": [
210 "USD"
211 ],
212 "updatedAt": "2021-01-01T00:00:00Z",
213 "addressLine2": "Apt 1"
214 },
215 "bankAccount": {
216 "accountName": "Vendor Checking Account",
217 "accountNumber": "55934059697648",
218 "accountType": "CHECKING",
219 "bankName": "Chase",
220 "createdAt": "2021-01-01T00:00:00Z",
221 "id": "pm_7610541f-4619-4033-8620-cfccfb811293",
222 "isDefaultDestination": true,
223 "isDefaultSource": true,
224 "routingNumber": "66554433",
225 "status": "NEW",
226 "supportedCurrencies": [
227 "USD"
228 ],
229 "updatedAt": "2021-01-01T00:00:00Z"
230 }
231}