The purpose of this API is to create new credit note.
Request
| URL |
https://your_account.modulus.biz/api/inv/v1/CreditNote?token=YOUR_TOKEN |
| API Name |
CreditNote |
| Method |
POST |
| Source |
Third Party Server |
| Recipient |
modulus® Server |
| Content Type |
application/json |
Query String Parameters
| Parameter |
Required |
Type |
Description |
| token |
Yes |
Text |
Your authentication token. |
Payload Parameters
| Parameter |
Required |
Type |
Description |
| customer_details |
Yes |
Text |
Refers to customer info the credit note issued to. The structure explained here. |
| branch_code |
Yes |
Text |
The code of an active branch. |
| date |
Yes |
Date |
Date format must be ISO 8601 (Example: “2020-01-10”). |
| book_id |
Yes |
Number |
Refers to invoice book used for the credit note. Must be For Credit Note. |
| status |
Yes |
Text |
May be STATUS_DRAFT or STATUS_SENT. |
| salesperson_id |
No |
Number |
Refers to salesperson linked to the branch of this Credit Note. |
| exchange_rate |
No |
Decimal Number |
The exchange rate when the credit note is issued. Mandatory if the customer has foreign currency. |
| reference |
No |
Text |
Credit Note reference. |
| description |
No |
Text |
Credit Note description. |
| items |
Yes |
Array |
An array that contains at least one item. The structure explained here. |
Item Parameter Details
| Parameter |
Required |
Type |
Description |
| item_code |
Yes |
Text |
Item code. |
| unit_id |
Yes |
Number |
Refer to the unit of the sent quantity. |
| quantity |
Yes |
Decimal |
Number The quantity of the item can not be less than or equal to 0. |
| unit_price |
No |
Decimal |
Number The price of the item. If not sent will defined price in the customer or branch default price list. |
Customer Parameter Details
| Parameter |
Required |
Type |
Description |
| code |
Yes |
Text |
The code of the customer the credit note is issued to. |
| name |
Yes |
Text |
The name of the customer the credit note is issued to. |
| type |
Yes |
Text |
The type of the customer the credit note is issued to. Possible values are: (individual/organization). |
| tax_registration_number |
No |
Number |
Customer’s Tax Registration Number. |
| account_code |
No |
Text |
The code of the cash account of the customer. |
| price_list_code (for counter parties of type customer) |
No |
Number |
The code of the price list of the customer. It must have the same currency as the customer and account. |
| address |
No |
Object |
The address of the customer. The structure is explained here. |
| contact |
No |
Object |
The contact of the customer. The structure is explained here. |
Address Parameter Details
| Parameter |
Required |
Type |
Description |
| label |
Yes |
Text |
The label of the address. |
| country_code |
Yes |
Text |
The country code of the address (Example: “EG”). |
| city |
Yes |
Text |
The name of the city in the specified country. |
| address |
No |
Text |
Additional info of the address. |
| Parameter |
Required |
Type |
Description |
| type |
Yes |
Text |
The type of the contact provided, possible values are: (mobile/phone/email/fax/website/other). |
| label |
Yes |
Text |
The label of the contact. |
| value |
Yes |
Text |
The value of the contact. |
Responses
| HTTP Status |
result |
title |
message |
object |
| Success Responses |
| 200 OK |
true |
Success |
Credit Note added successfully. |
{
"credit_note_id": xxx,
"credit_note_serial": "YYY_ZZZZ",
"document_type": "Credit Note",
"creation_date_time": "yyy-mm-dd hh:MM:ss"
}
|
| Failure Responses |
| 400 Bad Request |
false |
Error |
Error message as elaborated here. |
{
"error_code": xxx
}
|
| 500 Internal Server Error |
false |
Error |
Error message as elaborated here. |
{
"error_code": xxx
}
|
Example 1
| Request |
curl --request POST 'https://your_account.modulus.biz/api/inv/v1/CreditNote=YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_details":{
"code":"1",
"name":"Test name",
"type": "individual",
"account_code":"1.6.10.2",
"price_list_code":"1",
"tax_registration_number":"1",
"contact": {
"type": "mobile",
"label": "القاهرة الجديدة",
"value": "0102224791"
},
"address": {
"label": "HEADOFFICE",
"country_code": "EG",
"city": "Alexandria",
"address": "Test Address"
}
},
"branch_code": "2",
"date": "2024-01-15",
"book_id": 1,
"status": "STATUS_DRAFT",
"items": [
{
"item_code": "451",
"unit_id": 3,
"quantity": 50,
"unit_price": 100
}
]
}'
|
| 200 OK |
{
"result": true,
"title": "Success",
"message": "Credit Note added successfully.",
"object": {
"credit_note_id": 3439,
"credit_note_serial": "CR_2024_01_15_03",
"document_type": "Credit Note",
"creation_date_time": "2023-01-14 00:09:00"
}
}
|
Example 2
| Request |
curl --request POST 'https://your_account.modulus.biz/api/inv/v1/CreditNote=YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"customer_details":{
"code":"1",
"name":"Test name",
"type": "individual",
"account_code":"1.6.10.2",
"price_list_code":"1",
"tax_registration_number":"1",
"contact": {
"type": "mobile",
"label": "القاهرة الجديدة",
"value": "0102224791"
},
"address": {
"label": "HEADOFFICE",
"country_code": "EG",
"city": "Alexandria",
"address": "Test Address"
}
},
"branch_code": "2",
"date": "2024-03-01",
"book_id": 1,
"status": "STATUS_SENT",
"reference": "CR-0883",
"items": [
{
"item_code": "6",
"unit_id": 2,
"unit_price": 100
}
]
}'
|
| 400 Bad Request |
{
"result": false,
"title": "Error",
"message": "Missing code, unit or quantity in item row with index 0.",
"object": {
"error_code": xxx
}
}
|