> ## 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: v2
servers:
  - url: https://api.rootfi.dev
    description: Production
security: []
paths:
  /accounting/tax_rates:
    post:
      tags:
        - AccountingTaxRates
      summary: Create Tax Rates
      description: Add a tax rate.
      operationId: accounting_taxRates_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accountingtypesCreateTaxRatesRequest'
            examples:
              Example1:
                value:
                  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
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountingtypesCreateTaxRatesResponse'
              examples:
                Example1:
                  value:
                    data:
                      status: SUCCESS
                      upload_job_id: xQm2K441VosP8W4
                      data:
                        - job_id: aXI9pUDA5T7E2LS
                          status: success
                          response:
                            platform_id: '3770712000001298001'
                            name: Track Categories
                            code: GST
                            effective_tax_rate: 12
                            total_tax_rate: 12
                            tax_type: igst
                            components:
                              - name: Track Categories
                                rate: 12
                                tax_agency: igst
                                is_compound: false
                            updated_at: '2000-12-31T18:30:00.000Z'
                            raw_data:
                              platform_id: '3770712000001298001'
                              name: Track Categories
                              code: GST
                              effective_tax_rate: 12
                              total_tax_rate: 12
                              tax_type: igst
                              components:
                                - name: Track Categories
                                  rate: 12
                                  tax_agency: igst
                                  is_compound: false
                              updated_at: '2000-12-31T18:30:00.000Z'
                          error: null
                    request_timestamp: '2000-12-31T18:30:00.000Z'
                    response_timestamp: '2021-06-01T00:00:00.000Z'
                    request_id: 7a1c0e42-9f85-4d6e-bb5d-358a72913c0b
      security:
        - ApiKeyAuth: []
components:
  schemas:
    accountingtypesCreateTaxRatesRequest:
      title: accountingtypesCreateTaxRatesRequest
      type: object
      properties:
        company_id:
          type: integer
          description: The company ID
          example: 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesTaxRatesWriteRequestFields'
      required:
        - company_id
        - data
    accountingtypesCreateTaxRatesResponse:
      title: accountingtypesCreateTaxRatesResponse
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/accountingtypesFinalCreateTaxRatesResponse'
        - $ref: '#/components/schemas/timestamp'
    accountingtypesTaxRatesWriteRequestFields:
      title: accountingtypesTaxRatesWriteRequestFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly pass to the
            accounting platform.
      allOf:
        - $ref: '#/components/schemas/accountingtypesTaxRatesAllResponsesCommonFields'
    accountingtypesFinalCreateTaxRatesResponse:
      title: accountingtypesFinalCreateTaxRatesResponse
      type: object
      properties:
        data:
          $ref: '#/components/schemas/accountingtypesCreateTaxRatesResponseData'
      required:
        - data
    timestamp:
      title: timestamp
      type: object
      properties:
        request_timestamp:
          type: string
          format: date-time
          description: The time at which the request was received by the server
        response_timestamp:
          type: string
          format: date-time
          description: The time at which the response was sent by the server
        request_id:
          type: string
          description: The unique ID of the request
      required:
        - request_timestamp
        - response_timestamp
        - request_id
    accountingtypesTaxRatesAllResponsesCommonFields:
      title: accountingtypesTaxRatesAllResponsesCommonFields
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: Display name of the tax rate
        code:
          type: string
          nullable: true
          description: Simple ID for the tax rate
        effective_tax_rate:
          type: number
          format: double
          nullable: true
          description: >-
            The total tax rate after accounting for the compounding effects of
            all tax components
        total_tax_rate:
          type: number
          format: double
          nullable: true
          description: The sum of all the tax rate components
        tax_type:
          type: string
          nullable: true
          description: The type of tax as mentioned in the accounting platform
        components:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesTaxComponents'
          nullable: true
          description: An array of all the tax components
    accountingtypesCreateTaxRatesResponseData:
      title: accountingtypesCreateTaxRatesResponseData
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/accountingtypesTaxRateResponse'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/SuccessResponse'
    accountingtypesTaxComponents:
      title: accountingtypesTaxComponents
      type: object
      properties:
        name:
          type: string
          nullable: true
          description: The name of the component
        rate:
          type: number
          format: double
          nullable: true
          description: The tax rate of the component
        is_compound:
          type: boolean
          nullable: true
          description: Whether the tax component is compounded or not
        tax_agency:
          type: string
          nullable: true
          description: The tax agency of the component
    accountingtypesTaxRateResponse:
      title: accountingtypesTaxRateResponse
      type: object
      properties:
        response:
          $ref: '#/components/schemas/accountingtypesTaxRatesWriteResponseFields'
        error:
          $ref: '#/components/schemas/ErrorObject'
          nullable: true
          description: The error message if the job failed.
      required:
        - response
      allOf:
        - $ref: '#/components/schemas/JobSuccessResponse'
    SuccessResponse:
      title: SuccessResponse
      type: object
      properties:
        status:
          $ref: '#/components/schemas/Status'
          description: The status of the job.
        upload_job_id:
          type: string
          description: The ID of the job.
      required:
        - status
        - upload_job_id
    accountingtypesTaxRatesWriteResponseFields:
      title: accountingtypesTaxRatesWriteResponseFields
      type: object
      properties:
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            The raw JSON response we receive from the accounting platform for
            this tax rate
      allOf:
        - $ref: '#/components/schemas/accountingtypesTaxratesResponsefields'
    ErrorObject:
      title: ErrorObject
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        platform_error:
          type: string
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
        - platform_error
    JobSuccessResponse:
      title: JobSuccessResponse
      type: object
      properties:
        job_id:
          type: string
          description: The ID of the job.
        status:
          $ref: '#/components/schemas/JobResponseStatus'
          description: The status of the job.
      required:
        - job_id
        - status
    Status:
      title: Status
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CREATED
        - RUNNING
    accountingtypesTaxratesResponsefields:
      title: accountingtypesTaxratesResponsefields
      type: object
      properties:
        updated_at:
          type: string
          nullable: true
          description: The last ISO 8601 timestamp that the data was updated at
      allOf:
        - $ref: '#/components/schemas/accountingtypesTaxRatesPlatformId'
        - $ref: '#/components/schemas/accountingtypesTaxRatesAllResponsesCommonFields'
    JobResponseStatus:
      title: JobResponseStatus
      type: string
      enum:
        - success
        - failed
    accountingtypesTaxRatesPlatformId:
      title: accountingtypesTaxRatesPlatformId
      type: object
      properties:
        platform_id:
          type: string
          description: The ID that the accounting platform uses to identify this tax rate
      required:
        - platform_id
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````