Invoice

Search invoices

GET
Search invoices for all entities in the organization

Query parameters

entityIdstringOptional
Filter invoices by the ID of the entity that created the invoice.
startDatedatetimeOptional
Start date for invoice created on date filter.
endDatedatetimeOptional
End date for invoice created date filter.
orderByenumOptional

Field to order invoices by. Defaults to CREATED_AT.

orderDirectionenumOptional
Direction to order invoices by. Defaults to asc.
Allowed values: ASCDESC
limitintegerOptional
Number of invoices to return. Limit can range between 1 and 100, and the default is 10.
startingAfterstringOptional
The ID of the invoice to start after. If not provided, the first page of invoices will be returned.
searchstringOptional
Find invoices by vendor name, invoice number, or amount. Partial matches are supported.
metadataobjectOptional
Filter invoices by metadata. Each filter will be applied as an AND condition. Duplicate keys will be ignored.
payerIdstringOptional
Filter invoices by payer ID.
vendorIdstringOptional
Filter invoices by vendor ID.
approverIdstringOptional
Filter invoices by assigned approver user ID.
approverActionenumOptional
Filter invoices by approver action. Needs to be used with approverId. For example, if you want to find all invoices that have been approved by a specific user, you would use approverId and approverAction=APPROVE.
Allowed values: NONEAPPROVEREJECT
invoiceIdstringOptional
Filter invoices by invoice ID.
statusenumOptional
Invoice status to filter on
includeFeesbooleanOptional
Deprecated
DEPRECATED. Fees are now included by default in the response.

Response

