SBTax

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

ParameterDescriptionTypeRequired
firstNameFirst name of the taxstringrequired
lastNameLast name of the taxstringrequired
localeLocale the taxstringrequired
emailEmail of the taxstringrequired if no phone
phonePhone of the taxstringrequired if no email
TaxCreateRequest
{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "taxExempt": true,
    "phone": "(555) 555-5555",
	"locale": "fr-CA",
	"acceptsMarketing": true,
}

Response

Returns a SBTax

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

ParameterDescriptionTypeRequired
idID of the tax to retrievelongrequired

Response

Returns a SBTax

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

ParameterDescriptionTypeRequiredDefault
pageCurrent pagelongrequired1
pageSizeNumber of records to returnlongrequired100
orderByOrder the results by a key of SBTaxkeyof SBTaxcreatedAt
sortOrderOrder of the sortasc or descdesc
TaxListRequest
{
    "page": 1,
    "pageSize": 100,
	"orderBy": "createdAt",
	"sortOrder": "desc",
}

Response

Returns a SBList<SBTax>

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

ParameterDescriptionTypeRequired
idID of the tax to updatelongrequired

Update body parameters

Requires a body of type TaxUpdateRequest

ParameterDescriptionTypeRequired
firstNameFirst name of the taxstringrequired
lastNameLast name of the taxstringrequired
emailEmail of the taxstringrequired
phonePhone of the taxstringrequired
localeLocale the taxstringrequired
TaxUpdateRequest
{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "taxExempt": true,
    "phone": "(555) 555-5555",
	"locale": "fr-CA",
	"acceptsMarketing": true,
}

Update response

Returns a SBTax

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

ParameterDescriptionTypeRequired
idID of the tax to deletelongrequired

Delete response

Returns a SBTax

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);