Search…
API Reference
Resources
List all tax rules
How to fetch a collection of tax rules via API
To fetch a collection of tax rules, send a GET request to the /api/tax_rules endpoint.

Request

GET https://yourdomain.commercelayer.io/api/tax_rules

Example

Request
Response
The following request fetches a collection of tax rules:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/tax_rules/' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a paginated collection of resource objects:
1
{
2
"data": [
3
{
4
"id": "xYZkjABcde",
5
"type": "tax_rules",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/tax_rules/xYZkjABcde"
8
},
9
"attributes": {
10
"name": "Fixed 22%",
11
"tax_rate": 0.22,
12
"country_code_regex": "AT|BE|BG|CZ|DK|EE|DE|HU|LV|LT",
13
"not_country_code_regex": "AT|BE|BG|CZ|DK|EE|DE",
14
"state_code_regex": "A[KLRZ]|C[AOT]|D[CE]|FL",
15
"not_state_code_regex": "A[KLRZ]|C[AOT]",
16
"zip_code_regex": "(?i)(JE1|JE2|JE3|JE4|JE5)",
17
"not_zip_code_regex": "(?i)(JE1|JE2|JE3)",
18
"freight_taxable": false,
19
"payment_method_taxable": false,
20
"gift_card_taxable": false,
21
"adjustment_taxable": false,
22
"breakdown": {
23
"41": {
24
"tax_rate": 0.22
25
}
26
},
27
"created_at": "2018-01-01T12:00:00.000Z",
28
"updated_at": "2018-01-01T12:00:00.000Z",
29
"reference": "ANY-EXTERNAL-REFEFERNCE",
30
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
31
"metadata": {
32
"foo": "bar"
33
}
34
},
35
"relationships": {
36
"manual_tax_calculator": {
37
"links": {
38
"self": "https://yourdomain.commercelayer.io/api/tax_rules/xYZkjABcde/relationships/manual_tax_calculator",
39
"related": "https://yourdomain.commercelayer.io/api/tax_rules/xYZkjABcde/manual_tax_calculator"
40
}
41
}
42
},
43
"meta": {
44
"mode": "test"
45
}
46
},
47
{
48
"other": "... 9 tax_rules (first page)"
49
}
50
],
51
"meta": {
52
"record_count": 140,
53
"page_count": 14
54
},
55
"links": {
56
"first": "https://yourdomain.commercelayer.io/api/tax_rules?page[number]=1&page[size]=10",
57
"next": "https://yourdomain.commercelayer.io/api/tax_rules?page[number]=2&page[size]=10",
58
"last": "https://yourdomain.commercelayer.io/api/tax_rules?page[number]=14&page[size]=10"
59
}
60
}
Copied!

Sortable attributes

The list of tax rules can be sorted by the following attributes:
  • name
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 2mo ago