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

# Quickstart

> Calculate tax for your first sale, including delivery charges.

**1. Get your API key**

Obtain a Yonda API key during onboarding and store it in your server environment as `YONDA_API_KEY`. Confirm the calculation coverage for your installation with Yonda. See [authentication](https://docs.yondatax.com/authentication.md) for details.

**2. Calculate tax**

Send a sale with a billing or shipping address. This example has one line worth USD 10.00 before tax and a USD 2.00 delivery charge. Money is represented in integer minor units: `1000` and `200` respectively.

```bash cURL theme={null}
curl --request POST 'https://api.yondatax.com/v1/transactions' \
  --header "Authorization: Bearer ${YONDA_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
    "transaction_type": "sale",
    "reference_id": "order-example-001",
    "transaction_date": "2026-09-24T12:00:00Z",
    "currency": "usd",
    "customer": {
      "customer_code": "customer-example-001",
      "address_source": "billing",
      "billing_address": {
        "line1": "350 5th Ave",
        "city": "New York",
        "state": "NY",
        "postal_code": "10118",
        "country": "US"
      }
    },
    "line_items": [
      {
        "number": 1,
        "description": "Example item",
        "quantity": 1,
        "unit_price": 1000,
        "amount": 1000
      }
    ],
    "shipping": {
      "cost": 200
    }
  }'
```

```python Python theme={null}
import os

import httpx

payload = {
    "transaction_type": "sale",
    "reference_id": "order-example-001",
    "transaction_date": "2026-09-24T12:00:00Z",
    "currency": "usd",
    "customer": {
        "customer_code": "customer-example-001",
        "address_source": "billing",
        "billing_address": {
            "line1": "350 5th Ave",
            "city": "New York",
            "state": "NY",
            "postal_code": "10118",
            "country": "US"
        }
    },
    "line_items": [
        {
            "number": 1,
            "description": "Example item",
            "quantity": 1,
            "unit_price": 1000,
            "amount": 1000
        }
    ],
    "shipping": {
        "cost": 200
    }
}

response = httpx.post(
    "https://api.yondatax.com/v1/transactions",
    headers={
        "Authorization": f"Bearer {os.environ['YONDA_API_KEY']}",
        "Content-Type": "application/json",
    },
    json=payload,
    timeout=30.0,
)
response.raise_for_status()
print(response.json()["amount_total"])
```

```javascript JavaScript theme={null}
// Node.js 18+ as an ES module (for example, quickstart.mjs).
const payload = {
  "transaction_type": "sale",
  "reference_id": "order-example-001",
  "transaction_date": "2026-09-24T12:00:00Z",
  "currency": "usd",
  "customer": {
    "customer_code": "customer-example-001",
    "address_source": "billing",
    "billing_address": {
      "line1": "350 5th Ave",
      "city": "New York",
      "state": "NY",
      "postal_code": "10118",
      "country": "US"
    }
  },
  "line_items": [
    {
      "number": 1,
      "description": "Example item",
      "quantity": 1,
      "unit_price": 1000,
      "amount": 1000
    }
  ],
  "shipping": {
    "cost": 200
  }
};

const response = await fetch("https://api.yondatax.com/v1/transactions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YONDA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});

if (!response.ok) {
  throw new Error(`Yonda returned status ${response.status}`);
}

console.log((await response.json()).amount_total);
```

**3. Read the result**

An HTTP 200 response includes product and shipping tax details. The response currency is lowercase.

> [accordion] Example response
>
> The rates shown are illustrative for this address, and your results depend on your coverage.
>
> ```json theme={null}
> {
>   "transaction_type": "sale",
>   "reference_id": "order-example-001",
>   "transaction_date": "2026-09-24T12:00:00Z",
>   "currency": "usd",
>   "customer": {
>     "customer_code": "customer-example-001",
>     "name": null,
>     "email": null
>   },
>   "address_used_for_tax": {
>     "address": {
>       "line1": "350 5th Ave",
>       "line2": null,
>       "line3": null,
>       "city": "New York",
>       "state": "NY",
>       "postal_code": "10118",
>       "country": "US"
>     },
>     "sourcing": "destination"
>   },
>   "line_items": [
>     {
>       "number": 1,
>       "product_code": null,
>       "description": "Example item",
>       "quantity": 1.0,
>       "unit_price": 1000,
>       "amount": 1000,
>       "discount_amount": 0,
>       "tax_inclusive": false,
>       "taxable_amount": 1000,
>       "tax_amount": 89,
>       "total": 1089,
>       "taxability_reason": "standard_rated",
>       "tax_details": {
>         "taxable_amount": 1000,
>         "nontaxable_amount": 0,
>         "tax_due": 89,
>         "jurisdictions": [
>           {
>             "name": "New York",
>             "division": "state",
>             "tax_type": "sales_tax",
>             "rate_type": "fixed",
>             "rate": 4.0,
>             "taxable_amount": 1000,
>             "nontaxable_amount": 0,
>             "tax_due": 40,
>             "taxability_reason": "standard_rated",
>             "pricing_status": "taxed"
>           },
>           {
>             "name": "New York",
>             "division": "city",
>             "tax_type": "sales_tax",
>             "rate_type": "fixed",
>             "rate": 4.5,
>             "taxable_amount": 1000,
>             "nontaxable_amount": 0,
>             "tax_due": 45,
>             "taxability_reason": "standard_rated",
>             "pricing_status": "taxed"
>           },
>           {
>             "name": "New York City MCTD",
>             "division": "district",
>             "tax_type": "sales_tax",
>             "rate_type": "fixed",
>             "rate": 0.375,
>             "taxable_amount": 1000,
>             "nontaxable_amount": 0,
>             "tax_due": 4,
>             "taxability_reason": "standard_rated",
>             "pricing_status": "taxed"
>           }
>         ]
>       },
>       "classification": {
>         "category": "TPP",
>         "tags": [],
>         "source": "general"
>       }
>     }
>   ],
>   "subtotal": 1200,
>   "total_discount": 0,
>   "total_tax": 107,
>   "total_shipping_tax": 18,
>   "amount_total": 1307,
>   "shipping": {
>     "cost": 200,
>     "taxable_amount": 200,
>     "tax_amount": 18,
>     "total": 218,
>     "taxability_reason": "standard_rated",
>     "jurisdictions": [
>       {
>         "name": "New York",
>         "division": "state",
>         "tax_type": "sales_tax",
>         "rate_type": "fixed",
>         "rate": 4.0,
>         "taxable_amount": 200,
>         "nontaxable_amount": 0,
>         "tax_due": 8,
>         "taxability_reason": "standard_rated",
>         "pricing_status": "taxed"
>       },
>       {
>         "name": "New York",
>         "division": "city",
>         "tax_type": "sales_tax",
>         "rate_type": "fixed",
>         "rate": 4.5,
>         "taxable_amount": 200,
>         "nontaxable_amount": 0,
>         "tax_due": 9,
>         "taxability_reason": "standard_rated",
>         "pricing_status": "taxed"
>       },
>       {
>         "name": "New York City MCTD",
>         "division": "district",
>         "tax_type": "sales_tax",
>         "rate_type": "fixed",
>         "rate": 0.375,
>         "taxable_amount": 200,
>         "nontaxable_amount": 0,
>         "tax_due": 1,
>         "taxability_reason": "standard_rated",
>         "pricing_status": "taxed"
>       }
>     ]
>   }
> }
> ```

| Field | What it tells you |
| - | - |
| `line_items` | Tax amounts and jurisdiction breakdowns for your products. |
| `shipping` | The delivery charge, its tax, and its total. |
| `subtotal` | Products and shipping before tax, after discounts. |
| `total_tax` | All product and shipping tax. |
| `total_shipping_tax` | The shipping portion already included in `total_tax`. |
| `amount_total` | The amount including tax: `subtotal + total_tax`. |

## Request rules

* Use integer minor units for money: USD `1000` means \$10.00; JPY `1000` means ¥1,000. Quantities are JSON numbers and may be fractional.
* Set each line's `amount` to its subtotal after discount: `quantity × unit_price − discount_amount`. The API uses the supplied amount; it does not subtract the discount again.
* Send product amounts and shipping costs before tax.
* Include between 1 and 1,250 lines with unique positive `number` values.
* Supply the address selected by `customer.address_source`. Use `billing` or `shipping`; the corresponding address must be present. Provide sufficient address detail for your tax jurisdiction.
* Use snake\_case field names and JSON numeric values, not strings. Unknown fields are rejected.

Continue with the [calculation guide](https://docs.yondatax.com/calculation-guide.md) for discounts and shipping. For rejected requests, see [errors](https://docs.yondatax.com/errors.md).


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