> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mercoa.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server.

# Update Bulk Invoices (Sync)

PUT https://api.mercoa.com/invoices
Content-Type: application/json

Update multiple invoices in bulk. This endpoint will process synchronously and return a list of invoices that were updated or failed to update.

Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/invoice/bulk/update

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `emitWebhooks` (boolean, optional, default: false) — If true, webhooks will be emitted for each invoice that is updated. By default, webhooks are not emitted.

### Body (application/json)

This endpoint expects an object.

- `invoices` (list of object, required)
  - `invoiceId` (string, required) — The ID or foreign ID of the invoice to update
  - `amount` (double, optional) — Total amount of invoice in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated.
  - `approvers` (list of object, optional) — Set approvers for this invoice.
    - `approvalSlotId` (string, required) — The identifier for the approval slot this user is assigned to.
    - `assignedUserId` (string, required) — The ID of the user who is assigned to the approval slot. To assign all eligible users to an approval slot, use "ANY".
  - `batchPayment` (boolean, optional) — If true, this invoice will be paid as a batch payment. Batches are automatically determined by Mercoa based on the payment source, destination, and scheduled payment date.
  - `creatorEntityId` (string, optional) — ID or foreign ID of entity who created this invoice. If creating a payable invoice (AP), this must be the same as the payerId. If creating a receivable invoice (AR), this must be the same as the vendorId.
  - `creatorUserId` (string, optional) — User ID or Foreign ID of entity user who created this invoice.
  - `currency` (enum, optional) — Currency code for the amount. Defaults to USD.
    - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BOV`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHE`, `CHF`, `CHW`, `CLF`, `CLP`, `COP`, `COU`, `CRC`, `CUC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MXV`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `CNY`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `USN`, `UYI`, `UYU`, `UYW`, `UZS`, `VED`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XAG`, `XAU`, `XBA`, `XBB`, `XBC`, `XBD`, `XCD`, `XDR`, `XOF`, `XPD`, `XPF`, `XPT`, `XSU`, `XTS`, `XUA`, `XXX`, `YER`, `ZAR`, `ZMW`, `ZWL`
  - `deductionDate` (datetime, optional) — Initial date when funds are scheduled to be deducted from payer's account.
  - `document` (string, optional) — Base64-encoded string. Supported file types include PNG, JPG, WEBP, PDF, and all Microsoft Office formats (automatically converted to PDF). Max file size 10MB. If the invoice already has a document, this will add a new document to the invoice.
  - `dueDate` (datetime, optional) — Due date of invoice.
  - `failureType` (enum, optional) — If the invoice failed to be paid, indicate the failure reason. Only applicable for invoices with custom payment methods.
    - Allowed values: `SOURCE_PAYMENT_ERROR`, `DESTINATION_PAYMENT_ERROR`, `REJECTED_HIGH_RISK`, `INSUFFICIENT_FUNDS`, `PROCESSING_ERROR`
  - `fees` (object, optional) — If using a custom payment method, you can override the default fees for this invoice. If not provided, the default fees for the custom payment method will be used.
    - `sourcePlatformMarkupFee` (double, required) — Fee charged to the payer (C2).
    - `destinationPlatformMarkupFee` (double, required) — Fee charged to the payee (C3).
  - `foreignId` (string, optional) — The ID used to identify this invoice in your system. This ID must be unique within each creatorEntity in your system, e.g. two invoices with the same creatorEntity may not have the same foreign ID.
  - `invoiceDate` (datetime, optional) — Date the invoice was issued.
  - `invoiceNumber` (string, optional)
  - `lineItems` (list of object, optional)
    - `amount` (double, optional) — Total amount of line item in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated.
    - `category` (string, optional) — Category of the line item.
    - `currency` (enum, optional) — Currency code for the amount. Defaults to USD.
      - Allowed values: `AED`, `AFN`, `ALL`, `AMD`, `ANG`, `AOA`, `ARS`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BOV`, `BRL`, `BSD`, `BTN`, `BWP`, `BYN`, `BZD`, `CAD`, `CDF`, `CHE`, `CHF`, `CHW`, `CLF`, `CLP`, `COP`, `COU`, `CRC`, `CUC`, `CUP`, `CVE`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `ERN`, `ETB`, `EUR`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HTG`, `HUF`, `IDR`, `ILS`, `INR`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `LSL`, `LYD`, `MAD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRU`, `MUR`, `MVR`, `MWK`, `MXN`, `MXV`, `MYR`, `MZN`, `NAD`, `NGN`, `NIO`, `NOK`, `NPR`, `NZD`, `OMR`, `PAB`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `CNY`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLE`, `SLL`, `SOS`, `SRD`, `SSP`, `STN`, `SVC`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `USD`, `USN`, `UYI`, `UYU`, `UYW`, `UZS`, `VED`, `VES`, `VND`, `VUV`, `WST`, `XAF`, `XAG`, `XAU`, `XBA`, `XBB`, `XBC`, `XBD`, `XCD`, `XDR`, `XOF`, `XPD`, `XPF`, `XPT`, `XSU`, `XTS`, `XUA`, `XXX`, `YER`, `ZAR`, `ZMW`, `ZWL`
    - `description` (string, optional)
    - `glAccountId` (string, optional) — ID of general ledger account associated with this line item.
    - `id` (string, optional) — If provided, will overwrite line item on the invoice with this ID. If not provided, will create a new line item.
    - `metadata` (map from string to string, optional)
    - `name` (string, optional)
    - `quantity` (double, optional)
    - `serviceEndDate` (datetime, optional)
    - `serviceStartDate` (datetime, optional)
    - `unitPrice` (double, optional) — Unit price of the line item in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated.
  - `metadata` (map from string to string, optional) — Metadata associated with this invoice.
  - `netTerms` (integer, optional) — Net terms in days. Must be a positive number.
  - `noteToSelf` (string, optional) — Note to self or memo on invoice.
  - `ocrJobId` (string, optional) — ID of the OCR job that processed this invoice.
  - `payerId` (string, optional) — ID or foreign ID of the payer of this invoice.
  - `paymentDestinationConfirmed` (boolean, optional) — Set to true if the payment destination has been confirmed by the vendor or if the payment destination should default to the selected payment destination on the vendor portal.
  - `paymentDestinationId` (string, optional) — ID of payment destination for this invoice. If not provided, will attempt to use the default payment destination for the vendor when creating an invoice if a default payment destination exists for the vendor.
  - `paymentDestinationOptions` (object, optional) — Options for the payment destination. Depending on the payment destination, this may include things such as check delivery method.
    - `type`: `check`
      - `delivery` (enum, optional) — Delivery method for check disbursements. Defaults to MAIL.
        - Allowed values: `PRINT`, `MAIL`, `MAIL_PRIORITY`, `MAIL_UPS_NEXT_DAY`
      - `printDescription` (boolean, optional) — If true, prints the invoice description (noteToSelf) on the check note. Defaults to false.
    - `type`: `bankAccount`
      - `delivery` (enum, optional) — Delivery method for ACH payments. Defaults to ACH_SAME_DAY.
        - Allowed values: `ACH_STANDARD`, `ACH_SAME_DAY`, `ACH_ACCELERATED`
      - `description` (string, optional) — ACH Statement Description. By default, this will be 'AP' followed by the first 8 characters of the invoice ID (for a single invoice) or the first 8 characters of the transaction ID (for a batch payment). Must be at least 4 characters and no more than 10 characters, and follow this regex pattern `^[a-zA-Z0-9\-#.$&* ]{4,10}$`
    - `type`: `utility`
      - `accountId` (string, required) — The ID for the utility account to pay with. Links to accounts listed on payor/payee relationship.
    - `type`: `custom`
      - `dynamicUrls` (map from string to string, optional) — Map of field names to dynamic URL values that will be used for dynamicUrl fields in custom payment method schemas
  - `paymentSchedule` (object, optional) — If this is a recurring invoice, this will be the payment schedule for the invoice. If not provided, this will be a one-time invoice.
    - `type`: `oneTime`
      - `ends` (integer or datetime, optional) — When to end the payments, either a number of occurrences or a date. Defaults to never ending if not specified
      - `repeatEvery` (integer, optional) — How often to repeat the payments. Defaults to 1. Must be greater than 0. For example, if repeatEvery is set to 2 and this is a daily payment, the payment will be made every other day. If repeatEvery is set to 3 and this is a weekly payment, the payment will be made every third week.
    - `type`: `daily`
      - `ends` (integer or datetime, optional) — When to end the payments, either a number of occurrences or a date. Defaults to never ending if not specified
      - `repeatEvery` (integer, optional) — How often to repeat the payments. Defaults to 1. Must be greater than 0. For example, if repeatEvery is set to 2 and this is a daily payment, the payment will be made every other day. If repeatEvery is set to 3 and this is a weekly payment, the payment will be made every third week.
    - `type`: `weekly`
      - `repeatOn` (list of enum, required)
        - Allowed values: `0`, `1`, `2`, `3`, `4`, `5`, `6`
      - `ends` (integer or datetime, optional) — When to end the payments, either a number of occurrences or a date. Defaults to never ending if not specified
      - `repeatEvery` (integer, optional) — How often to repeat the payments. Defaults to 1. Must be greater than 0. For example, if repeatEvery is set to 2 and this is a daily payment, the payment will be made every other day. If repeatEvery is set to 3 and this is a weekly payment, the payment will be made every third week.
    - `type`: `monthly`
      - `repeatOnDay` (integer, required) — Day of the month to repeat on. Positive values (1-31): Represent the day of the month counting from the start (e.g., 10 is the 10th day of the month). Negative values (-1 to -31): Represent the day of the month counting backward from the end (e.g., -1 is the last day of the month, -2 is the second-to-last day).
      - `ends` (integer or datetime, optional) — When to end the payments, either a number of occurrences or a date. Defaults to never ending if not specified
      - `repeatEvery` (integer, optional) — How often to repeat the payments. Defaults to 1. Must be greater than 0. For example, if repeatEvery is set to 2 and this is a daily payment, the payment will be made every other day. If repeatEvery is set to 3 and this is a weekly payment, the payment will be made every third week.
      - `dayOffset` (integer, optional, deprecated) — deprecated. will be removed in the future and will always be 0.
    - `type`: `yearly`
      - `repeatOnDay` (integer, required) — Day of the month to repeat on. Positive values (1-31): Represent the day of the month counting from the start (e.g., 10 is the 10th day of the month). Negative values (-1 to -31): Represent the day of the month counting backward from the end (e.g., -1 is the last day of the month, -2 is the second-to-last day).
      - `repeatOnMonth` (integer, required) — Month to repeat on (1-12).
      - `ends` (integer or datetime, optional) — When to end the payments, either a number of occurrences or a date. Defaults to never ending if not specified
      - `repeatEvery` (integer, optional) — How often to repeat the payments. Defaults to 1. Must be greater than 0. For example, if repeatEvery is set to 2 and this is a daily payment, the payment will be made every other day. If repeatEvery is set to 3 and this is a weekly payment, the payment will be made every third week.
  - `paymentSourceId` (string, optional) — ID of payment source for this invoice. If not provided, will attempt to use the default payment source for the payer when creating an invoice if a default payment source exists for the payer.
  - `paymentSourceOptions` (object, optional) — Options for the payment source. Depending on the payment source, this may include things such as BNPL configuration.
    - `type`: `bnpl`
      - `acceptedTerms` (boolean, required) — Whether the user has agreed to the BNPL terms
      - `defermentWeeks` (integer, required) — The number of weeks to defer repayment
      - `installmentsStartDate` (string, required) — The start date for installments in YYYY-MM-DD format
      - `downpaymentId` (string, optional) — The ID of the downpayment to use for the BNPL payment.
      - `loanId` (string, optional) — The ID of the loan to use for the BNPL payment.
  - `serviceEndDate` (datetime, optional)
  - `serviceStartDate` (datetime, optional)
  - `settlementDate` (datetime, optional) — Date of funds settlement.
  - `shippingAmount` (double, optional) — Shipping amount for this invoice.
  - `status` (enum, optional)
    - Allowed values: `UNASSIGNED`, `DRAFT`, `NEW`, `APPROVED`, `SCHEDULED`, `PENDING`, `PAID`, `ARCHIVED`, `REFUSED`, `CANCELED`, `FAILED`
  - `taxAmount` (double, optional) — Tax amount for this invoice.
  - `vendorCreditIds` (list of string, optional) — The IDs of the vendor credits to be applied to this invoice. Passing this field will un-apply any previously applied vendor credits.
  - `vendorId` (string, optional) — ID or foreign ID of the vendor of this invoice.
  - `uploadedImage` (string, optional, deprecated) — DEPRECATED. Use document field instead.

