> ## Documentation Index
> Fetch the complete documentation index at: https://telnesstech-a0a16404.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Calculate taxes

> Calculate taxes for line items at a specific address.

This endpoint helps determine the tax implications before creating orders or processing payments.
Support two types of line items:
- **Product offerings**: Reference existing products by ID with optional quantity and custom pricing
- **Custom items**: Specify net amount, description, and taxation category directly

Returns line-by-line tax calculations plus aggregated totals.




## OpenAPI

````yaml /api-reference/bundled_openapi.json post /taxes/calculate
openapi: 3.1.0
info:
  title: Telness Tech Connect
  version: 2.0.0-alpha
  description: >
    Telness Tech Connect API provides all you need to own your user's
    connectivity experience.


    Go back to [Telnesstech.com](https://telnesstech.com)
servers:
  - url: https://apiv2.example.com
    description: Connect API URL for your domain
security:
  - apiKey: []
  - bearerAuth: []
    apiKey: []
tags:
  - name: Auth
    description: Authenticate users and obtain access tokens.
  - name: Users
    description: Manage users.
  - name: Customers
    description: Manage customers.
  - name: Subscriptions
    description: Manage subscriptions and subscription.
  - name: Subscription Addons
    description: Manage subscription addons.
  - name: Subscription Usage
    description: Get subscription usage.
  - name: Subscribers
    description: Manage subscribers.
  - name: Licenses
    description: Manage licenses.
  - name: Product Offerings
    description: Browse product offerings.
  - name: Product Catalogs
    description: Browse product catalogs.
  - name: Product Discounts
    description: Discounts and promotions.
  - name: Orders
    description: Manage orders and line items.
  - name: Payment Intents
    description: >-
      Inspect payment intents, the money collected over card rails for orders
      and renewals.
  - name: Payment Links
    description: Create and manage payment links for orders and invoices.
  - name: Payment Sessions
    description: Create and manage payment sessions for orders.
  - name: Payment Profiles
    description: Manage customer payment profiles and methods.
  - name: Payment Profile Sessions
    description: Create sessions for setting up payment profiles.
  - name: Signing sessions
    description: Handle contract signing sessions for postpaid orders.
  - name: Porting
    description: Manage number porting for subscriptions.
  - name: Taxes
    description: Calculate taxes for products and line items.
  - name: Invoices
    description: Manage invoices and invoice items.
  - name: Tools
    description: >-
      Tools for address validation, number porting, device info, and network
      coverage.
  - name: Inventory
    description: Manage phone number inventory, SIM cards, and reservations.
  - name: Workflows
    description: Dynamic processing of customer journeys and events.
paths:
  /taxes/calculate:
    post:
      tags:
        - Taxes
      summary: Calculate taxes
      description: >
        Calculate taxes for line items at a specific address.


        This endpoint helps determine the tax implications before creating
        orders or processing payments.

        Support two types of line items:

        - **Product offerings**: Reference existing products by ID with optional
        quantity and custom pricing

        - **Custom items**: Specify net amount, description, and taxation
        category directly


        Returns line-by-line tax calculations plus aggregated totals.
      operationId: calculateTaxes
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CalculateTaxesRequest'
      responses:
        '200':
          description: Tax calculation completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaxCalculationResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    IdempotencyKey:
      in: header
      name: X-Idempotency-Key
      required: false
      description: >
        A unique key to ensure idempotency of requests. If a request with the
        same key has already been processed, the same result will be returned.

        The key must be unique for each distinct operation. Keys are expired
        after 24 hours, but we recommend using a new key for each request.


        Modified requests with the same idempotency keys are rejected with a
        `409 Conflict` status code.
      schema:
        type: string
        maxLength: 256
  schemas:
    CalculateTaxesRequest:
      type: object
      description: Request to calculate taxes for line items at a specific address.
      required:
        - lineItems
      additionalProperties: false
      properties:
        customerId:
          type: string
          description: Optional customer ID for customer-specific tax calculations.
          example: 123e4567-e89b-12d3-a456-426614174000
        address:
          $ref: '#/components/schemas/Address'
          description: >
            The address where taxes should be calculated for.


            If the customer ID is not provided, this address is required. If
            both customer ID and address are provided, the address will override
            the customer's default address for tax calculation.
        promoCode:
          type: string
          description: >-
            Promotional code to apply for discount calculation before computing
            taxes.
          example: STUDENT2024
        lineItems:
          type: array
          description: Line items to calculate taxes for.
          minItems: 1
          items:
            $ref: '#/components/schemas/TaxLineItem'
    TaxCalculationResult:
      type: object
      description: Tax calculation result with line-by-line breakdown and totals.
      required:
        - lineItems
        - totals
        - expiresAt
      additionalProperties: false
      properties:
        lineItems:
          type: array
          description: Tax calculation results for each line item.
          items:
            $ref: '#/components/schemas/TaxCalculationLineResult'
        totals:
          type: object
          description: Summary totals across all line items.
          required:
            - netAmount
            - taxAmount
            - totalAmount
            - currency
          additionalProperties: false
          properties:
            netAmount:
              type: number
              format: decimal
              description: Total net amount before taxes across all line items.
              example: 129.97
            taxAmount:
              type: number
              format: decimal
              description: Total tax amount across all line items.
              example: 32.49
            totalAmount:
              type: number
              format: decimal
              description: Total amount including taxes across all line items.
              example: 162.46
            currency:
              type: string
              description: Currency for all amounts.
              example: USD
            taxBreakdown:
              type: array
              description: Aggregated tax breakdown across all line items.
              items:
                $ref: '#/components/schemas/TaxBreakdownItem'
    Address:
      type: object
      required:
        - street1
        - city
        - zip
        - country
      properties:
        street1:
          type: string
          description: The first line of the address, typically street and house number.
          example: 500 S Main St
        street2:
          type: string
          description: >-
            The second line of the address, typically apartment, suite, unit,
            building, floor, etc.
          example: Apt 1
        city:
          type: string
          description: The city or municipality of the address.
          example: Natick
        zip:
          type: string
          description: >
            The zip code of the address.


            Depending on the country, this may be referred to as a postal code
            or postcode.


            Specifically for US addresses, the zip can include the optional
            four-digit extension (e.g., '27604-5121').
          example: '01701'
        country:
          type: string
          description: >-
            The two-letter country abbreviation (e.g., 'US' for United States,
            'SE' for Sweden).
          pattern: ^[A-Z]{2}$
          example: US
        state:
          type: string
          description: >-
            For countries that use states or regions, the state or
            administrative area code (e.g., 'CA' for California in the United
            States).
          example: CA
        region:
          type: string
          description: >-
            A province, region, or territory name, applicable in certain
            countries (e.g., 'Ontario' in Canada, 'Sindh' in Pakistan).
        attention:
          type: string
          description: >-
            An optional line for specifying a person, department, or attention
            to a specific entity within an address.
    TaxLineItem:
      type: object
      title: Product Offering
      description: >-
        Calculate taxes for a product offering with optional quantity and
        customizations.
      required:
        - type
        - productOfferingId
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
            - PRODUCT_OFFERING
          description: Line item type discriminator.
        productOfferingId:
          type: string
          description: The product offering to calculate taxes for.
          example: mobile-plan-premium
    TaxCalculationLineResult:
      type: object
      description: Tax calculation result for a single line item.
      required:
        - lineItem
        - netAmount
        - taxAmount
        - totalAmount
        - currency
      additionalProperties: false
      properties:
        lineItem:
          $ref: '#/components/schemas/TaxLineItem'
          description: The original line item that was calculated.
        netAmount:
          type: number
          format: decimal
          description: Net amount before taxes (quantity x unit price).
          example: 29.99
        taxAmount:
          type: number
          format: decimal
          description: Total tax amount for this line item.
          example: 7.5
        totalAmount:
          type: number
          format: decimal
          description: Total amount including taxes.
          example: 37.49
        currency:
          type: string
          description: Currency for all amounts.
          example: USD
        taxBreakdown:
          type: array
          description: Detailed breakdown of different tax components.
          items:
            $ref: '#/components/schemas/TaxBreakdownItem'
    TaxBreakdownItem:
      type: object
      description: Individual tax component with description, amount, and optional rate.
      required:
        - description
        - amount
      additionalProperties: false
      properties:
        description:
          type: string
          description: Description of this tax component.
          example: Sales Tax
        amount:
          type: number
          format: decimal
          description: Tax amount for this component.
          example: 2.4
        rate:
          type: number
          format: decimal
          description: Tax rate as a percentage (optional).
          example: 8.25
    Error:
      type: object
      required:
        - message
        - code
      properties:
        message:
          type: string
          description: A human-readable message providing more details about the error.
        code:
          type: string
          description: A machine-readable code for the error.
        details:
          type: array
          description: Additional details about the error.
          items:
            type: object
            required:
              - message
              - code
            properties:
              message:
                type: string
                description: >-
                  A human-readable message providing more details about the
                  error.
              code:
                type: string
                description: A machine-readable code for the specific detail.
              property:
                type: string
                description: The property or field related to the error.
              suggestion:
                $ref: '#/components/schemas/Any'
                description: >
                  A suggested value for the particular property.


                  For example, this may be set when validating an address with
                  an alias, suggesting the expected value by the operator.
        hint:
          type: string
          description: A hint to help resolve the error.
    Any:
      oneOf:
        - type: string
        - type: number
        - type: boolean
        - type: object
          additionalProperties: true
        - type: array
  responses:
    BadRequest:
      description: The request was malformed or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication is required to access this resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Access to this resource is forbidden.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >
        An API key that grants access to the Connect API. You can create and
        manage API keys in the portal.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Bearer authentication with JWT tokens is used to authenticate users.


        Do note that a valid API keys is also required to access the Connect API
        to prove that requests are made by a trusted party.


        Requests with a JWT token is scoped to the permissions of the user the
        token belongs to, regardless of the API key used.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.