API Documentation
Overview
The Surety Rate Calculator API provides programmatic access to rate management, surety records, calculations, and share link functionality. All endpoints return JSON responses, except that a successful DELETE answers 204 with no body.
/api/v1
Endpoints
The endpoints described on this page, with the API key scope each one needs.
| Method | Path | Scope | Purpose |
|---|---|---|---|
| GET | /api/v1/rates | read | List rate schedules, with optional filters |
| GET | /api/v1/rates/:id | read | Get a rate schedule by numeric ID |
| GET | /api/v1/rates/uid/:uid | read | Get a rate schedule by its UID |
| POST | /api/v1/rates | write | Create a rate schedule |
| PUT | /api/v1/rates/:id | write | Update a rate schedule |
| DELETE | /api/v1/rates/:id | write | Deactivate a rate schedule (soft delete) |
| GET | /api/v1/sureties | read | List sureties; active ones unless include_inactive is sent |
| GET | /api/v1/sureties/:id | read | Get a surety by numeric ID, an inactive one included |
| POST | /api/v1/calculate | read or quote | Calculate premium and commission for a bond; with a quote key, the premium only |
| GET | /api/v1/shares | read | List share links, with optional filters |
| GET | /api/v1/shares/:id | read | Get a share link by ID |
| GET | /api/v1/shares/token/:token | read | Get a share link by its public token |
| POST | /api/v1/shares | write | Create a share link |
| PUT | /api/v1/shares/:id | write | Update a share link |
| DELETE | /api/v1/shares/:id | write | Deactivate a share link (soft delete) |
| GET | /api/v1/api-keys | admin | List API keys (metadata only) |
| GET | /api/v1/api-keys/:id | admin | Get an API key's metadata by ID |
| POST | /api/v1/api-keys | admin | Create an API key |
| PUT | /api/v1/api-keys/:id | admin | Update API key metadata |
| DELETE | /api/v1/api-keys/:id | admin | Revoke an API key |
Response Format
All responses with a body follow a consistent format:
{
"success": true,
"data": { ... }
}
Error responses include an error object:
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable message"
}
}
Authentication
All API endpoints require authentication via API key. Include your key in one of these headers:
X-API-Key Header
curl -H "X-API-Key: rk_live_your_key_here" \
https://ratecalc.pclbonds.com/api/v1/rates
Authorization Bearer
curl -H "Authorization: Bearer rk_live_your_key_here" \
https://ratecalc.pclbonds.com/api/v1/rates
Scopes
API keys can have different permission scopes:
| Scope | Description |
|---|---|
read | Read rates, sureties, and shares, and perform calculations with their commission |
quote | Perform calculations (POST /api/v1/calculate) and nothing else. The answer holds no commission field (see Quote Keys under the Calculator API). A quote key is refused with 403 INSUFFICIENT_SCOPE on the rates, sureties, shares and API keys endpoints. A key that also has read gets the whole answer |
write | Create, update, and delete rates and shares. It does not include read |
admin | Manage API keys (includes every other scope) |
Creating an API Key
Sign in and open API in the header: the API Keys page lists the keys, creates a key with its name, scopes, rate limit and expiry date, and deactivates a key. Its Log tab is the API log. An admin key can also manage keys through the API Keys API below.
The command line creates a key as well:
npm run create-api-key -- "Key Name" "read,write"
For an integration that only needs prices, create a quote key: tick only quote on the API Keys page, or run npm run create-api-key -- "Quote Integration" "quote".
Store your API key securely. It is only shown once at creation.
Request Logging
Every call under /api/v1 made with a valid API key is logged, including calls refused for their scope (403), for the rate limit (429) or for their input. A call without a valid key writes no log entry: no key, an unknown, inactive or expired key, the open GET /api/v1/ info endpoint, an unmatched route, and a request refused before its key is checked, such as malformed JSON. Logging is best effort: if an entry cannot be written, your call is answered as usual and that entry is lost.
A log entry holds the time, the key's ID and key_prefix, the method, the route template such as /api/v1/rates/:id, the status, the API duration in milliseconds, and a printable request ID from x-vercel-id, capped at 100 characters. It never holds API key values, query values, request or response bodies, or calculation summaries.
The only body value permitted in the log is a calculation's validated reference. It is absent when the reference itself is refused, or when the request is refused before the reference is checked (for example because premium_rate_id is missing). The fields client_name and project_name are never stored.
Entries are kept for 90 days. Older entries are deleted by a clean-up that runs as calls are logged, so an old entry can outlast that period while no calls are made.
Administrators can read the log. Use an opaque identifier such as an order number for reference; never put personal data or secrets in it.
Rate Limits
Each key may make at most its rate_limit calls in any 60 seconds. New keys get 1000; a key whose rate_limit is not a positive whole number gets 60. A call over the limit is refused with 429 RATE_LIMITED and a Retry-After header: the whole seconds, 1 to 60, until the key may call again. The limit counts the key's logged calls, so calls refused with 429 do not count against it. It is approximate when calls run at the same moment, because a call is counted only once its response ends.
Rates API
Manage premium and commission rate schedules.
/api/v1/rates
read
List all rate schedules with optional filtering.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
type | string | Filter by type: Premium or Commission |
active | boolean | Filter by active status (default: true) |
limit | integer | Max results to return (default: 100) |
offset | integer | Number of results to skip (default: 0) |
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/rates?type=Premium&limit=10"
Response
{
"success": true,
"data": {
"rates": [
{
"id": 15,
"name": "TX Class B",
"uid": "tx-class-b-premium",
"type": "Premium",
...
"surety": "SureTec",
"surety_id": 6,
"active": true
},
{
"id": 16,
"name": "TX Class A",
"uid": "tx-class-a-premium",
"type": "Premium",
...
"surety": "Zurich",
"surety_id": null,
"active": true
}
],
"pagination": { "total": 2, "limit": 10, "offset": 0 }
}
}
Every rate carries surety_id and surety. The second rate above holds a surety name that is not linked to a surety record. The fields are described under GET /api/v1/rates/:id.
/api/v1/rates/:id
read
Get a single rate schedule by numeric ID.
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/rates/15"
Response
{
"success": true,
"data": {
"id": 15,
"name": "TX Class B",
"uid": "tx-class-b-premium",
"type": "Premium",
"bond_type": "Contract",
...
"round_tiers_for_commission": false,
"premium_rounding": "Final",
"surety": "SureTec",
"surety_id": 6,
"active": true,
"created_at": "2026-01-15T14:30:00.123456+00:00",
"updated_at": "2026-02-03T09:12:45.654321+00:00"
}
}
Surety Fields
| Field | Type | Description |
|---|---|---|
surety_id | integer or null | ID of the surety record the rate is linked to (see the Sureties API), or null when the rate is not linked to a record. |
surety | string or null | The surety name of the rate: the name of the linked record, or the name that was saved when it matched no record (then surety_id is null). null when the rate has no surety. |
Rounding Fields
Every rate stores both fields, but only a commission rate's values are used: a calculation takes its rounding from the commission rate it uses (see Commission Rounding under the Calculator API). The values stored on a premium rate are never read.
| Field | Type | Description |
|---|---|---|
round_tiers_for_commission | boolean | On a commission rate, true rounds the premium of each commission segment to a whole dollar before its commission percentage is applied, for a flat commission rate too. It changes the commission only, never the premium charged. false for a new rate. |
premium_rounding | string | On a commission rate, Final rounds the premium once, to the nearest whole dollar, at the end of the quote, and Group also rounds each premium group on the way (see Commission Rounding). Final for a new rate. |
The Airtable rate sync writes these fields from the Airtable fields Round Tiers for Commission and Premium Rounding. A blank Airtable field is synced as false and Final. The sync no longer writes the old Rounding field.
/api/v1/rates/uid/:uid
read
Get a single rate schedule by its UID string. Returns the same response format as GET /api/v1/rates/:id.
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/rates/uid/tx-class-b-premium"
/api/v1/rates
write
Create a new rate schedule.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique name for the rate |
uid | string | No | URL-friendly identifier (lowercase alphanumeric and hyphens, 2-60 chars, cannot start or end with hyphen) |
type | string | Yes | Premium or Commission |
bond_type | string | No | Contract or Commercial |
tier1_size - tier5_size | number | No | Upper limit for each tier |
tier1_rate - tier6_rate | number | No | Rate as decimal (0.025 = 2.5%) |
is_flat | boolean | No | Use tier6_rate for all amounts |
max_rate | number | No | Cap effective rate |
source | string | No | Contract or SOV |
round_tiers_for_commission | boolean | No | Used on a Commission rate: round the premium of each commission segment to a whole dollar before its commission percentage. true or false; 1, 0 and the strings "true", "false", "1", "0", "on" and "off", in any case and with spaces around them, are read the same way, and an empty string counts as false. null or any other value is refused with 400. Default: false when it is left out. |
premium_rounding | string | No | Used on a Commission rate: Final or Group, written exactly so; anything else, null included, is refused with 400. Default: Final when it is left out, empty or only spaces. |
surety_id | integer | No | ID of a surety record. The rate takes that surety's name as its surety text, and the ID wins over surety when both are sent. null clears the surety. An ID that is not a surety is refused with 400. |
surety | string | No | Surety name. It is matched to a surety record by name, ignoring case and extra spaces, and the name of the record is stored. A name that matches no record is stored as text, with no link to a record. An empty string or null leaves the rate with no surety. |
term_period | string | No | None, Month, or Year |
term_skip | integer | No | Periods before term rate applies |
term_rate | number | No | Supplemental rate per period |
confirm_high_rate | boolean | No | Confirms a Premium rate above 0.25 (25%), which is refused without it. Read like is_flat; never stored, so send it again with every write that leaves such a rate on the schedule. |
A rate schedule is checked as a whole and must give every amount a rate, or the write is refused with 400 VALIDATION_ERROR and a message that names the field. A flat rate (is_flat) needs tier6_rate. A tiered rate needs at least one rate, and the tiers are walked from tier 1 until a tier without a size takes the rest (tier 6 has no size); max_rate only caps a premium and does not complete a schedule. On a Premium rate the walk skips a tier without a rate, so the last tier with a rate it reaches must have no size, and a tier with a size before it needs a rate. On a Commission rate the walk ends at the first tier without a size, whether or not it has a rate, and the commission pays nothing on a tier without a rate, so every tier up to and including that one needs a rate. A Texas schedule is checked the same way. A Premium rate above 0.25 (25%) in any rate field is refused unless the request sends confirm_high_rate: true.
Example
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Custom Premium Rate",
"type": "Premium",
"tier1_size": 100000,
"tier1_rate": 0.025,
"tier2_size": 500000,
"tier2_rate": 0.015,
"tier6_rate": 0.01
}' \
"https://ratecalc.pclbonds.com/api/v1/rates"
/api/v1/rates/:id
write
Update an existing rate schedule. Partial updates are supported -- only include the fields you want to change. A body that sets name, type, is_flat, a tier size, a tier rate, max_rate or term_rate is checked, together with the stored rate, by the schedule rules of POST /api/v1/rates, and a Premium rate above 25% left on it needs confirm_high_rate: true. A body that sets none of them, such as only links or active, leaves the stored schedule unchecked.
Request Body
| Field | Type | Description |
|---|---|---|
name | string | Unique name for the rate |
uid | string | URL-friendly identifier (lowercase alphanumeric and hyphens, 2-60 chars) |
type | string | Premium or Commission |
bond_type | string | Contract or Commercial |
tier1_size - tier5_size | number | Upper limit for each tier |
tier1_rate - tier6_rate | number | Rate as decimal (0.025 = 2.5%) |
is_flat | boolean | Use tier6_rate for all amounts |
max_rate | number | Cap effective rate |
min_premium | number | Minimum premium floor |
rounding | string | Legacy text, stored for compatibility. The calculation API, the calculator pages and calculation shares never read it: their rounding comes from round_tiers_for_commission and premium_rounding. |
round_tiers_for_commission | boolean | Used on a Commission rate: true or false, read as on create, an empty string included. Left out, the stored value is kept; null is refused with 400. |
premium_rounding | string | Used on a Commission rate: Final or Group. Left out, the stored value is kept; null, an empty string or any other value is refused with 400. |
source | string | Contract or SOV |
surety_id | integer | ID of a surety record. The rate takes that surety's name as its surety text, and the ID wins over surety when both are sent. null clears the surety. An ID that is not a surety is refused with 400. |
surety | string | Surety name. It is matched to a surety record by name, ignoring case and extra spaces, and the name of the record is stored. A name that matches no record is stored as text, with no link to a record. An empty string or null clears the surety. |
term_period | string | None, Month, or Year |
term_skip | integer | Periods before term rate applies |
term_rate | number | Supplemental rate per period |
extra_rate_id | integer | ID of an additional rate to apply |
comparison_rate_id | integer | ID of a rate to compare against |
confirm_high_rate | boolean | Confirms a Premium rate above 0.25 (25%), as on create; never stored |
/api/v1/rates/:id
write
Deactivate a rate schedule (soft delete).
Sureties API
Read the surety records. Sureties are read-only in the API: they are created and edited on the Sureties pages of the web app, and a POST, PUT, PATCH or DELETE request to these paths is answered with 404 NOT_FOUND and the message Endpoint not found.
Surety Fields
| Field | Type | Description |
|---|---|---|
id | integer | ID of the surety. Use it as surety_id on a rate and as surety.id in a calculation. |
name | string | Name of the surety. The Sureties pages refuse a second surety with the same name, ignoring case and extra spaces. |
active | boolean | false for a surety that was switched off. Inactive sureties are left out of the list unless include_inactive is sent, and are still returned by ID. |
created_at | string | When the surety was created (ISO 8601 timestamp) |
updated_at | string | When the surety was last changed (ISO 8601 timestamp) |
round_before_commission. Rounding is set on each commission rate, with round_tiers_for_commission and premium_rounding (see the Rates API).
/api/v1/sureties
read
List the sureties by name. Only active sureties are listed, unless include_inactive is sent. All of them come back in one response; there is no paging.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
include_inactive | boolean | Send true or 1 to include inactive sureties. Any other value, or no value, lists active sureties only. |
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/sureties?include_inactive=true"
Response
{
"success": true,
"data": {
"sureties": [
{
"id": 2,
"name": "Hanover",
"active": true,
"created_at": "2026-01-15T14:30:00.123456+00:00",
"updated_at": "2026-01-15T14:30:00.123456+00:00"
},
{
"id": 6,
"name": "SureTec",
"active": true,
"created_at": "2026-01-15T14:35:12.208841+00:00",
"updated_at": "2026-01-15T14:35:12.208841+00:00"
},
{
"id": 1,
"name": "Travelers",
"active": true,
"created_at": "2026-01-15T14:28:10.482913+00:00",
"updated_at": "2026-01-15T14:28:10.482913+00:00"
},
{
"id": 3,
"name": "Westfield",
"active": false,
"created_at": "2026-01-15T14:31:42.019356+00:00",
"updated_at": "2026-02-03T09:12:45.654321+00:00"
}
]
}
}
/api/v1/sureties/:id
read
Get a single surety by numeric ID. An inactive surety is returned too, with active set to false. An ID that matches no surety, or that is not a positive whole number, is answered with 404 NOT_FOUND and the message Surety not found; a path segment that is not valid percent-encoding, such as %ZZ, is refused before the route runs with a generic 400 BAD_REQUEST.
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/sureties/2"
Response
{
"success": true,
"data": {
"id": 2,
"name": "Hanover",
"active": true,
"created_at": "2026-01-15T14:30:00.123456+00:00",
"updated_at": "2026-01-15T14:30:00.123456+00:00"
}
}
Not Found
{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Surety not found"
}
}
Calculator API
Perform premium and commission calculations.
/api/v1/calculate
read
quote
Calculate premium and commission for a bond. A key with read (or admin) gets the whole answer; a key with quote and without read gets the premium without any commission (see Quote Keys below).
round_tiers_for_commission and premium_rounding. round_before_commission, at the top level or in the surety object, and a surety's old rounding setting no longer change the price, so a request that sends round_before_commission: true can now get a different price than before, without an error. To keep a rounding, set it on the commission rate with PUT /api/v1/rates/:id, stop sending the flag, and read the policy that priced a quote in data.rounding.
TX Class B, are priced from their stored rate records and the selected commission rate, with the same rules as any other rate, so a Texas quote can differ from before. surety_minimum, annual_maintenance_minimum, prior_premium and prior_commission are no longer read. surety.minimum is no longer a field of the surety object: it is ignored and listed in data.surety.ignored_keys. data.surety no longer holds texas_profile or minimum_applied. The surety changes no figure of a quote, and a schedule the engine refuses is answered 400 CALCULATION_ERROR with the engine's own message.
VALIDATION_ERROR, and its name is listed in error.details.unknown_fields (see Unknown Fields below), so a misspelled maintenance_percent or term is no longer dropped and priced with the default. surety_minimum, annual_maintenance_minimum, prior_premium and prior_commission are refused the same way. premium_rate_id and commission_rate_id take a positive whole number, as a JSON number or a string of digits only: "15abc" and 15.9 are refused, where they used to be read as 15. commission_rate_id must name an active rate of type Commission; any other ID, a Premium rate's included, is answered 400 VALIDATION_ERROR (it was 404 NOT_FOUND). project_name, client_name and bond_type must be text of at most 200 characters, and date a calendar date written YYYY-MM-DD. A key of the surety object other than id, name and round_before_commission, minimum included, is refused the same way and listed as surety.<key>, such as surety.minimum; data.surety.ignored_keys is no longer in the answer.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
premium_rate_id | integer | Yes | ID of the premium rate to use: an active rate of type Premium, as a positive whole number, a JSON number or a string of digits only (41 or "41"). Left out, null or "" is refused with 400 premium_rate_id is required; any other value that is not such a number, such as "41abc", 41.5 or 0, is refused with 400 premium_rate_id must be a positive whole number. An ID that names no active Premium rate, a Commission rate's included, is answered 404 NOT_FOUND Premium rate not found |
commission_rate_id | integer | No | ID of the commission rate, written like premium_rate_id; any other value is refused with 400 commission_rate_id must be a positive whole number. Left out, null or "", the quote is priced premium-only, with no commission. Otherwise it must name an active rate of type Commission: an ID that names no rate, an inactive one or a Premium rate is refused with 400 commission_rate_id must name an active Commission rate, for a quote key too, because the commission rate sets how the premium is rounded |
contract_amount | number | Yes | Contract amount in dollars, 0 or more (see Number Fields) |
maintenance_amount | number | No | Maintenance bond amount. 0 or omitted means not entered: the amount is contract_amount × maintenance_percent / 100 |
maintenance_percent | number | No | Maintenance as a % of the contract, 0 to 100, used when no maintenance_amount is given. 0 or omitted is treated as 100, so the maintenance amount is the contract amount. The response reports the percent that was used |
surcharge | number | No | Surcharge percentage, 0 to 100 (e.g., 5 for 5%); omitted is 0 |
term | number | No | Total warranty in years, including the first year; accepts fractions of 1 year or more. Below 1, 0 or omitted is treated as 1: there is no zero warranty. The response reports the term that was used |
duration | number | No | Construction duration in months; accepts zero and fractions (default: 12) |
surety | string or object | No | The surety, as text or as an object (see Surety Object below). It is reported in data.surety and changes no figure of the quote. Beside a commission_rate_id, the name is also matched to a stored surety record to fill data.surety.id: by the whole name, ignoring case and extra spaces, so Travelers does not match a record named Travelers Casualty. No stored surety is needed. A value that is neither text, an object nor null is refused with 400. |
round_before_commission | boolean | No | Deprecated, accepted for compatibility: it has no effect on the price. The value is still checked: true, false, the strings "true" and "false", null and leaving it out are accepted, and any other value is refused with 400 before any rate is read. The rounding comes from the commission rate (see Commission Rounding below); change it there. |
project_name | string | No | Project name for reference, returned in data.input.project_name. Text of at most 200 characters; anything else is refused with 400. Left out or null is an empty name |
client_name | string | No | Client name for reference, returned in data.input.client_name. Text of at most 200 characters, as project_name |
bond_type | string | No | The bond type of the quote, such as Contract or Maint, returned in data.input.bond_type. Text of at most 200 characters, as project_name; a rate's bond type is text too, so no list of values is enforced. Exactly Maint or Maintenance, in that letter case, prices the quote as a maintenance schedule under Group rounding (see Commission Rounding below) |
date | string | No | The quote date, a calendar date written YYYY-MM-DD, such as 2026-11-22. Anything else, 2026-02-30, 2026-1-5 or a time included, is refused with 400 date must be a calendar date written YYYY-MM-DD. Left out, null or "" is today's date |
reference | string | No | A reference of your own, returned unchanged as data.reference so the answer can be matched to the request. Up to 100 characters of printable text: letters, numbers, punctuation, symbols and spaces. Line breaks, tabs and other control or invisible characters are refused. It is stored in the API request log for 90 days (see Request Logging under Authentication), so use an opaque identifier and never put personal data or secrets in it. Absent or null leaves reference out of the answer. Anything that is not printable text of at most 100 characters is refused with 400. |
Unknown Fields
The fields of the table above are the only top-level fields this endpoint reads, and id, name and round_before_commission the only keys of a surety object (see Surety Object below). Any other field, a misspelled one, one in another letter case (Term is not term) or one sent as null, is refused with 400 VALIDATION_ERROR before any rate is read, so a typo never leaves a default to be priced. The message is fixed, and error.details.unknown_fields lists the names in the order sent, the top-level fields first and then the keys of the surety object as surety.<key>. Only names are listed, never values. A listed name keeps only the characters A-Z, a-z, 0-9, _ and -, is cut to 50 characters and is listed once, and at most 20 names are listed; a field with none of those characters still refuses the request but is left out of the list. Because of that cut, a listed name can look like a field of the table: "term ", with a trailing space, is listed as term.
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 41,
"contract_amount": 200,
"maintenance_pct": 50,
"terms": 3,
"surety": { "name": "SureTec", "minimum": 250 }
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "The request has fields this endpoint does not read; they are listed in error.details.unknown_fields",
"details": {
"unknown_fields": ["maintenance_pct", "terms", "surety.minimum"]
}
}
}
Number Fields
The number fields of the request, contract_amount, maintenance_amount, maintenance_percent, surcharge, term and duration, each take a JSON number or a plain decimal string, such as 1500000, "1500000", "2.5" or ".5". A leading + or - and spaces around the number are accepted. Anything else is refused with 400 VALIDATION_ERROR before any rate is read: a "$", a thousands separator ("1,000"), an exponent ("1e6"), "NaN", "Infinity", true, an array or an object. Left out, null, an empty string or spaces only count as not sent, and the field keeps its default.
| Field | Range | When not sent |
|---|---|---|
contract_amount | 0 or more | Required. Every refusal has the one message contract_amount must be a nonnegative finite number |
maintenance_amount | 0 or more | contract_amount × maintenance_percent / 100 |
maintenance_percent | 0 to 100 | 100 |
surcharge | 0 to 100 | 0 |
term | 0 or more | 1 (a term below 1 counts as 1) |
duration | 0 or more | 12 |
The message of a refusal names the field: <field> must be a number, <field> cannot be negative, or, for a percent, <field> must be between 0 and 100. surety.id is stricter: it takes a JSON number only. surcharge on POST and PUT /api/v1/shares follows the same rules, 0 to 100.
Surety Object
Send surety as an object to state the surety for this one calculation. The object is complete in itself: no stored surety is needed, and no surety record is created or changed. A stored surety is only a convenience, through surety.id or a surety.name that matches one. All fields are optional, and null counts as not sent. Send the request as JSON: in a form-encoded body every value is text, so surety.id and surety.round_before_commission are refused there.
| Field | Type | Description |
|---|---|---|
surety.id | integer | ID of a stored surety (see the Sureties API). Its name is used as the surety name, and it fills data.surety.id. It wins over surety.name: a name sent beside it is ignored. An ID that matches no stored surety is refused with 400. It has to be a JSON number: "3" is refused. |
surety.name | string | Surety name, used exactly as sent, as with the text form of surety. Beside a commission_rate_id, a name that matches a stored surety (the whole name, ignoring case and extra spaces) fills data.surety.id. A name that matches no stored surety is used as given. |
surety.round_before_commission | boolean | Deprecated, accepted for compatibility: it has no effect on the price. When it is sent it has to be a JSON boolean, true or false; anything else, the strings "true" and "false" included, is refused with 400. It is a known key of the object, so it is never refused as an unknown field. |
Any other key in the object, minimum included, is refused with 400 VALIDATION_ERROR before any rate is read, like an unknown top-level field (see Unknown Fields above): error.details.unknown_fields lists it as surety.<key>, so a misspelled key such as nmae is listed as surety.nmae, after the unknown top-level fields. Keys are matched exactly: Name is not name. Only names are listed, never values, under the same rules as the top-level fields and within the same limit of 20.
Commission Rounding
Rounding comes only from the selected commission rate: its round_tiers_for_commission and premium_rounding fields (see Rounding Fields under the Rates API). A commission rate without the fields counts as false and Final. Without a commission_rate_id the quote is priced premium-only, with premium_rounding Final and no tier rounding. The values a premium rate stores are never used, and nothing in the request changes the policy. data.rounding reports the fields that priced the quote.
- The total premium of the quote is rounded to the nearest whole dollar, once the minimum premium is applied.
- Every commission amount is rounded to the cent: the commission of each segment, the base commission, the supplemental commission, the yearly or term product and the commission of a linked extra rate, each before it is added or multiplied again.
round_tiers_for_commissiontrue: the premium of each commission segment is rounded to a whole dollar before its commission percentage is applied, for a flat commission rate too. It changes the commission only: the premium charged and the segment premiums in the answer are not rounded.premium_roundingFinal: no premium amount is rounded on the way. A linked extra rate adds its unrounded total, and a comparison rate is chosen on unrounded totals.premium_roundingGroup: the construction base (the sum of the tier premiums after the Max Rate cap) is rounded to a whole dollar. A monthly supplement is worked out on that rounded base, and base plus supplement is rounded again; a yearly product is rounded. A maintenance or warranty schedule priced by the year (sourceSOV, aMaintorMaintenancebond type on the rate or in the request, a linked extra rate, or the comparison rate of one of these) multiplies its raw capped annual premium by the years before it is rounded, once:round(10.49 × 2) = 21, notround(10.49) × 2 = 20. Linked extra and comparison rates use the same policy.- The Max Rate cap is the capped amount times
max_rate, without the surcharge. A capped quote's tier premiums are scaled so that they add up to the cap.
A Texas schedule, such as TX Class B, follows these same rules: it is priced from its rate record.
The calculator pages price with the same rules. A calculation share is priced again with its commission rate's current fields each time it is viewed, recalculated or printed, whether or not it shows the commission, so the totals saved with the share are not used. A share that hides its commission and whose commission rate is no longer an active commission rate is priced premium-only, with Final.
Example
A worked example on two small generic rates, so that every rounding step shows. The IDs are only an illustration. A field the rates below leave out has its default value.
[
{
"id": 41,
"name": "Example Premium",
"type": "Premium",
"tier1_size": 100,
"tier1_rate": 0.1049,
"tier2_rate": 0.2049,
"term_period": "Month",
"term_rate": 0.5
},
{
"id": 42,
"name": "Example Commission",
"type": "Commission",
"tier1_size": 100,
"tier1_rate": 0.3333,
"tier2_rate": 0.2777,
"round_tiers_for_commission": false,
"premium_rounding": "Final"
}
]
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 41,
"commission_rate_id": 42,
"contract_amount": 200,
"duration": 1,
"project_name": "Highway Project",
"client_name": "ABC Construction",
"date": "2026-11-19"
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
Response
Amounts that are not rounded, such as prem and base_premium, are shown here to the cent. In the JSON they can carry binary floating-point noise, for example 10.489999999999998 for 10.49.
{
"success": true,
"data": {
"input": {
"project_name": "Highway Project",
"client_name": "ABC Construction",
"bond_type": "",
"contract_amount": 200,
"maintenance_amount": 200,
"maintenance_percent": 100,
"surcharge": 0,
"term": 1,
"duration": 1,
"date": "2026-11-19",
"round_before_commission": false
},
"premium": {
"rate_id": 41,
"rate_name": "Example Premium",
"penalty": 200,
"penalty_source": "Contract",
"tiered": true,
"tiers": [
{ "tier": 1, "size": 100, "amount": 100, "prem_rate": 0.1049, "prem": 10.49, "comm_rate": 0.3333, "comm": 3.5 },
{ "tier": 2, "size": 0, "amount": 100, "prem_rate": 0.2049, "prem": 20.49, "comm_rate": 0.2777, "comm": 5.69 }
],
"base_premium": 30.98,
"supplemental_premium": 15.49,
"total_premium": 46,
"surcharge_multiplier": 1,
"term_years_charged": 0,
"term_factor": 1.5,
"duration_months_charged": 1,
"supplement_factor": 0.5,
"min_premium_applied": false,
"max_rate_applied": false
},
"breakdown": {
"extra": null,
"comparison": null
},
"surety": {
"id": null,
"name": null,
"active": null,
"round_before_commission": false,
"source": "commission_rate"
},
"rounding": {
"round_tiers_for_commission": false,
"premium_rounding": "Final",
"commission_rate_id": 42
},
"totals": {
"total_premium": 46,
"total_commission": 13.79
},
"commission": {
"rate_id": 42,
"rate_name": "Example Commission",
"base_commission": 9.19,
"supplemental_commission": 4.6,
"total_commission": 13.79
}
}
}
The request names no surety, so data.surety.id, name and active are null. Every field of data.surety is described under Surety in the Response below.
The steps, with premium_rounding Final and round_tiers_for_commission false:
- Tier premiums:
100 × 0.1049 = 10.49and100 × 0.2049 = 20.49, a base premium of30.98. - Supplement for one month:
30.98 × 0.5 = 15.49. The total46.47is rounded at the end to46. The answer reports it asduration_months_charged1,supplement_factor0.5 andterm_factor1.5. - Segment commissions:
10.49 × 0.3333 = 3.496…, rounded to3.50, and20.49 × 0.2777 = 5.690…, rounded to5.69: a base commission of9.19. - Supplemental commission:
9.19 × 0.5 = 4.595, rounded to4.60. Total commission13.79. - With
round_tiers_for_commissiontruethe segment premiums are rounded first:10 × 0.3333 = 3.333, rounded to3.33, and20 × 0.2777 = 5.554, rounded to5.55;8.88, then8.88 × 0.5 = 4.44, total13.32. The premium stays46. - With
Groupthe base is rounded first:31, then31 × 0.5 = 15.50, and46.50is rounded to47. The commission is the same as withFinal.
The four combinations of the two fields on the commission rate, for the same request:
premium_rounding | round_tiers_for_commission | base_premium | supplemental_premium | total_premium | base_commission | supplemental_commission | total_commission |
|---|---|---|---|---|---|---|---|
Final | false | 30.98 | 15.49 | 46 | 9.19 | 4.60 | 13.79 |
Final | true | 30.98 | 15.49 | 46 | 8.88 | 4.44 | 13.32 |
Group | false | 31 | 15.50 | 47 | 9.19 | 4.60 | 13.79 |
Group | true | 31 | 15.50 | 47 | 8.88 | 4.44 | 13.32 |
Sending round_before_commission: true, or { "round_before_commission": true } as the surety, with this request changes nothing in the answer: it still reports data.rounding from the commission rate.
Example with a Surety Name
The text form names the surety. The quote is the same as without it: data.surety.name is SureTec, and with no commission rate no stored surety is looked up, so data.surety.id is null.
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 15,
"contract_amount": 5000000,
"surety": "SureTec"
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
The surety block of the answer:
{
"success": true,
"data": {
"surety": {
"id": null,
"name": "SureTec",
"active": null,
"round_before_commission": false,
"source": "default"
}
}
}
Example with a Surety Object
The object states the surety for this request only. Premium rate 15 is TX Class B and commission rate 28 a SureTec commission rate; both price from their records, and the surety changes no figure.
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 15,
"commission_rate_id": 28,
"contract_amount": 5000000,
"maintenance_percent": 100,
"term": 2,
"duration": 24,
"surety": {
"name": "SureTec"
},
"reference": "PO-2026-0412"
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
The answer carries the surety block and the reference; its other objects are left out here. Beside the commission rate, the name matches stored surety 6, so id and active come from that record. round_before_commission repeats the stored round_tiers_for_commission of commission rate 28, here false, and source says that a commission rate was chosen:
{
"success": true,
"data": {
"surety": {
"id": 6,
"name": "SureTec",
"active": true,
"round_before_commission": false,
"source": "commission_rate"
},
"reference": "PO-2026-0412"
}
}
Example with a Stored Surety
Send only the ID to use a stored surety. Stored surety 2 is Hanover, so data.surety reports id 2, name Hanover and active true.
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 15,
"contract_amount": 5000000,
"surety": { "id": 2 }
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
The surety block of the answer:
{
"success": true,
"data": {
"surety": {
"id": 2,
"name": "Hanover",
"active": true,
"round_before_commission": false,
"source": "default"
}
}
}
Example with a Rate That Is Not a Commission Rate
Rate 41 of the worked example is a Premium rate, so it cannot be the commission rate of a quote:
curl -X POST -H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"premium_rate_id": 41,
"commission_rate_id": 41,
"contract_amount": 200
}' \
"https://ratecalc.pclbonds.com/api/v1/calculate"
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "commission_rate_id must name an active Commission rate"
}
}
Rounding and Tiers in the Response
These fields describe a quote as the engine prices it, for a Texas schedule as for any other.
| Field | Type | Description |
|---|---|---|
data.rounding.round_tiers_for_commission | boolean | The round_tiers_for_commission of the commission rate that priced the quote; false without a commission rate. |
data.rounding.premium_rounding | string | Final or Group: the premium_rounding of that commission rate; Final without one. |
data.rounding.commission_rate_id | integer or null | ID of that commission rate; null for a premium-only quote. |
data.input.round_before_commission | boolean | Deprecated alias of data.rounding.round_tiers_for_commission, with the same value. It reports the configured policy, never the value the request sent. |
data.premium.tiered | boolean | For a key with read, true with a tiered commission rate and a total premium above 0 (a quote key always gets the premium rate's own value). Otherwise true for a tiered premium rate and false for a flat one. |
data.premium.tiers | array or null | With a commission rate, the commission segmentation: the penalty split at both the premium rate's and the commission rate's tier boundaries, renumbered from 1, each segment with its premium and its commission. Without a commission rate, the premium rate's tiers, an empty array for a flat premium rate. A quote with a total premium of 0 keeps the premium rate's tiers. |
data.premium.tiers[].tier | integer | With a commission rate, the position of the segment, from 1; without one, the number of the premium tier. |
data.premium.tiers[].size | number | With a commission rate, the stored tier size when the segment fills a whole premium tier and a whole commission tier of that same size; else 0, as on a segment that a boundary split, a tier the penalty fills only in part, the last, open-ended tier and every segment of a flat commission rate. Without one, the premium tier size. |
data.premium.tiers[].amount | number | The part of the penalty in the segment. |
data.premium.tiers[].prem_rate | number | The premium rate of the segment, surcharge included; after a Max Rate cap, the capped effective rate. |
data.premium.tiers[].prem | number | The premium of the segment. It is not rounded, whatever the two fields say. |
data.premium.tiers[].comm_rate | number | The commission percentage of the segment. Only with a commission rate. |
data.premium.tiers[].comm | number | The commission of the segment, rounded to the cent, on prem, or on prem rounded to a whole dollar when round_tiers_for_commission is true. Only with a commission rate. |
data.premium.base_premium | number | The construction base premium. Not rounded with Final; a whole dollar with Group, except on a maintenance schedule priced by the year, where it stays unrounded and only the total is rounded, once, after the years. |
data.premium.total_premium | number | The premium charged, in whole dollars; the same value as data.totals.total_premium. |
data.premium.supplemental_premium | number | The month-based supplement: base_premium × supplement_factor; 0 without one. |
data.premium.term_years_charged | number | The years the premium was charged for: the years of term beyond the rate's term_skip on a yearly rate (term period Year). 0 when no year was charged, which holds for a rate priced for its construction period: its warranty years, when it charges them, are the linked extra rate in data.breakdown.extra. |
data.premium.term_factor | number | The multiplier the term applied, before any minimum premium and the whole-dollar rounding: 1 + term_rate × term_years_charged on base_premium for a yearly rate with a term rate; term_years_charged on base_premium for a yearly rate without one; 1 + supplement_factor on base_premium with a month-based supplement; else 1. |
data.premium.duration_months_charged | number | The months of duration the supplement charged: beyond the rate's term_skip on a monthly rate (term period Month). 0 without a supplement. |
data.premium.supplement_factor | number or null | The month-based supplement multiplier, term_rate × duration_months_charged. null when no supplement was charged. |
data.breakdown.extra | object or null | The linked extra rate, such as a warranty or maintenance schedule, as the premium was priced with it: rate_name, base_premium, total_premium (the amount added to the quote's total), max_rate_applied, its own term_years_charged, term_factor, duration_months_charged and supplement_factor, and, beside a commission rate and for a key with read, its total_commission. null when the rate that priced the quote added no extra rate. |
data.breakdown.comparison | object or null | A comparison: comparison_rate_used is true when the comparison rate was lower and priced the quote, false when the premium rate's own result did; used_rate_name names the rate that priced it, and not_used holds the other result: rate_name, total_premium (the other rate's total) and, beside a commission rate and for a key with read, total_commission. null without a comparison. |
data.commission.base_commission | number | The sum of the segment commissions, rounded to the cent. |
data.commission.supplemental_commission | number | The base commission times the supplement multiplier, rounded to the cent. |
data.commission.total_commission | number | The commission charged, rounded to the cent, with the yearly or term product and any linked extra rate. |
Quote Keys
A key with the quote scope and without read (or admin) is priced exactly as a read key is, and its answer holds no commission field. It has no data.commission and no data.totals.total_commission. data.premium.tiers are the premium rate's own tiers, not the commission segmentation, and have no comm_rate or comm. data.breakdown has no total_commission. The commission-only policy is left out too: data.rounding.round_tiers_for_commission and its deprecated aliases data.input.round_before_commission and data.surety.round_before_commission. data.rounding.premium_rounding and data.rounding.commission_rate_id stay, because the commission rate you send still sets how the premium is rounded. The commission itself is never worked out for a quote key, so a commission rate that could not be commissioned does not fail the quote. As the tiers are the premium rate's own, data.premium.tiered follows the premium rate: false for a flat premium rate even beside a tiered commission rate.
Surety in the Response
Every successful answer holds data.surety, also when the request sent no surety. When the request sent a reference, the answer also holds data.reference.
| Field | Type | Description |
|---|---|---|
data.surety.id | integer or null | ID of the stored surety the request names: the one sent as surety.id, or, beside a commission_rate_id, the one whose whole name matches the name sent, ignoring case and extra spaces. null when no stored surety was looked up or nothing matched. |
data.surety.name | string or null | The surety name of the request: the stored name when surety.id was sent, else the name as sent. null when the request has no name or an empty one. It changes no figure of the quote. |
data.surety.active | boolean or null | The active flag of that stored surety. null when data.surety.id is null. |
data.surety.round_before_commission | boolean | Deprecated alias of data.rounding.round_tiers_for_commission, with the same value; never the value the request sent. |
data.surety.source | string | Deprecated: commission_rate when a commission rate priced the quote, else default. Read data.rounding.commission_rate_id instead. |
data.reference | string | The reference of the request, unchanged. Present only when a reference was sent. |
API Keys API
Manage API keys. Requires admin scope.
/api/v1/api-keys
admin
List all API keys (metadata only, keys are never returned).
Query Parameters
| Parameter | Type | Description |
|---|---|---|
active | boolean | Filter by active status (omit to return all keys) |
limit | integer | Max results to return (default: 100) |
offset | integer | Number of results to skip (default: 0) |
/api/v1/api-keys/:id
admin
Get a single API key's metadata by ID. The key hash is never returned.
Example
curl -H "X-API-Key: YOUR_KEY" \
"https://ratecalc.pclbonds.com/api/v1/api-keys/2"
/api/v1/api-keys
admin
Create a new API key. The key is only returned once.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name for the key |
description | string | No | Description |
scopes | string | No | Comma-separated scopes: read, write, admin, quote (default: read) |
rate_limit | integer | No | Calls the key may make in any 60 seconds (default 1000), enforced with 429 RATE_LIMITED (see Rate Limits under Authentication) |
expires_at | string | No | Expiration datetime (ISO 8601) |
Response
{
"success": true,
"data": {
"id": 2,
"key": "rk_live_abc123...",
"key_prefix": "rk_live_abc1",
"name": "Production API",
"scopes": "read,write",
"warning": "Store this API key securely. It will not be shown again."
}
}
/api/v1/api-keys/:id
admin
Update API key metadata. Partial updates are supported -- only include the fields you want to change.
Request Body
| Field | Type | Description |
|---|---|---|
name | string | Name for the key |
description | string | Description |
scopes | string | Comma-separated scopes (read, write, admin, quote) |
rate_limit | integer | Calls the key may make in any 60 seconds, enforced with 429 RATE_LIMITED: a positive whole number, or null, which allows 60; any other value is refused with 400 (see Rate Limits under Authentication) |
expires_at | string | Expiration datetime (ISO 8601) |
active | boolean | Enable or disable the key |
/api/v1/api-keys/:id
admin
Revoke an API key.
Error Handling
The API uses standard HTTP status codes and returns detailed error information.
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Input validation failed |
| 400 | CALCULATION_ERROR | Calculation engine error (e.g., invalid rate configuration) |
| 400, 413, 415 | BAD_REQUEST | Request refused before a route runs, always with the message The request could not be processed.: malformed JSON or a path segment that is not valid percent-encoding (400), a body over 100 KB (413), an unsupported charset (415) |
| 401 | UNAUTHORIZED | Missing API key |
| 401 | INVALID_API_KEY | Invalid or inactive key |
| 401 | API_KEY_EXPIRED | Key has expired |
| 403 | INSUFFICIENT_SCOPE | Key lacks required scope, for example a quote key outside POST /api/v1/calculate |
| 404 | NOT_FOUND | Resource not found |
| 409 | CONFLICT | Resource already exists |
| 429 | RATE_LIMITED | Rate limit exceeded: the key made its rate_limit calls in the last 60 seconds. The Retry-After header gives the whole seconds, 1 to 60, to wait |
| 500 | INTERNAL_ERROR | Server error |
Example Error Response
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "premium_rate_id is required"
}
}
Fixed Messages
These messages are fixed text. None of them repeats a value from your request.
| Status | Code | Message | When |
|---|---|---|---|
| 400 | VALIDATION_ERROR | The request has fields this endpoint does not read; they are listed in error.details.unknown_fields | The body of POST /api/v1/calculate has a top-level field the endpoint does not read; error.details.unknown_fields lists the names (see Unknown Fields under the Calculator API) |
| 400 | VALIDATION_ERROR | premium_rate_id must be a positive whole number | premium_rate_id on POST /api/v1/calculate is not a positive whole number given as a JSON number or a string of digits only, for example "15abc", 15.9 or 0 |
| 400 | VALIDATION_ERROR | commission_rate_id must be a positive whole number | The same for commission_rate_id; leave it out or send null or "" for a premium-only quote |
| 400 | VALIDATION_ERROR | commission_rate_id must name an active Commission rate | No rate has that ID, the rate is inactive, or it is a Premium rate |
| 400 | VALIDATION_ERROR | <field> must be text of at most 200 characters | project_name, client_name or bond_type on POST /api/v1/calculate is not text or is longer than 200 characters |
| 400 | VALIDATION_ERROR | date must be a calendar date written YYYY-MM-DD | date on POST /api/v1/calculate is not a calendar date written YYYY-MM-DD |
| 400 | VALIDATION_ERROR | surety must be text or an object | surety on POST /api/v1/calculate is an array, a number or a boolean |
| 400 | VALIDATION_ERROR | surety.id must be a whole number | surety.id is not a whole JSON number, for example "3", 1.5 or true |
| 400 | VALIDATION_ERROR | surety.id does not match a stored surety | No stored surety has that ID |
| 400 | VALIDATION_ERROR | surety.name must be text | surety.name is not text |
| 400 | VALIDATION_ERROR | round_before_commission must be true or false | round_before_commission on POST /api/v1/calculate is not true, false, "true", "false" or null (the field is deprecated and changes no price) |
| 400 | VALIDATION_ERROR | surety.round_before_commission must be true or false | surety.round_before_commission is not true or false; the strings are refused (the field is deprecated and changes no price) |
| 400 | VALIDATION_ERROR | reference must be printable text of at most 100 characters | reference is not text, is longer than 100 characters, or holds control or invisible characters |
| 404 | NOT_FOUND | Surety not found | GET /api/v1/sureties/:id with an ID that matches no surety or is not a positive whole number (a path segment that is not valid percent-encoding, such as %ZZ, gets a generic 400 BAD_REQUEST before the route runs) |