The Anrok API server is accessible at https://api.anrok.com
.
All requests are HTTP POSTs with JSON in the body.
Authentication is via an HTTP header Authorization: Bearer {apiKey}
.
The default rate limit for a seller account is 10 API requests per second.
This endpoint is used to create a new customer certificate in Anrok.
customerId required | string (CustomerId) The Anrok customer ID used to link transactions for the same customer and to look up tax exemption certificates for a customer. This is typically the billing system's customer ID with a prefix to disambiguate.
|
customerName | string (CustomerName) The name of the customer. This is used for display purposes only. |
effectiveDateBegin required | string <date> Effective date of certificate |
exemptionNumber | string Certificate exemption number. This is used for display purposes only. |
notes | string Optional internal notes. |
required | object (CustomerCertificateFile) |
required | Array of objects (CustomerCertificateJuris) Jurisdictions for which certificate applies |
{- "customerId": "cus_123",
- "customerName": "Acme Inc",
- "effectiveDateBegin": "2022-01-01",
- "exemptionNumber": "cert-100",
- "certificateFile": {
- "name": "cert.png",
- "contentsBase64": "Y2VydC5wbmc="
}, - "jurises": [
- {
- "jurisId": "us-MA"
}
]
}
{- "id": "string"
}
This endpoint is used to archive/invalidate a customer certificate.
certificateId required | string ID of the certificate you want to archive. |
{ }
{ }
This documentation describes how to use Anrok's Transactions API to synchronize transactions between Anrok and your billing system, as well as calculate sales tax for new invoices. Use of this API is generally recommended for sellers with custom billing systems or workflows that prevent you from using one of our pre-built platform integrations. Sellers utilizing Stripe Subscriptions or Checkout may also use this API to calculate and add tax on initial invoices, while continuing to use Anrok's Stripe integration to manage tax for subsequent billing cycles.
createEphemeral
endpoint to calculate the sales tax amount.createOrUpdate
endpoint so that the transaction is recorded in Anrok.While the above covers a standard invoice lifecycle, the Transactions API also includes endpoints for exceptional states like voiding and negating invoices, which are described below.
Given the details of an invoice, calculate sales tax and save it as a transaction in Anrok. Saved transactions are used by Anrok to file sales tax returns and monitor sales thresholds.
required | Array of objects (TransactionLineItem) The line items in the transaction. |
currencyCode required | string = 3 characters Three letter ISO currency code (case insensitive). |
required | Address (object) or Legacy US only address (object) The address where the product will be delivered or used. This address determines the taxing jurisdictions and rates for destination-based sourcing. For SaaS companies, this is typically the billing address. All address fields are optional: fields can be omitted or have null value, but empty strings are not allowed. Anrok will return an error if the address does not have enough information to determine the top-level taxing jurisdiction with high confidence. International is a premium feature. Please contact support@anrok.com for more information. |
customerName | string (CustomerName) The name of the customer. This is used for display purposes only. |
Array of objects (CustomerTaxId) Tax IDs for the customer receiving the product | |
accountingDate | string <date> The date that this transaction occurred, for accounting purposes. Accounting date will typically correspond to the invoice date. This is used to determine which tax return the transaction belongs to. |
accountingTime | string <date-time> The time that this transaction occurred, for accounting purposes. If |
accountingTimeZone | string Enum: "UTC" "America/New_York" "America/Chicago" "America/Denver" "America/Los_Angeles" "America/Anchorage" "Pacific/Honolulu" A “tz database” string used to compute an accounting date from the request's |
taxDate | string <date> The date to use for tax calculations. If omitted, Anrok will use the minimum of the accounting date and two days in the future. |
customerId | string (CustomerId) The Anrok customer ID used to link transactions for the same customer and to look up tax exemption certificates for a customer. This is typically the billing system's customer ID with a prefix to disambiguate.
|
id required | string The ID of the new transaction. This must be unique across the entire seller account. This is typically the billing system's invoice ID with some prefix to disambiguate different systems. |
{- "id": "stripe:in_1JSW342eZvKYlo2C",
- "currencyCode": "usd",
- "accountingTime": "2022-01-02T03:30:00Z",
- "accountingTimeZone": "UTC",
- "lineItems": [
- {
- "id": "item-1",
- "productExternalId": "saas-product-1",
- "amount": 15000,
- "isTaxIncludedInAmount": false
}, - {
- "id": "item-2",
- "productExternalId": "saas-product-2",
- "amount": 31000,
- "isTaxIncludedInAmount": true
}, - {
- "id": "item-3",
- "productExternalId": "not-taxable-3",
- "amount": 24000
}
], - "customerAddress": {
- "country": "us",
- "line1": "1450 Cherokee St",
- "city": "Denver",
- "region": "CO",
- "postalCode": "80204"
}
}
{- "version": 1,
- "taxAmountToCollect": 722,
- "lineItems": [
- {
- "id": "item-1",
- "taxAmountToCollect": 722,
- "preTaxAmount": "15000",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}, - {
- "name": "Denver (local)",
- "taxes": [
- {
- "taxName": "Tax",
- "taxableAmount": "15000",
- "taxAmount": "721.5",
- "taxRate": "0.0481"
}
], - "notTaxedReason": null
}
]
}, - {
- "id": "item-2",
- "taxAmountToCollect": 0,
- "preTaxAmount": "29577.3304",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}, - {
- "name": "Denver (local)",
- "taxes": [
- {
- "taxName": "Tax",
- "taxableAmount": "29577.3304",
- "taxAmount": "1422.6696",
- "taxRate": "0.0481"
}
], - "notTaxedReason": null
}
]
}, - {
- "id": "item-3",
- "taxAmountToCollect": 0,
- "preTaxAmount": "24000",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}
]
}
], - "preTaxAmount": "68577.3304",
- "jurisSummaries": [
- {
- "name": "Colorado",
- "notTaxedReasons": [
- {
- "type": "productNotTaxed"
}
]
}, - {
- "name": "Denver (local)",
- "notTaxedReasons": null
}
]
}
Given the details of an invoice, calculate sales tax without saving the transaction in Anrok. Ephemeral transactions are not used by Anrok to file sales tax returns or monitor sales thresholds.
required | Array of objects (TransactionLineItem) The line items in the transaction. |
currencyCode required | string = 3 characters Three letter ISO currency code (case insensitive). |
required | Address (object) or Legacy US only address (object) The address where the product will be delivered or used. This address determines the taxing jurisdictions and rates for destination-based sourcing. For SaaS companies, this is typically the billing address. All address fields are optional: fields can be omitted or have null value, but empty strings are not allowed. Anrok will return an error if the address does not have enough information to determine the top-level taxing jurisdiction with high confidence. International is a premium feature. Please contact support@anrok.com for more information. |
customerName | string (CustomerName) The name of the customer. This is used for display purposes only. |
Array of objects (CustomerTaxId) Tax IDs for the customer receiving the product | |
accountingDate | string <date> The date that this transaction occurred, for accounting purposes. Accounting date will typically correspond to the invoice date. This is used to determine which tax return the transaction belongs to. |
accountingTime | string <date-time> The time that this transaction occurred, for accounting purposes. If |
accountingTimeZone | string Enum: "UTC" "America/New_York" "America/Chicago" "America/Denver" "America/Los_Angeles" "America/Anchorage" "Pacific/Honolulu" A “tz database” string used to compute an accounting date from the request's |
taxDate | string <date> The date to use for tax calculations. If omitted, Anrok will use the minimum of the accounting date and two days in the future. |
customerId | string The Anrok customer ID used to link transactions for the same customer and to look up tax exemption certificates for a customer. This is typically the billing system's customer ID with a prefix to disambiguate.
|
{- "currencyCode": "usd",
- "accountingTime": "2022-01-02T03:30:00Z",
- "accountingTimeZone": "UTC",
- "lineItems": [
- {
- "id": "item-1",
- "productExternalId": "saas-product-1",
- "amount": 15000,
- "isTaxIncludedInAmount": false
}, - {
- "id": "item-2",
- "productExternalId": "saas-product-2",
- "amount": 31000,
- "isTaxIncludedInAmount": true
}, - {
- "id": "item-3",
- "productExternalId": "not-taxable-3",
- "amount": 24000
}
], - "customerAddress": {
- "country": "us",
- "line1": "1450 Cherokee St",
- "city": "Denver",
- "region": "CO",
- "postalCode": "80204"
}
}
{- "taxAmountToCollect": 722,
- "lineItems": [
- {
- "id": "item-1",
- "taxAmountToCollect": 722,
- "preTaxAmount": "15000",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}, - {
- "name": "Denver (local)",
- "taxes": [
- {
- "taxName": "Tax",
- "taxableAmount": "15000",
- "taxAmount": "721.5",
- "taxRate": "0.0481"
}
], - "notTaxedReason": null
}
]
}, - {
- "id": "item-2",
- "taxAmountToCollect": 0,
- "preTaxAmount": "29577.3304",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}, - {
- "name": "Denver (local)",
- "taxes": [
- {
- "taxName": "Tax",
- "taxableAmount": "29577.3304",
- "taxAmount": "1422.6696",
- "taxRate": "0.0481"
}
], - "notTaxedReason": null
}
]
}, - {
- "id": "item-3",
- "taxAmountToCollect": 0,
- "preTaxAmount": "24000",
- "jurises": [
- {
- "name": "Colorado",
- "taxes": null,
- "notTaxedReason": {
- "type": "productNotTaxed"
}
}
]
}
], - "preTaxAmount": "68577.3304",
- "jurisSummaries": [
- {
- "name": "Colorado",
- "notTaxedReasons": [
- {
- "type": "productNotTaxed"
}
]
}, - {
- "name": "Denver (local)",
- "notTaxedReasons": null
}
]
}
Creates a new transaction that is the exact inverse of the given transaction. The sale prices and tax amounts will add up to zero.
originalTransactionId required | string The ID of the transaction you want to negate. |
newTransactionId required | string The ID for the new negated transaction. |
originalTransactionExpectedVersion | integer <int32> The expected transaction version. The refund will fail if this is not the latest version of the transaction. |
{- "originalTransactionId": "stripe:in_1JSW342eZvKYlo2C",
- "newTransactionId": "stripe:in_1JSW342eZvKYlo2C_refund"
}
{ }
Mark a previously-created transaction as void. It will no longer be included in returns or sales totals.
transactionId required | string ID of the transaction you want to void. |
transactionExpectedVersion | integer <int32> The expected transaction version. The void will fail if this is not the latest version of the transaction. |
{ }
{ }
Distinct from Anrok's Transaction API, these endpoints enable you to manage your Product IDs in Anrok via API. You may use these endpoints to supplement your core integration, whether that's through our Transaction API or one of our partner integrations. This API is designed to support you in dynamically mapping new Products and viewing a comprehensive list of existing mappings. Because we aim to keep your product list in Anrok minimal and focused on truly distinct offerings, we use mappings to associate various products in your billing system with the equivalent products in Anrok. This API enables you to confirm that each product on any transaction seen by Anrok is mapped to a defined product and will be assessed properly for taxability calculations as a result.
Lists all Product ID mappings for this integration.
integrationId required | string Your unique integration ID. |
{ }
[- {
- "billing_system_id_1": "anrok_id_1"
}, - {
- "billing_system_id_2": "anrok_id_2"
}
]
Adds a product ID mapping for this integration.
integrationId required | string Your unique integration ID. |
sourceId required | string Source product ID from billing system. |
targetId required | string Target product ID on Anrok. This product must already exist in Anrok. |
shouldOverwrite | boolean Default: false Whether this request should override an existing |
{- "sourceId": "billing system ID",
- "targetId": "anrok ID"
}
{ }
The Anrok Tax ID Validation endpoint is a premium feature. Please contact hello@anrok.com for more information to enable this on your Anrok seller account.
This endpoint is used to assist in the collection and validation of customer tax IDs.
required | object (CustomerAddress) The customer address. This address determines the applicable taxable jurisdictions for the customer. If the provided address cannot be resolved to a taxable jurisdiction with high confidence Anrok will return customerAddressCouldNotResolve. |
required | Array of objects The tax IDs to validate. |
{- "customerAddress": {
- "country": "CA",
- "line1": "123 Main St",
- "city": "Quebec City",
- "region": "Quebec",
- "postalCode": "G1P 2J6"
}, - "customerTaxIds": [
- {
- "value": "123456789"
}, - {
- "value": "987654321"
}
]
}
{- "jurises": [
- {
- "name": "Canada (federal)",
- "taxIdNames": {
- "name": "GST/HST account number",
- "abbreviation": null
}, - "validTaxIds": [
- {
- "value": "123456789"
}
]
}, - {
- "name": "Quebec",
- "taxIdNames": {
- "name": "QST registration number",
- "abbreviation": null
}, - "validTaxIds": [
- {
- "value": "987654321"
}
]
}
]
}