This endpoint returns an object
count
integer
Total number of notifications for the given start and end date filters. This value is not limited by the limit parameter. It is provided so that you can determine how many pages of results are available.
hasMore
boolean
True if there are more notifications available for the given start and end date filters.
data
list of objects
GET
1curl -G https://api.mercoa.com/invoices \
2 -H "Authorization: Bearer <token>" \
3 -d entityId=ent_8545a84e-a45f-41bf-bdf1-33b42a55812c
200
Retrieved
1{
2 "count": 10,
3 "hasMore": true,
4 "data": [
5 {
6 "id": "inv_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9",
7 "status": "PAID",
8 "paymentDestinationConfirmed": true,
9 "hasDocuments": true,
10 "hasSourceEmail": true,
11 "approvers": [
12 {
13 "approvalPolicyId": "apvl_5ce50275-1789-42ea-bc60-bb7e6d03635c",
14 "approvalSlotId": "inap_9bb311c9-7c15-4c9e-8148-63814e0abec6",
15 "action": "APPROVE",
16 "eligibleRoles": [
17 "admin"
18 ],
19 "eligibleUserIds": [
20 "user_e24fc81c-c5ee-47e8-af42-4fe29d895506"
21 ],
22 "date": "2021-01-01T00:00:00Z",
23 "assignedUserId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506"
24 }
25 ],
26 "approvalPolicy": [
27 {
28 "id": "apvl_8545a84e-a45f-41bf-bdf1-33b42a55812c",
29 "trigger": [],
30 "rule": {
31 "type": "approver",
32 "identifierList": {
33 "type": "rolesList",
34 "value": [
35 "admin"
36 ]
37 },
38 "numApprovers": 1
39 },
40 "upstreamPolicyId": "root"
41 }
42 ],
43 "metadata": {
44 "key1": "value1",
45 "key2": "value2"
46 },
47 "createdAt": "2021-01-01T00:00:00Z",
48 "updatedAt": "2021-01-01T00:00:00Z",
49 "amount": 100,
50 "currency": "USD",
51 "invoiceDate": "2021-01-01T00:00:00Z",
52 "deductionDate": "2021-01-01T00:00:00Z",
53 "settlementDate": "2021-01-03T00:00:00Z",
54 "dueDate": "2021-01-31T00:00:00Z",
55 "invoiceNumber": "INV-123",
56 "noteToSelf": "For the month of January",
57 "serviceStartDate": "2021-01-01T00:00:00Z",
58 "serviceEndDate": "2021-01-31T00:00:00Z",
59 "payerId": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
60 "payer": {
61 "id": "ent_8545a84e-a45f-41bf-bdf1-33b42a55812c",
62 "name": "Acme Inc.",
63 "email": "customer@acme.com",
64 "isCustomer": true,
65 "accountType": "business",
66 "profile": {
67 "business": {
68 "legalBusinessName": "Acme Inc.",
69 "taxIDProvided": true,
70 "email": "customer@acme.com",
71 "businessType": "llc",
72 "phone": {
73 "countryCode": "1",
74 "number": "4155551234"
75 },
76 "address": {
77 "addressLine1": "123 Main St",
78 "city": "San Francisco",
79 "stateOrProvince": "CA",
80 "postalCode": "94105",
81 "addressLine2": "Unit 1",
82 "country": "US"
83 },
84 "ownersProvided": true
85 }
86 },
87 "status": "verified",
88 "acceptedTos": true,
89 "isPayor": true,
90 "isPayee": false,
91 "createdAt": "2024-01-01T00:00:00Z",
92 "updatedAt": "2024-01-02T00:00:00Z",
93 "foreignId": "MY-DB-ID-12345"
94 },
95 "paymentSource": {
96 "type": "bankAccount",
97 "accountName": "My Checking Account",
98 "accountNumber": "99988767623",
99 "accountType": "CHECKING",
100 "bankName": "Chase",
101 "createdAt": "2021-01-01T00:00:00Z",
102 "id": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
103 "isDefaultDestination": true,
104 "isDefaultSource": true,
105 "routingNumber": "12345678",
106 "status": "VERIFIED",
107 "supportedCurrencies": [
108 "USD"
109 ],
110 "updatedAt": "2021-01-01T00:00:00Z"
111 },
112 "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769",
113 "vendorId": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
114 "vendor": {
115 "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
116 "name": "Big Box Store",
117 "email": "vendor@bigboxstore.com",
118 "isCustomer": false,
119 "accountType": "business",
120 "profile": {
121 "business": {
122 "legalBusinessName": "Big Box Store",
123 "taxIDProvided": false,
124 "email": "vendor@bigboxstore.com",
125 "businessType": "publicCorporation",
126 "ownersProvided": false
127 }
128 },
129 "status": "unverified",
130 "acceptedTos": false,
131 "isPayor": false,
132 "isPayee": true,
133 "createdAt": "2024-01-01T00:00:00Z",
134 "updatedAt": "2024-01-02T00:00:00Z",
135 "foreignId": "MY-DB-ID-90909"
136 },
137 "paymentDestination": {
138 "type": "check",
139 "addressLine1": "123 Main St",
140 "city": "New York",
141 "country": "US",
142 "createdAt": "2021-01-01T00:00:00Z",
143 "id": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
144 "isDefaultDestination": true,
145 "isDefaultSource": false,
146 "payToTheOrderOf": "John Doe",
147 "postalCode": "10001",
148 "stateOrProvince": "NY",
149 "supportedCurrencies": [
150 "USD"
151 ],
152 "updatedAt": "2021-01-01T00:00:00Z",
153 "addressLine2": "Apt 1"
154 },
155 "paymentDestinationId": "pm_5fde2f4a-facc-48ef-8f0d-6b7d087c7b18",
156 "paymentDestinationOptions": {
157 "type": "check",
158 "delivery": "MAIL"
159 },
160 "comments": [
161 {
162 "id": "ic_b3525b66-da94-4525-9f31-426bcf657128",
163 "text": "This is a comment",
164 "createdAt": "2021-01-01T00:00:00Z",
165 "updatedAt": "2021-01-01T00:00:00Z",
166 "user": {
167 "id": "user_ec3aafc8-ea86-408a-a6c1-545497badbbb",
168 "roles": [
169 "admin",
170 "approver"
171 ],
172 "createdAt": "2024-01-01T00:00:00Z",
173 "updatedAt": "2024-01-01T00:00:00Z",
174 "foreignId": "MY-DB-ID-12345",
175 "email": "john.doe@acme.com",
176 "name": "John Doe"
177 },
178 "associatedApprovalAction": {
179 "userId": "user_e24fc81c-c5ee-47e8-af42-4fe29d895506",
180 "action": "APPROVE"
181 }
182 }
183 ],
184 "lineItems": [
185 {
186 "id": "inli_26672f38-eb9a-48f1-a7a0-f1b855e38cd7",
187 "currency": "USD",
188 "createdAt": "2021-01-01T00:00:00Z",
189 "updatedAt": "2021-01-01T00:00:00Z",
190 "amount": 100,
191 "description": "Product A",
192 "name": "Product A",
193 "quantity": 1,
194 "unitPrice": 100,
195 "serviceStartDate": "2021-01-01T00:00:00Z",
196 "serviceEndDate": "2021-01-31T00:00:00Z",
197 "metadata": {
198 "key1": "value1",
199 "key2": "value2"
200 },
201 "glAccountId": "600394"
202 }
203 ],
204 "foreignId": "YOUR-DATABASE-ID",
205 "creatorUser": {
206 "id": "user_ec3aafc8-ea86-408a-a6c1-545497badbbb",
207 "roles": [
208 "admin",
209 "approver"
210 ],
211 "createdAt": "2024-01-01T00:00:00Z",
212 "updatedAt": "2024-01-01T00:00:00Z",
213 "foreignId": "MY-DB-ID-12345",
214 "email": "john.doe@acme.com",
215 "name": "John Doe"
216 },
217 "processedAt": "2021-01-01T00:00:00Z"
218 }
219 ]
220}