---
title: "Assign to bills or invoices · Transactions · COUNT Partner API"
description: "Applies a transaction as payment against one or more bills or invoices. POST /partners/transactions/{uuid}/assign-to-bills-invoices"
canonical: "https://developers.getcount.com/reference/transactions/assign-transaction-to-bills-invoices"
source: "https://developers.getcount.com/reference/transactions/assign-transaction-to-bills-invoices"
---
[Transactions](https://developers.getcount.com/reference/transactions) / Assign to bills or invoices

# Assign to bills or invoices

POST `/partners/transactions/{uuid}/assign-to-bills-invoices`

Applies a transaction as payment against one or more bills or invoices.

HMAC signature + Bearer access token

[Try this request](https://developers.getcount.com/tools/try-it?method=POST&path=%2Fpartners%2Ftransactions%2F%7Buuid%7D%2Fassign-to-bills-invoices&body=%7B%0A++%22matchingType%22%3A+%22invoice%22%2C%0A++%22records%22%3A+%5B%0A++++%7B%0A++++++%22id%22%3A+%22f6a7b8c9-d0e1-2345-fabc-456789012345%22%2C%0A++++++%22paymentAmount%22%3A+150%0A++++%7D%0A++%5D%2C%0A++%22withCaution%22%3A+false%0A%7D)

[Chart of Accounts API](https://developers.getcount.com/reference/chart-of-accounts) [Bills API](https://developers.getcount.com/reference/bills) [Invoices API](https://developers.getcount.com/reference/invoices)

#### Path parameters

`uuid` uuid required

The UUID of the transaction (the payment).

#### Request body

`matchingType` enum required

Whether to apply against bills or invoices.

One of: `bill`, `invoice`

`records` array required

Targets to apply the transaction against.

`id` uuid required

UUID of the bill or invoice.

`paymentAmount` number required

Amount of this transaction to apply to the target.

`withCaution` boolean

When true, skips some reconciliation guards. Use sparingly.

#### Responses

`200` Transaction assigned.

`400` Bad request — assignment amount exceeds the transaction or target balance.

[Previous PATCH Bulk exclude transactions](https://developers.getcount.com/reference/transactions/bulk-exclude-transactions) [Next PUT Split a transaction](https://developers.getcount.com/reference/transactions/split-transaction)

POST `https://api.getcount.com/partners/transactions/{uuid}/assign-to-bills-invoices`

Request

```javascript
import crypto from 'node:crypto';

const BASE_URL = 'https://api.getcount.com';
const CLIENT_ID = process.env.COUNT_CLIENT_ID;
const CLIENT_SECRET = process.env.COUNT_CLIENT_SECRET;
const ACCESS_TOKEN = process.env.COUNT_ACCESS_TOKEN;

const method = 'POST';
const signingPath = '/transactions/3fa85f64-5717-4562-b3fc-2c963f66afa6/assign-to-bills-invoices';
const timestamp = Math.floor(Date.now() / 1000).toString();
const body = {
  "matchingType": "invoice",
  "records": [
    {
      "id": "f6a7b8c9-d0e1-2345-fabc-456789012345",
      "paymentAmount": 150
    }
  ],
  "withCaution": false
};
const bodyString = JSON.stringify(body);

const bodyHash = crypto.createHash('sha256').update(bodyString).digest('hex');
const baseString = `${method}:${signingPath}:${timestamp}:${bodyHash}`;
const signature = crypto.createHmac('sha256', CLIENT_SECRET).update(baseString).digest('hex');

const response = await fetch(`${BASE_URL}/partners/transactions/3fa85f64-5717-4562-b3fc-2c963f66afa6/assign-to-bills-invoices`, {
  method,
  headers: {
    'x-client-id': CLIENT_ID,
    'x-timestamp': timestamp,
    'x-signature': signature,
    'Content-Type': 'application/json',
    Authorization: `Bearer ${ACCESS_TOKEN}`,
  },
  body: bodyString,
});

console.log(await response.json());
```

Response · 200

```json
{
  "status": "success",
  "message": "Transaction assigned."
}
```
