API Taxes
Core principles
This object represents a tax applicable to your transactions. Use it to define and manage taxes to apply to products or services in your system.
Scopes
taxes.read
taxes.write
Create a tax
Allows you to create a tax in your system. Requires scope taxes.write
.
POST
https://api.smartbills.io/v1/taxes
Request
Request Body
You must provide a request body of type TaxCreateRequest
.
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the tax | string | required |
rate | Tax rate in percentage | decimal | required |
description | Description of the tax | string | optional |
Response
Response Body
HTTP Status Codes
Code | Description |
---|---|
201 | The tax was successfully created |
400 | The request sent is not valid |
Code example
import { SBClient, SBTax, TaxCreateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"name": "VAT",
"rate": 15.0,
"description": "Value Added Tax"
};
const tax = await client.taxes.create(request);
Retrieve a tax
Retrieve information about a tax in the system. Requires scope taxes.read
.
GET
https://api.smartbills.io/v1/taxes/:id
Path Parameter
Parameter | Description | Type | Required |
---|---|---|---|
id | Unique identifier of the tax | long | required |
Response
Code example
import { SBClient, SBTax } from "@smartbills/sdk"
const client = new SBClient();
const tax = await client.taxes.getByIdAsync(1);
Retrieve a list of taxes
Retrieve a list of taxes registered in the system. Requires scope taxes.read
.
GET
https://api.smartbills.io/v1/taxes
Query Parameters
Parameter | Description | Type | Required |
---|---|---|---|
page | Page number | long | required |
pageSize | Number of records to return | long | required |
Response
Code example
import { SBClient, SBTax, SBList, SBListRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"page": 1,
"pageSize": 100
};
const taxes = await client.taxes.list(request);
Update a tax
Allows you to update information about a tax in the system. Requires scope taxes.write
.
PUT
https://api.smartbills.io/v1/taxes/:id
Path Parameter
Parameter | Description | Type | Required |
---|---|---|---|
id | Unique identifier of the tax | long | required |
Request Body
You must provide a request body of type TaxUpdateRequest
.
Parameter | Description | Type | Required |
---|---|---|---|
name | Name of the tax | string | required |
rate | Tax rate in percentage | decimal | required |
description | Description of the tax | string | optional |
Response
HTTP Status Codes
Code | Description |
---|---|
200 | The tax was successfully updated |
400 | The request sent is not valid |
404 | No tax was found |
Code example
import { SBClient, SBTax, TaxUpdateRequest } from "@smartbills/sdk"
const client = new SBClient();
const request = {
"name": "VAT Updated",
"rate": 20.0,
"description": "Updated Value Added Tax"
};
const tax = await client.taxes.updateAsync(1, request);
Delete a tax
Allows you to delete a tax in the system.
Requires scope taxes.write
.
DELETE
https://api.smartbills.io/v1/taxes/:id
Path Parameter
Parameter | Description | Type | Required |
---|---|---|---|
id | Unique identifier of the tax | long | required |
Response
HTTP Status Codes
Code | Description |
---|---|
200 | The tax was successfully deleted |
404 | No tax was found |
Code example
import { SBClient, SBTax } from "@smartbills/sdk"
const client = new SBClient();
const tax = await client.taxes.deleteAsync(1);