## Response

### 200

- `data` (list of object, required)
  - `id` (string, optional) — The ID of the invoice that was updated. If the invoice was not updated, this will be undefined
  - `foreignId` (string, optional) — If provided, this is the foreign ID of the invoice that was updated.
  - `error` (string, optional) — The error message if the invoice was not updated

## Errors

### 400 Bad Request

- `errorName` ("BadRequest", required)
- `content` (string, required)

### 401 Unauthorized

- `errorName` ("Unauthorized", required)
- `content` (string, required)

### 403 Forbidden

- `errorName` ("Forbidden", required)
- `content` (string, required)

### 404 Not Found

- `errorName` ("NotFound", required)
- `content` (string, required)

### 409 Conflict

- `errorName` ("Conflict", required)
- `content` (string, required)

### 500 Internal Server Error

- `errorName` ("InternalServerError", required)
- `content` (string, required)

### 501 Unimplemented

- `errorName` ("Unimplemented", required)
- `content` (string, required)

## Examples

**Request**

```json
{
  "invoices": [
    {
      "invoiceId": "inv_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "amount": 100,
      "currency": "USD",
      "dueDate": "2024-01-31T00:00:00Z",
      "invoiceDate": "2024-01-01T00:00:00Z",
      "invoiceNumber": "INV-001",
      "lineItems": [
        {
          "amount": 50,
          "description": "Item 1",
          "quantity": 1
        },
        {
          "amount": 50,
          "description": "Item 2",
          "quantity": 1
        }
      ],
      "status": "NEW"
    }
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "foreignId": "YOUR-INVOICE-ID"
    },
    {
      "foreignId": "YOUR-SECOND-INVOICE-ID",
      "error": "Invoice update failed"
    }
  ]
}
```

