> ## Documentation Index
> Fetch the complete documentation index at: https://integrations.docs.commenda.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Tax Rate

> Create a tax rate.

A [Tax Rate](https://docs.rootfi.dev/api-reference/tax-rates/overview) is the percentage at which an individual or corporation is taxed.

\[he Tax Rates Data Model] is designed to provide a unified representation of tax rates across various accounting platforms.

## Additional Required Fields

To successfully create an tax rate, certain fields must be included in the raw\_data object of the request body. The required fields are as follows:

| Integration    | Field                  | Description                                                                               |
| -------------- | ---------------------- | ----------------------------------------------------------------------------------------- |
| MEKARI\_JURNAL | buy\_tax\_account\_id  | The ID of the account that will be used to record the tax amount when a purchase is made. |
| MEKARI\_JURNAL | sell\_tax\_account\_id | The ID of the account that will be used to record the tax amount when a sale is made.     |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.rootfi.dev/v3/accounting/tax_rates \
    --header 'Content-Type: application/json' \
    --header 'api_key: <api-key>' \
    --data '{
    "company_id": 1,
    "data": [
      {
        "name": "Rootfi Test Tax Rate",
        "code": "1234567890",
        "effective_tax_rate": 10,
        "total_tax_rate": 10,
        "tax_type": "VAT",
        "components": [
          {
            "name": "Rootfi Test Tax Rate Component",
            "is_compound": false,
            "rate": 10,
            "tax_agency": "igst"
          }
        ]
      }
    ]
  }'
  ```

  ```javascript NodeJS theme={null}
  import { RootFiClient } from "rootfi-api";
  const rootfi = new RootFiClient({ apiKey: "<api_key>" });

  await rootfi.accounting.accounts.create({
    company_id: 56789,
    data: [
      {
        name: "Rootfi Test Tax Rate",
        code: "1234567890",
        effective_tax_rate: 10,
        total_tax_rate: 10,
        tax_type: "VAT",
        components: [
          {
            name: "Rootfi Test Tax Rate Component",
            is_compound: false,
            rate: 10,
            tax_agency: "igst",
          },
        ],
      },
    ],
  });
  ```
</RequestExample>


## OpenAPI

````yaml POST /accounting/tax_rates
openapi: 3.0.1
info:
  title: rootfi
  version: v3
servers:
  - url: https://api.rootfi.dev/v3
    description: global
  - url: https://api.sa.rootfi.dev/v3
    description: saudi
security: []
paths:
  /accounting/tax_rates:
    post:
      tags:
        - AccountingTaxRates
      summary: Create Tax Rate
      description: Create a tax rate.
      operationId: accounting_taxRates_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingCreateTaxRatesRequest'
            examples:
              Example1:
                value:
                  company_id: 123
                  data:
                    - name: Victoria Wilson
                      code: '6609425'
                      tax_type: VAT
                      effective_tax_rate: null
                      total_tax_rate: null
                      components:
                        - name: Victoria Wilson
                          rate: null
                          tax_agency: null
                          is_compound: false
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingCreateTaxRatesResponse'
              examples:
                Example1:
                  value:
                    data:
                      rootfi_id: 25177
                      rootfi_deleted_at: null
                      rootfi_created_at: '2024-01-24T11:12:02.641Z'
                      rootfi_updated_at: '2024-01-24T11:12:02.000Z'
                      rootfi_company_id: 1109
                      platform_id: '123456_1'
                      platform_unique_id: '123456'
                      total_tax_rate: null
                      name: Victoria Wilson
                      code: '6609425'
                      updated_at: '2023-12-21T10:14:26.353Z'
                      components:
                        - name: Victoria Wilson
                          rate: null
                          tax_agency: null
                          is_compound: false
                      effective_tax_rate: null
                      tax_type: VAT
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingCreateTaxRatesRequest:
      title: accountingCreateTaxRatesRequest
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingTaxRateFields'
          description: The data of the tax rates endpoint
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/CompanyIDRequestField'
    accountingCreateTaxRatesResponse:
      title: accountingCreateTaxRatesResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingTaxRateObject'
          nullable: true
          description: The list of tax rates
        sync_id:
          type: string
          nullable: true
          description: The sync id of the request
    RootFiAPIResponseType:
      title: RootFiAPIResponseType
      type: object
      properties:
        error:
          $ref: '#/components/schemas/RootFiAPIResponseErrorType'
          description: The error message
      required:
        - error
    accountingTaxRateFields:
      title: accountingTaxRateFields
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: Display name
        code:
          type: string
          nullable: true
          description: Simple ID for the tax rate
        tax_type:
          type: string
          nullable: true
          description: The type of tax as mentioned in the accounting platform
        effective_tax_rate:
          type: number
          format: double
          nullable: true
          description: >-
            The total tax rate after accounting for the compounding effects of
            the all tax components
        total_tax_rate:
          type: number
          format: double
          nullable: true
          description: The sum of all the tax rate components
        components:
          type: array
          items:
            $ref: '#/components/schemas/accountingTaxRateComponent'
          nullable: true
          description: The list of tax rate components
        updated_at:
          type: string
          nullable: true
          description: The last time the tax rate was updated
    CompanyIDRequestField:
      title: CompanyIDRequestField
      type: object
      properties:
        company_id:
          type: integer
          description: The ID of the company in the accounting platform
        run_async:
          type: boolean
          nullable: true
          description: Run the request asynchronously
      required:
        - company_id
    accountingTaxRateObject:
      title: accountingTaxRateObject
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/AccountingRootFiBaseFields'
        - $ref: '#/components/schemas/accountingTaxRateFields'
    RootFiAPIResponseErrorType:
      title: RootFiAPIResponseErrorType
      type: object
      properties:
        message:
          type: string
          description: The error message
        code:
          type: string
          description: The error code
        field:
          type: string
          description: The status of the error
      required:
        - message
        - code
        - field
    accountingTaxRateComponent:
      title: accountingTaxRateComponent
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: Display name
        rate:
          type: number
          format: double
          nullable: true
          description: >-
            The total tax rate after accounting for the compounding effects of
            the all tax components
        tax_agency:
          type: string
          nullable: true
          description: The tax agency of the tax rate component
        is_compound:
          type: boolean
          nullable: true
          description: Whether the tax rate component is compound
    AccountingRootFiBaseFields:
      title: AccountingRootFiBaseFields
      type: object
      properties:
        rootfi_id:
          type: number
          format: double
          description: The unique ID we assign for that data's information
          example: 157
        rootfi_deleted_at:
          type: string
          format: date-time
          nullable: true
          description: The date at which the data was deleted in the accounting platform
        rootfi_created_at:
          type: string
          format: date-time
          description: The date at which RootFi first synced this data
          example: '2024-01-22T05:07:31.465Z'
        rootfi_updated_at:
          type: string
          format: date-time
          description: The latest date at which RootFi updated this data
          example: '2024-01-22T05:07:31.000Z'
        rootfi_company_id:
          type: number
          format: double
          description: The ID of the company in the accounting platform
          example: 1089
        platform_id:
          type: string
          description: An unique custom RootFi ID made from platform's unique_id.
          example: '123456'
        platform_unique_id:
          type: string
          nullable: true
          description: The ID of the data in the accounting platform.
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly get from the
            accounting platform.
        data_hash:
          type: string
          nullable: true
          description: The hash of the data
      required:
        - rootfi_id
        - rootfi_created_at
        - rootfi_updated_at
        - rootfi_company_id
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````