Accounts and tax types
Find tax types by rate pattern
/a/AccountCategories_listByRates
Find tax-type IDs whose stored rates exactly match import-supplied numeric strings.
When to use this endpoint
Use AccountCategories_listByRates only for the legacy import widget’s tax-rate-to-ID translation.
Authentication and permissions
The request must establish an authenticated tenant context with signed API credentials or a logged-in CRM session. This legacy handler checks for the tenant database prefix rather than calling the normal login guard.
It performs no additional Finance-page, client-admin, role, create, edit, or delete permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
rates | JSON array of numeric strings | Yes | Exact numeric rates. Every member must be a numeric JSON string; numeric JSON values reject the request. |
Example request
$matches = FM_api('AccountCategories_listByRates', [
'rates' => json_encode(['20', '0']),
]);
Example response
[
{"id":"271009","tax_rate":"0"},
{"id":"271006","tax_rate":"20"}
]
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing parameter: rates"} | The parameter is absent. |
{"error":"invalid parameter: rates"} | JSON decoding does not produce an array. |
{"error":"invalid rate string","name":...} | Any member is not a numeric JSON string. The invalid value is returned under the legacy key name. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Results are ordered by numeric
tax_rate, with no secondary order for duplicate rates. - Unmatched requested strings have no placeholder. Multiple categories with the same matching rate are all returned.
- The import widget later keeps one ID per returned rate string, so duplicate-rate choice can depend on response order.
See it in Fieldmotion
CRM1
CRM1’s import widget calls this endpoint when a Tax Type mapping translates a source column by rate.
CRM2
CRM2’s import widget uses the same legacy translation behavior.
Related endpoints
AccountCategories_listByNamesprovides exact name translation.Accounts_getTaxRateslists distinct configured rates.