**SDK Code**

```python FromObjects
import requests

url = "https://api.mercoa.com/invoices"

payload = { "invoices": [
        {
            "invoiceId": "inv_21661ac1-a2a8-4465-a6c0-64474ba8181d",
            "amount": 100,
            "currency": "USD",
            "dueDate": "2024-01-31T00:00:00Z",
            "invoiceDate": "2024-01-01T00:00:00Z",
            "invoiceNumber": "INV-001",
            "lineItems": [
                {
                    "amount": 50,
                    "description": "Item 1",
                    "quantity": 1
                },
                {
                    "amount": 50,
                    "description": "Item 2",
                    "quantity": 1
                }
            ],
            "status": "NEW"
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```typescript FromObjects
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.invoice.bulk.update({
    body: {
        invoices: [{
                invoiceId: "inv_21661ac1-a2a8-4465-a6c0-64474ba8181d",
                status: "NEW",
                amount: 100,
                currency: "USD",
                dueDate: new Date("2024-01-31T00:00:00.000Z"),
                invoiceDate: new Date("2024-01-01T00:00:00.000Z"),
                invoiceNumber: "INV-001",
                lineItems: [{
                        description: "Item 1",
                        amount: 50,
                        quantity: 1
                    }, {
                        description: "Item 2",
                        amount: 50,
                        quantity: 1
                    }]
            }]
    }
});

