---
title: "Supplier bills | Docs | ERP by R&D Copilot"
description: "Record a supplier bill, read its match with the order and the receipts, and take it through approval to payment."
canonical: "https://erp.rdcopilot.com/docs/api-reference/supplier-bills/"
language: en
updated: 2026-11-22
---

# Supplier bills

Record a supplier bill, read its match with the order and the receipts, and take it through approval to payment.

## List supplier bills

GET `/erp/v1/supplier-bills`

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `status` | query | `string` | Nooptional | Only bills in this status. One of `draft`, `awaiting_approval`, `approved`, `scheduled`, `paid` |
| `match` | query | `string` | Nooptional | Only bills with this result of the match. One of `matched`, `quantity_differs`, `price_differs`, `receipt_missing` |
| `supplierId` | query | `string (uuid)` | Nooptional | Only the bills of this supplier. |
| `limit` | query | `integer` | Nooptional | Records per page, from 1 to 500. Default `100` Range `1` – `500` |
| `cursor` | query | `string` | Nooptional | The `nextCursor` of the previous page. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | A page of supplier bills. | `SupplierBillPage` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/erp/v1/supplier-bills?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills?limit=20`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills?limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills?limit=20');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `200`

JSON

```json
{
  "items": [
    {
      "id": "d8667a41-6863-4678-a198-fe94a1e33a17",
      "number": "FF-0605",
      "supplierNumber": "BO-26-0881",
      "supplierId": "e649fbee-e600-4db7-ab58-94e251d0fe9a",
      "supplierName": "Brânzeturi Obcina SRL",
      "purchaseOrderId": "403660ee-f721-4e98-b224-59e59e245387",
      "purchaseOrderNumber": "CA-0729",
      "date": "2026-11-17",
      "lines": [
        {
          "code": "LA-0307",
          "quantity": "96",
          "unitPrice": "15.20",
          "net": "1459.20"
        }
      ],
      "net": "1459.20",
      "vat": "160.51",
      "total": "1619.71",
      "vatBreakdown": [
        {
          "rate": "11",
          "base": "1459.20",
          "vat": "160.51"
        }
      ],
      "currency": "RON",
      "status": "awaiting_approval",
      "approvals": [],
      "nextStep": "requester",
      "held": false,
      "holdReason": null,
      "rejectionReason": null,
      "scheduledFor": null,
      "match": {
        "result": "quantity_differs",
        "differences": [
          {
            "code": "LA-0307",
            "kind": "quantity",
            "ordered": "96",
            "received": "90",
            "billed": "96",
            "orderedPrice": "15.20",
            "billedPrice": "15.20"
          }
        ]
      },
      "revision": 2
    },
    {
      "id": "d76678ae-6934-420d-bf9d-8d8692d0b952",
      "number": "FF-0606",
      "supplierNumber": "AC-2026-1207",
      "supplierId": "678cbd61-7ec7-49de-bff5-11581bfffffc",
      "supplierName": "Ambalaje Carpatin SRL",
      "purchaseOrderId": "f5085807-5ee6-47b4-92e1-6144464b73ed",
      "purchaseOrderNumber": "CA-0730",
      "date": "2026-11-18",
      "lines": [
        {
          "code": "CT-0610",
          "quantity": "60",
          "unitPrice": "10.30",
          "net": "618.00"
        }
      ],
      "net": "618.00",
      "vat": "129.78",
      "total": "747.78",
      "vatBreakdown": [
        {
          "rate": "21",
          "base": "618.00",
          "vat": "129.78"
        }
      ],
      "currency": "RON",
      "status": "awaiting_approval",
      "approvals": [],
      "nextStep": "requester",
      "held": false,
      "holdReason": null,
      "rejectionReason": null,
      "scheduledFor": null,
      "match": {
        "result": "price_differs",
        "differences": [
          {
            "code": "CT-0610",
            "kind": "price",
            "ordered": "60",
            "received": "60",
            "billed": "60",
            "orderedPrice": "9.80",
            "billedPrice": "10.30"
          }
        ]
      },
      "revision": 2
    }
  ],
  "nextCursor": null
}
```

## Create a supplier bill

POST `/erp/v1/supplier-bills`

Records the bill of a supplier against a purchase order, as a draft. The bill carries the number printed on the supplier’s document and the quantities and prices it asks for.

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `supplierId` | `string (uuid)` | Yesrequired | The supplier of the purchase order. |
| `purchaseOrderId` | `string (uuid)` | Yesrequired | The purchase order the bill is against. |
| `supplierNumber` | `string` | Yesrequired | The number printed on the supplier’s document. |
| `date` | `string (date)` | Yesrequired | The date on the bill, today or earlier. |
| `lines` | `BillLineInput[]` | Yesrequired | The lines of the bill: an item of the order once each. |
| `lines[].code` | `string` | Yesrequired | Code of the item. |
| `lines[].quantity` | `string` | Yesrequired | Whole units, at least 1. |
| `lines[].unitPrice` | `string` | Yesrequired | Net price of one unit on the bill, above zero. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | `partner_not_found`: The customer or supplier does not exist, or is not one of the kind the request needs. `purchase_order_not_found`: The purchase order does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `duplicate_bill`: This supplier already has a bill with this number. | `Error` |
| `422` | `supplier_mismatch`: The supplier of the bill is not the supplier of the purchase order. `number_required`: The number on the supplier's document is empty or longer than 40 characters. `invalid_date`: A date is not a day of the calendar, or a bill is dated after today. `no_lines`: The document has no line. `duplicate_item`: An item appears on more than one line. `item_not_on_order`: The item is not on the purchase order. `invalid_quantity`: A quantity is not a whole number from 1 to 1000000. `invalid_price`: A price is not a positive amount. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "0a662801-2e54-4a08-9462-807d05392b0f",
  "supplierId": "14b3279c-01f1-464f-bad7-ff50dadac05f",
  "purchaseOrderId": "fb086179-5513-43e2-a802-1a277c3b0d01",
  "supplierNumber": "MV-2026-3355",
  "date": "2026-11-23",
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "33.00"
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "0a662801-2e54-4a08-9462-807d05392b0f",
    "supplierId": "14b3279c-01f1-464f-bad7-ff50dadac05f",
    "purchaseOrderId": "fb086179-5513-43e2-a802-1a277c3b0d01",
    "supplierNumber": "MV-2026-3355",
    "date": "2026-11-23",
    "lines": [
      {
        "code": "FA-0010",
        "quantity": "4",
        "unitPrice": "33.00"
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '0a662801-2e54-4a08-9462-807d05392b0f',
        'supplierId': '14b3279c-01f1-464f-bad7-ff50dadac05f',
        'purchaseOrderId': 'fb086179-5513-43e2-a802-1a277c3b0d01',
        'supplierNumber': 'MV-2026-3355',
        'date': '2026-11-23',
        'lines': [
            {
                'code': 'FA-0010',
                'quantity': '4',
                'unitPrice': '33.00',
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "0a662801-2e54-4a08-9462-807d05392b0f",
  "supplierId": "14b3279c-01f1-464f-bad7-ff50dadac05f",
  "purchaseOrderId": "fb086179-5513-43e2-a802-1a277c3b0d01",
  "supplierNumber": "MV-2026-3355",
  "date": "2026-11-23",
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "33.00"
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "0a662801-2e54-4a08-9462-807d05392b0f",
  "supplierId": "14b3279c-01f1-464f-bad7-ff50dadac05f",
  "purchaseOrderId": "fb086179-5513-43e2-a802-1a277c3b0d01",
  "supplierNumber": "MV-2026-3355",
  "date": "2026-11-23",
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "33.00"
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "0a662801-2e54-4a08-9462-807d05392b0f",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 1
}
```

