Create an Account Tax
Endpoint Overview
This API endpoint provides a detailed overview of the endpoint responsible for creating an account tax within the Accounting module of the Juleb ERP.
Endpoint Details
- Method: POST
- URL:
/api/v1/accounting/account_tax
Parameters
- Path Parameters: None
- Query Parameters: None
Request Body
{
"name": string,
"type_tax_use": "sale",
"amount_type": "percent",
"active": boolean,
"company_id": integer,
"sequence": integer,
"amount": number,
"description": string,
"price_include": boolean,
"include_base_amount": boolean,
"is_base_affected": boolean,
"analytic": boolean,
"hide_tax_exigibility": boolean,
"tax_exigibility": "on_invoice",
"cash_basis_transition_account_id": integer,
"invoice_repartition_line_ids": integer[],
"refund_repartition_line_ids": integer[],
"country_id": integer,
"country_code": string,
"tax_group_id": integer
}
Field Reference
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Tax name (e.g. "VAT 15%"). |
type_tax_use | string | No | Tax scope: sale, purchase, or none. Defaults to sale. |
amount_type | string | No | Computation method: group, fixed, percent, or division. Defaults to percent. |
active | boolean | No | Whether the tax is active. Defaults to true. |
company_id | integer | No | Company this tax belongs to. |
sequence | integer | No | Display/application order. Defaults to 1. |
amount | number | No | Tax rate/amount (e.g. 15 for 15%). Defaults to 0.0. |
description | string | No | Short label shown on documents. |
price_include | boolean | No | Whether the tax is already included in the product's price. Defaults to false. |
include_base_amount | boolean | No | Whether this tax's amount is included in the base for subsequent taxes. Defaults to false. |
is_base_affected | boolean | No | Whether this tax's base is affected by taxes applied before it. Defaults to false. |
analytic | boolean | No | Whether to post analytic accounting lines for this tax. Defaults to false. |
hide_tax_exigibility | boolean | No | Hides the tax-exigibility setting on the tax form. Defaults to false. |
tax_exigibility | string | No | When the tax becomes due: on_invoice or on_payment. Defaults to on_invoice. |
cash_basis_transition_account_id | integer | No | Transition account used for cash-basis taxes. |
invoice_repartition_line_ids | integer[] | No | Invoice distribution/repartition line IDs. |
refund_repartition_line_ids | integer[] | No | Credit-note (refund) distribution/repartition line IDs. |
country_id | integer | No | Country this tax applies to. |
country_code | string | No | ISO country code this tax applies to. |
tax_group_id | integer | No | Tax group ID this tax is reported under. |
Response
- 201 OK: Successfully created the record.
- 400 Bad Request: Bad request.
- 401 Unauthorized: Unauthorized.
Response Body
{
"data": {
...record fields
}
}
Example
Request
- NodeJS
- curl
- python
- java
const axios = require('axios');
const accountName = process.env.ACCOUNT_NAME;
const apiKey = process.env.API_KEY;
axios.post(`https://${accountName}.juleb.com/api/v1/accounting/account_tax`, {
name: 'VAT 15%',
type_tax_use: 'sale',
amount_type: 'percent',
amount: 15,
company_id: 1
}, {
headers: {
accept: '*/*',
Authorization: `TOKEN`,
'Content-Type': 'application/json'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
curl -X POST \
-H "accept: */*" \
-H "Authorization: ******" \
-H "Content-Type: application/json" \
-d '{
"name": "VAT 15%",
"type_tax_use": "sale",
"amount_type": "percent",
"amount": 15,
"company_id": 1
}' \
"https://$ACCOUNT_NAME.juleb.com/api/v1/accounting/account_tax"
import os
import requests
account_name = os.getenv('ACCOUNT_NAME')
api_key = os.getenv('API_KEY')
url = f'https://{account_name}.juleb.com/api/v1/accounting/account_tax'
headers = {
'accept': '*/*',
'Authorization': f'******',
'Content-Type': 'application/json'
}
data = {
'name': 'VAT 15%',
'type_tax_use': 'sale',
'amount_type': 'percent',
'amount': 15,
'company_id': 1
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 201:
print(response.json())
else:
print(f'Error: {response.status_code}', response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
String accountName = System.getenv("ACCOUNT_NAME");
String apiKey = System.getenv("API_KEY");
String json = "{"
+ "\"name\": \"VAT 15%\","
+ "\"type_tax_use\": \"sale\","
+ "\"amount_type\": \"percent\","
+ "\"amount\": 15,"
+ "\"company_id\": 1"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://" + accountName + ".juleb.com/api/v1/accounting/account_tax"))
.header("accept", "*/*")
.header("Authorization", "Bearer " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() == 201) {
System.out.println(response.body());
} else {
System.out.println("Error: " + response.statusCode() + ", " + response.body());
}
}
}
Response
{
"data": {
"id": 15,
"name": "VAT 15%",
"type_tax_use": "sale",
"amount_type": "percent",
"amount": 15,
"company_id": 1
}
}