```

```go FromObjects
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mercoa.com/invoices"

	payload := strings.NewReader("{\n  \"invoices\": [\n    {\n      \"invoiceId\": \"inv_21661ac1-a2a8-4465-a6c0-64474ba8181d\",\n      \"amount\": 100,\n      \"currency\": \"USD\",\n      \"dueDate\": \"2024-01-31T00:00:00Z\",\n      \"invoiceDate\": \"2024-01-01T00:00:00Z\",\n      \"invoiceNumber\": \"INV-001\",\n      \"lineItems\": [\n        {\n          \"amount\": 50,\n          \"description\": \"Item 1\",\n          \"quantity\": 1\n        },\n        {\n          \"amount\": 50,\n          \"description\": \"Item 2\",\n          \"quantity\": 1\n        }\n      ],\n      \"status\": \"NEW\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	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 FromObjects
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/invoices")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"invoices\": [\n    {\n      \"invoiceId\": \"inv_21661ac1-a2a8-4465-a6c0-64474ba8181d\",\n      \"amount\": 100,\n      \"currency\": \"USD\",\n      \"dueDate\": \"2024-01-31T00:00:00Z\",\n      \"invoiceDate\": \"2024-01-01T00:00:00Z\",\n      \"invoiceNumber\": \"INV-001\",\n      \"lineItems\": [\n        {\n          \"amount\": 50,\n          \"description\": \"Item 1\",\n          \"quantity\": 1\n        },\n        {\n          \"amount\": 50,\n          \"description\": \"Item 2\",\n          \"quantity\": 1\n        }\n      ],\n      \"status\": \"NEW\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java FromObjects
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.mercoa.com/invoices")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"invoices\": [\n    {\n      \"invoiceId\": \"inv_21661ac1-a2a8-4465-a6c0-64474ba8181d\",\n      \"amount\": 100,\n      \"currency\": \"USD\",\n      \"dueDate\": \"2024-01-31T00:00:00Z\",\n      \"invoiceDate\": \"2024-01-01T00:00:00Z\",\n      \"invoiceNumber\": \"INV-001\",\n      \"lineItems\": [\n        {\n          \"amount\": 50,\n          \"description\": \"Item 1\",\n          \"quantity\": 1\n        },\n        {\n          \"amount\": 50,\n          \"description\": \"Item 2\",\n          \"quantity\": 1\n        }\n      ],\n      \"status\": \"NEW\"\n    }\n  ]\n}")
  .asString();