## Get a supplier bill

GET `/erp/v1/supplier-bills/{supplierBillId}`

Returns the bill with its match: what the order asked for, what was received and what the bill asks, line by line.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `200` | The bill at its current revision. | `SupplierBill` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl "$RDC_BASE_URL/erp/v1/supplier-bills/d5667588-773a-4c33-a697-09c7c381259b" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/d5667588-773a-4c33-a697-09c7c381259b`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
  },
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'GET',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/d5667588-773a-4c33-a697-09c7c381259b',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/d5667588-773a-4c33-a697-09c7c381259b');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
    ],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/d5667588-773a-4c33-a697-09c7c381259b");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `200`

JSON

```json
{
  "id": "d5667588-773a-4c33-a697-09c7c381259b",
  "number": "FF-0604",
  "supplierNumber": "MV-2026-3318",
  "supplierId": "14b3279c-01f1-464f-bad7-ff50dadac05f",
  "supplierName": "Moara Vadului SRL",
  "purchaseOrderId": "41366281-fe1e-4fab-b707-c3d8e42e595d",
  "purchaseOrderNumber": "CA-0728",
  "date": "2026-11-16",
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "120",
      "unitPrice": "32.50",
      "net": "3900.00"
    }
  ],
  "net": "3900.00",
  "vat": "429.00",
  "total": "4329.00",
  "vatBreakdown": [
    {
      "rate": "11",
      "base": "3900.00",
      "vat": "429.00"
    }
  ],
  "currency": "RON",
  "status": "awaiting_approval",
  "approvals": [
    {
      "step": "requester",
      "at": "2026-11-17T08:10:00Z"
    }
  ],
  "nextStep": "lead",
  "held": false,
  "holdReason": null,
  "rejectionReason": null,
  "scheduledFor": null,
  "match": {
    "result": "matched",
    "differences": []
  },
  "revision": 3
}
```

## Correct a draft supplier bill

PUT `/erp/v1/supplier-bills/{supplierBillId}`

Replaces the lines of a bill that is a draft, for example after it was rejected or recorded with a wrong price.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |
| `lines` | `BillLineInput[]` | Yesrequired | The new lines of the bill. |
| `lines[].code` | `string` | Yesrequired | Code of the item. |
| `lines[].quantity` | `string` | Yesrequired | Whole units, at least 1. |
| `lines[].unitPrice` | `string` | Yesrequired | Net price of one unit on the bill, above zero. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. | `Error` |
| `422` | `no_lines`: The document has no line. `duplicate_item`: An item appears on more than one line. `item_not_on_order`: The item is not on the purchase order. `invalid_quantity`: A quantity is not a whole number from 1 to 1000000. `invalid_price`: A price is not a positive amount. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X PUT "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "a8c0555f-4946-451c-9ebd-35f66b40545b",
  "expectedRevision": 1,
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "32.50"
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf`, {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "a8c0555f-4946-451c-9ebd-35f66b40545b",
    "expectedRevision": 1,
    "lines": [
      {
        "code": "FA-0010",
        "quantity": "4",
        "unitPrice": "32.50"
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'PUT',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'a8c0555f-4946-451c-9ebd-35f66b40545b',
        'expectedRevision': 1,
        'lines': [
            {
                'code': 'FA-0010',
                'quantity': '4',
                'unitPrice': '32.50',
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "a8c0555f-4946-451c-9ebd-35f66b40545b",
  "expectedRevision": 1,
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "32.50"
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "a8c0555f-4946-451c-9ebd-35f66b40545b",
  "expectedRevision": 1,
  "lines": [
    {
      "code": "FA-0010",
      "quantity": "4",
      "unitPrice": "32.50"
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "a8c0555f-4946-451c-9ebd-35f66b40545b",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 2
}
```

## Submit a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/submit`

Sends a draft for approval. A bill whose items have not been received yet cannot be submitted; a bill whose match differs can, so that someone can reject or hold it.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. `receipt_missing`: None of the billed items has been received on the purchase order, so the bill cannot be sent for approval. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/submit" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "9e46194d-c2c1-4eb1-ac44-f65912a87e1c",
  "expectedRevision": 2
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/submit`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "9e46194d-c2c1-4eb1-ac44-f65912a87e1c",
    "expectedRevision": 2
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/submit',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '9e46194d-c2c1-4eb1-ac44-f65912a87e1c',
        'expectedRevision': 2,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "9e46194d-c2c1-4eb1-ac44-f65912a87e1c",
  "expectedRevision": 2
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/submit');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/submit");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "9e46194d-c2c1-4eb1-ac44-f65912a87e1c",
  "expectedRevision": 2
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "9e46194d-c2c1-4eb1-ac44-f65912a87e1c",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 3
}
```

## Approve a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/approve`

Takes the next step of the approval chain: `requester`, then `lead`, then `finance`. Only a bill that matches its order and receipts can be approved, and not while it is on hold. After the last step the status is `approved`.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |
| `step` | `string` | Yesrequired | The step you approve for. It must be the `nextStep` of the bill. One of `requester`, `lead`, `finance` |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. `bill_held`: The bill is on hold and cannot be approved. `wrong_approval_step`: The step is not the next one of the approval chain. `match_differs`: The bill does not match its order and receipts: a quantity or a price differs. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/approve" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "0fe01cde-89a3-484c-9bfc-86375e6b22a2",
  "expectedRevision": 3,
  "step": "requester"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/approve`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "0fe01cde-89a3-484c-9bfc-86375e6b22a2",
    "expectedRevision": 3,
    "step": "requester"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/approve',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '0fe01cde-89a3-484c-9bfc-86375e6b22a2',
        'expectedRevision': 3,
        'step': 'requester',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "0fe01cde-89a3-484c-9bfc-86375e6b22a2",
  "expectedRevision": 3,
  "step": "requester"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/approve');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "0fe01cde-89a3-484c-9bfc-86375e6b22a2",
  "expectedRevision": 3,
  "step": "requester"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "0fe01cde-89a3-484c-9bfc-86375e6b22a2",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 4
}
```

## Reject a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/reject`

Sends a bill back to draft with the reason. The approvals given so far are cleared and a hold ends.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |
| `reason` | `string` | Yesrequired | Why, in 1 to 200 characters. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. | `Error` |
| `422` | The reason is empty or longer than 200 characters. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/reject" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "1db1fe1a-6629-4d21-92d6-af7c968b1232",
  "expectedRevision": 4,
  "reason": "Billed 96 units, 90 received. Waiting for the supplier to credit 6."
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/reject`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "1db1fe1a-6629-4d21-92d6-af7c968b1232",
    "expectedRevision": 4,
    "reason": "Billed 96 units, 90 received. Waiting for the supplier to credit 6."
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/reject',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '1db1fe1a-6629-4d21-92d6-af7c968b1232',
        'expectedRevision': 4,
        'reason': 'Billed 96 units, 90 received. Waiting for the supplier to credit 6.',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "1db1fe1a-6629-4d21-92d6-af7c968b1232",
  "expectedRevision": 4,
  "reason": "Billed 96 units, 90 received. Waiting for the supplier to credit 6."
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/reject');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/reject");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "1db1fe1a-6629-4d21-92d6-af7c968b1232",
  "expectedRevision": 4,
  "reason": "Billed 96 units, 90 received. Waiting for the supplier to credit 6."
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "1db1fe1a-6629-4d21-92d6-af7c968b1232",
  "status": "accepted",
  "aggregateId": "d8667a41-6863-4678-a198-fe94a1e33a17",
  "aggregateRevision": 5
}
```

## Hold a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/hold`

Stops approval of a bill that is awaiting it, with the reason. Release it when the cause is gone.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |
| `reason` | `string` | Yesrequired | Why, in 1 to 200 characters. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. `bill_already_held`: The bill is already on hold. | `Error` |
| `422` | The reason is empty or longer than 200 characters. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/hold" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "7b84fe2c-5013-428a-87b7-0f6a20fb634c",
  "expectedRevision": 2,
  "reason": "Waiting for the late 6 units"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/hold`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "7b84fe2c-5013-428a-87b7-0f6a20fb634c",
    "expectedRevision": 2,
    "reason": "Waiting for the late 6 units"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/hold',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '7b84fe2c-5013-428a-87b7-0f6a20fb634c',
        'expectedRevision': 2,
        'reason': 'Waiting for the late 6 units',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "7b84fe2c-5013-428a-87b7-0f6a20fb634c",
  "expectedRevision": 2,
  "reason": "Waiting for the late 6 units"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/hold');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/hold");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "7b84fe2c-5013-428a-87b7-0f6a20fb634c",
  "expectedRevision": 2,
  "reason": "Waiting for the late 6 units"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "7b84fe2c-5013-428a-87b7-0f6a20fb634c",
  "status": "accepted",
  "aggregateId": "d8667a41-6863-4678-a198-fe94a1e33a17",
  "aggregateRevision": 3
}
```

## Release a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/release`

Ends the hold of a bill. It goes on from the step it was at.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. `bill_not_held`: The bill is not on hold. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/release" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "989fb652-f77d-4526-86a8-f6ac93506d9a",
  "expectedRevision": 3
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/release`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "989fb652-f77d-4526-86a8-f6ac93506d9a",
    "expectedRevision": 3
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/release',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '989fb652-f77d-4526-86a8-f6ac93506d9a',
        'expectedRevision': 3,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "989fb652-f77d-4526-86a8-f6ac93506d9a",
  "expectedRevision": 3
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/release');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/release");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "989fb652-f77d-4526-86a8-f6ac93506d9a",
  "expectedRevision": 3
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "989fb652-f77d-4526-86a8-f6ac93506d9a",
  "status": "accepted",
  "aggregateId": "d8667a41-6863-4678-a198-fe94a1e33a17",
  "aggregateRevision": 4
}
```

## Schedule a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/schedule`

Sets the day an approved bill is paid. The day is today or later.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |
| `on` | `string (date)` | Yesrequired | The day to pay: today or later. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. | `Error` |
| `422` | `invalid_date`: A date is not a day of the calendar, or a bill is dated after today. `date_in_the_past`: The payment day is before today. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/schedule" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "a07813a1-0d2f-4f0b-a79f-bf9dd98d6777",
  "expectedRevision": 6,
  "on": "2026-11-27"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/schedule`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "a07813a1-0d2f-4f0b-a79f-bf9dd98d6777",
    "expectedRevision": 6,
    "on": "2026-11-27"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/schedule',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'a07813a1-0d2f-4f0b-a79f-bf9dd98d6777',
        'expectedRevision': 6,
        'on': '2026-11-27',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "a07813a1-0d2f-4f0b-a79f-bf9dd98d6777",
  "expectedRevision": 6,
  "on": "2026-11-27"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/schedule');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/schedule");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "a07813a1-0d2f-4f0b-a79f-bf9dd98d6777",
  "expectedRevision": 6,
  "on": "2026-11-27"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "a07813a1-0d2f-4f0b-a79f-bf9dd98d6777",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 7
}
```

## Record the payment of a supplier bill

POST `/erp/v1/supplier-bills/{supplierBillId}/payment`

Records that a scheduled bill was paid. It is accepted on the scheduled day and after it, not before.

### Parameters

| Name | In | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `supplierBillId` | path | `string (uuid)` | Yesrequired | The supplier bill. |

### Request body

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `operationId` | `string (uuid)` | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
| `expectedRevision` | `integer` | Yesrequired | The revision of the bill you read. |

### Responses

| Status | Meaning | Body |
| --- | --- | --- |
| `202` | The change was accepted. The body is the operation result: `aggregateId` is the record that was created or changed. | `OperationResult` |
| `401` | The token is missing, has expired or is not ours. | `Error` |
| `403` | The token does not give access to this company or operation. | `Error` |
| `404` | The supplier bill does not exist. | `Error` |
| `409` | `operation_reused`: The `operationId` was used before with a different request. `revision_conflict`: The record has changed since the revision you sent as `expectedRevision`. `wrong_status`: The record is not in a status that allows this change. `payment_not_due`: The payment day of the scheduled bill has not come. | `Error` |
| `429` | There were too many requests. Nothing was processed. The header `Retry-After` gives the seconds to wait. | `Error` |
| `503` | The service cannot answer now. | `Error` |

### Request

curl

```bash
curl -X POST "$RDC_BASE_URL/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/payment" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "0ad960cb-c62c-4198-92c6-f164e06c8289",
  "expectedRevision": 7
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/payment`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "0ad960cb-c62c-4198-92c6-f164e06c8289",
    "expectedRevision": 7
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/payment',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '0ad960cb-c62c-4198-92c6-f164e06c8289',
        'expectedRevision': 7,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "0ad960cb-c62c-4198-92c6-f164e06c8289",
  "expectedRevision": 7
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/payment');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/erp/v1/supplier-bills/c166560c-6b79-4137-b4a3-0c89a9537cdf/payment");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "0ad960cb-c62c-4198-92c6-f164e06c8289",
  "expectedRevision": 7
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

### Response `202`

JSON

```json
{
  "operationId": "0ad960cb-c62c-4198-92c6-f164e06c8289",
  "status": "accepted",
  "aggregateId": "c166560c-6b79-4137-b4a3-0c89a9537cdf",
  "aggregateRevision": 8
}
```
