Taxes
This object represents a tax of your business. Use it to track receipts that belong to the same tax.
taxes:create
taxes:read
taxes:delete
taxes:update
Core principles
A tax should be unique by email or by phone number.
SBTax
Create a tax
Create a new tax. Requires scope taxes:create
POST https://api.smartbills.io/v1/taxes
Request Body
Requires body of type TaxCreateRequest
TaxCreateRequest
Parameter | Description | Type | Required |
---|---|---|---|
firstName | First name of the tax | string | required |
lastName | Last name of the tax | string | required |
locale | Locale the tax | string | required |
email | Email of the tax | string | required if no phone |
phone | Phone of the tax | string | required if no email |
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Response
Returns a SBTax
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Code example
import { SBClient, SBTax, TaxCreateRequest} from "@smartbills/sdk"
const client: SBClient = new SBClient();
const request: TaxCreateRequest = {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
};
const tax: SBTax = await client.tax.create(request);
Retrieve tax
Retrieve a tax by ID. Requires scope taxes:read
GET https://api.smartbills.io/v1/taxes/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the tax to retrieve | long | required |
Response
Returns a SBTax
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Code example
import { SBClient, SBTax, TaxCreateRequest} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const tax: SBTax = await client.tax.getByIdAsync(1);
List taxes
Retrieve a list of taxes. Requires scope taxes:read
GET https://api.smartbills.io/v1/taxes?page=1&pageSize=100
Query parameters
Requires query parameters of type TaxListRequest
Parameter | Description | Type | Required | Default |
---|---|---|---|---|
page | Current page | long | required | 1 |
pageSize | Number of records to return | long | required | 100 |
orderBy | Order the results by a key of SBTax | keyof SBTax | createdAt | |
sortOrder | Order of the sort | asc or desc | desc |
{
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc",
}
Response
Returns a SBList<SBTax>
{
"data": [{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}],
"metadata": {
"page":1,
"pageSize":100,
"totalPages":1,
"count":1,
},
}
Code example
import { SBClient, SBTax, SBList, TaxListRequest} from "@smartbills/sdk"
const client = new SBClient();
const request: TaxListRequest = {
"page": 1,
"pageSize": 100,
"orderBy": "createdAt",
"sortOrder": "desc",
};
const taxes: SBList<SBTax> = await client.tax.list(request);
Update a tax
Update information about a tax. Requires scope taxes:update
PUT https://api.smartbills.io/v1/taxes/:id
Path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the tax to update | long | required |
Update body parameters
Requires a body of type TaxUpdateRequest
Parameter | Description | Type | Required |
---|---|---|---|
firstName | First name of the tax | string | required |
lastName | Last name of the tax | string | required |
email | Email of the tax | string | required |
phone | Phone of the tax | string | required |
locale | Locale the tax | string | required |
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Update response
Returns a SBTax
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Update code example
import { SBClient, SBTax, TaxUpdateRequest} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const request: TaxUpdateRequest = {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
const tax:SBTax = await client.taxes.updateAsync(1, request);
Delete a tax
Delete a tax. Requires scope taxes:delete
DELETE https://api.smartbills.io/v1/taxes/:id
Delete path parameters
Parameter | Description | Type | Required |
---|---|---|---|
id | ID of the tax to delete | long | required |
Delete response
Returns a SBTax
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"taxExempt": true,
"phone": "(555) 555-5555",
"locale": "fr-CA",
"acceptsMarketing": true,
}
Delete code example
import { SBClient, SBTax} from "@smartbills/sdk"
const client:SBClient = new SBClient();
const tax:SBTax = await client.taxes.deleteAsync(1);