```

```php FromObjects
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.mercoa.com/invoices', [
  'body' => '{
  "invoices": [
    {
      "invoiceId": "inv_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "amount": 100,
      "currency": "USD",
      "dueDate": "2024-01-31T00:00:00Z",
      "invoiceDate": "2024-01-01T00:00:00Z",
      "invoiceNumber": "INV-001",
      "lineItems": [
        {
          "amount": 50,
          "description": "Item 1",
          "quantity": 1
        },
        {
          "amount": 50,
          "description": "Item 2",
          "quantity": 1
        }
      ],
      "status": "NEW"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp FromObjects
using RestSharp;

var client = new RestClient("https://api.mercoa.com/invoices");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"invoices\": [\n    {\n      \"invoiceId\": \"inv_21661ac1-a2a8-4465-a6c0-64474ba8181d\",\n      \"amount\": 100,\n      \"currency\": \"USD\",\n      \"dueDate\": \"2024-01-31T00:00:00Z\",\n      \"invoiceDate\": \"2024-01-01T00:00:00Z\",\n      \"invoiceNumber\": \"INV-001\",\n      \"lineItems\": [\n        {\n          \"amount\": 50,\n          \"description\": \"Item 1\",\n          \"quantity\": 1\n        },\n        {\n          \"amount\": 50,\n          \"description\": \"Item 2\",\n          \"quantity\": 1\n        }\n      ],\n      \"status\": \"NEW\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift FromObjects
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["invoices": [
    [
      "invoiceId": "inv_21661ac1-a2a8-4465-a6c0-64474ba8181d",
      "amount": 100,
      "currency": "USD",
      "dueDate": "2024-01-31T00:00:00Z",
      "invoiceDate": "2024-01-01T00:00:00Z",
      "invoiceNumber": "INV-001",
      "lineItems": [
        [
          "amount": 50,
          "description": "Item 1",
          "quantity": 1
        ],
        [
          "amount": 50,
          "description": "Item 2",
          "quantity": 1
        ]
      ],
      "status": "NEW"
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/invoices")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```