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.

Base URL: /api/v1

Endpoints

The endpoints described on this page, with the API key scope each one needs.

MethodPathScopePurpose
GET/api/v1/ratesreadList rate schedules, with optional filters
GET/api/v1/rates/:idreadGet a rate schedule by numeric ID
GET/api/v1/rates/uid/:uidreadGet a rate schedule by its UID
POST/api/v1/rateswriteCreate a rate schedule
PUT/api/v1/rates/:idwriteUpdate a rate schedule
DELETE/api/v1/rates/:idwriteDeactivate a rate schedule (soft delete)
GET/api/v1/suretiesreadList sureties; active ones unless include_inactive is sent
GET/api/v1/sureties/:idreadGet a surety by numeric ID, an inactive one included
POST/api/v1/calculateread or quoteCalculate premium and commission for a bond; with a quote key, the premium only
GET/api/v1/sharesreadList share links, with optional filters
GET/api/v1/shares/:idreadGet a share link by ID
GET/api/v1/shares/token/:tokenreadGet a share link by its public token
POST/api/v1/shareswriteCreate a share link
PUT/api/v1/shares/:idwriteUpdate a share link
DELETE/api/v1/shares/:idwriteDeactivate a share link (soft delete)
GET/api/v1/api-keysadminList API keys (metadata only)
GET/api/v1/api-keys/:idadminGet an API key's metadata by ID
POST/api/v1/api-keysadminCreate an API key
PUT/api/v1/api-keys/:idadminUpdate API key metadata
DELETE/api/v1/api-keys/:idadminRevoke 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:

ScopeDescription
readRead rates, sureties, and shares, and perform calculations with their commission
quotePerform 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
writeCreate, update, and delete rates and shares. It does not include read
adminManage 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.

GET /api/v1/rates read

List all rate schedules with optional filtering.

Query Parameters

ParameterTypeDescription
typestringFilter by type: Premium or Commission
activebooleanFilter by active status (default: true)
limitintegerMax results to return (default: 100)
offsetintegerNumber 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.

GET /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

FieldTypeDescription
surety_idinteger or nullID of the surety record the rate is linked to (see the Sureties API), or null when the rate is not linked to a record.
suretystring or nullThe 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.

FieldTypeDescription
round_tiers_for_commissionbooleanOn 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_roundingstringOn 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.

GET /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"
POST /api/v1/rates write

Create a new rate schedule.

Request Body

FieldTypeRequiredDescription
namestringYesUnique name for the rate
uidstringNoURL-friendly identifier (lowercase alphanumeric and hyphens, 2-60 chars, cannot start or end with hyphen)
typestringYesPremium or Commission
bond_typestringNoContract or Commercial
tier1_size - tier5_sizenumberNoUpper limit for each tier
tier1_rate - tier6_ratenumberNoRate as decimal (0.025 = 2.5%)
is_flatbooleanNoUse tier6_rate for all amounts
max_ratenumberNoCap effective rate
sourcestringNoContract or SOV
round_tiers_for_commissionbooleanNoUsed 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_roundingstringNoUsed 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_idintegerNoID 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.
suretystringNoSurety 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_periodstringNoNone, Month, or Year
term_skipintegerNoPeriods before term rate applies
term_ratenumberNoSupplemental rate per period
confirm_high_ratebooleanNoConfirms 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"
PUT /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

FieldTypeDescription
namestringUnique name for the rate
uidstringURL-friendly identifier (lowercase alphanumeric and hyphens, 2-60 chars)
typestringPremium or Commission
bond_typestringContract or Commercial
tier1_size - tier5_sizenumberUpper limit for each tier
tier1_rate - tier6_ratenumberRate as decimal (0.025 = 2.5%)
is_flatbooleanUse tier6_rate for all amounts
max_ratenumberCap effective rate
min_premiumnumberMinimum premium floor
roundingstringLegacy 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_commissionbooleanUsed 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_roundingstringUsed 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.
sourcestringContract or SOV
surety_idintegerID 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.
suretystringSurety 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_periodstringNone, Month, or Year
term_skipintegerPeriods before term rate applies
term_ratenumberSupplemental rate per period
extra_rate_idintegerID of an additional rate to apply
comparison_rate_idintegerID of a rate to compare against
confirm_high_ratebooleanConfirms a Premium rate above 0.25 (25%), as on create; never stored
DELETE /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

FieldTypeDescription
idintegerID of the surety. Use it as surety_id on a rate and as surety.id in a calculation.
namestringName of the surety. The Sureties pages refuse a second surety with the same name, ignoring case and extra spaces.
activebooleanfalse 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_atstringWhen the surety was created (ISO 8601 timestamp)
updated_atstringWhen the surety was last changed (ISO 8601 timestamp)
Changed (2026-11-19): a surety no longer has a rounding setting, and its answers no longer hold round_before_commission. Rounding is set on each commission rate, with round_tiers_for_commission and premium_rounding (see the Rates API).
GET /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

ParameterTypeDescription
include_inactivebooleanSend 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"
      }
    ]
  }
}
GET /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.

POST /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).

Changed (2026-11-19): rounding now comes only from the commission rate's stored 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.
Changed (2026-11-21): the Texas workbook pricing is removed. Texas rates, such as 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.
Changed (2026-11-22): the request is checked strictly, before any rate is read. A top-level field this endpoint does not read is refused with 400 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

FieldTypeRequiredDescription
premium_rate_idintegerYesID 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_idintegerNoID 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_amountnumberYesContract amount in dollars, 0 or more (see Number Fields)
maintenance_amountnumberNoMaintenance bond amount. 0 or omitted means not entered: the amount is contract_amount × maintenance_percent / 100
maintenance_percentnumberNoMaintenance 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
surchargenumberNoSurcharge percentage, 0 to 100 (e.g., 5 for 5%); omitted is 0
termnumberNoTotal 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
durationnumberNoConstruction duration in months; accepts zero and fractions (default: 12)
suretystring or objectNoThe 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_commissionbooleanNoDeprecated, 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_namestringNoProject 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_namestringNoClient name for reference, returned in data.input.client_name. Text of at most 200 characters, as project_name
bond_typestringNoThe 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)
datestringNoThe 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
referencestringNoA 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.

FieldRangeWhen not sent
contract_amount0 or moreRequired. Every refusal has the one message contract_amount must be a nonnegative finite number
maintenance_amount0 or morecontract_amount × maintenance_percent / 100
maintenance_percent0 to 100100
surcharge0 to 1000
term0 or more1 (a term below 1 counts as 1)
duration0 or more12

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.

FieldTypeDescription
surety.idintegerID 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.namestringSurety 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_commissionbooleanDeprecated, 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_commission true: 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_rounding Final: 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_rounding Group: 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 (source SOV, a Maint or Maintenance bond 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, not round(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:

  1. Tier premiums: 100 × 0.1049 = 10.49 and 100 × 0.2049 = 20.49, a base premium of 30.98.
  2. Supplement for one month: 30.98 × 0.5 = 15.49. The total 46.47 is rounded at the end to 46. The answer reports it as duration_months_charged 1, supplement_factor 0.5 and term_factor 1.5.
  3. Segment commissions: 10.49 × 0.3333 = 3.496…, rounded to 3.50, and 20.49 × 0.2777 = 5.690…, rounded to 5.69: a base commission of 9.19.
  4. Supplemental commission: 9.19 × 0.5 = 4.595, rounded to 4.60. Total commission 13.79.
  5. With round_tiers_for_commission true the segment premiums are rounded first: 10 × 0.3333 = 3.333, rounded to 3.33, and 20 × 0.2777 = 5.554, rounded to 5.55; 8.88, then 8.88 × 0.5 = 4.44, total 13.32. The premium stays 46.
  6. With Group the base is rounded first: 31, then 31 × 0.5 = 15.50, and 46.50 is rounded to 47. The commission is the same as with Final.

The four combinations of the two fields on the commission rate, for the same request:

premium_roundinground_tiers_for_commissionbase_premiumsupplemental_premiumtotal_premiumbase_commissionsupplemental_commissiontotal_commission
Finalfalse30.9815.49469.194.6013.79
Finaltrue30.9815.49468.884.4413.32
Groupfalse3115.50479.194.6013.79
Grouptrue3115.50478.884.4413.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.

FieldTypeDescription
data.rounding.round_tiers_for_commissionbooleanThe round_tiers_for_commission of the commission rate that priced the quote; false without a commission rate.
data.rounding.premium_roundingstringFinal or Group: the premium_rounding of that commission rate; Final without one.
data.rounding.commission_rate_idinteger or nullID of that commission rate; null for a premium-only quote.
data.input.round_before_commissionbooleanDeprecated 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.tieredbooleanFor 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.tiersarray or nullWith 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[].tierintegerWith a commission rate, the position of the segment, from 1; without one, the number of the premium tier.
data.premium.tiers[].sizenumberWith 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[].amountnumberThe part of the penalty in the segment.
data.premium.tiers[].prem_ratenumberThe premium rate of the segment, surcharge included; after a Max Rate cap, the capped effective rate.
data.premium.tiers[].premnumberThe premium of the segment. It is not rounded, whatever the two fields say.
data.premium.tiers[].comm_ratenumberThe commission percentage of the segment. Only with a commission rate.
data.premium.tiers[].commnumberThe 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_premiumnumberThe 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_premiumnumberThe premium charged, in whole dollars; the same value as data.totals.total_premium.
data.premium.supplemental_premiumnumberThe month-based supplement: base_premium × supplement_factor; 0 without one.
data.premium.term_years_chargednumberThe 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_factornumberThe 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_chargednumberThe 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_factornumber or nullThe month-based supplement multiplier, term_rate × duration_months_charged. null when no supplement was charged.
data.breakdown.extraobject or nullThe 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.comparisonobject or nullA 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_commissionnumberThe sum of the segment commissions, rounded to the cent.
data.commission.supplemental_commissionnumberThe base commission times the supplement multiplier, rounded to the cent.
data.commission.total_commissionnumberThe 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.

FieldTypeDescription
data.surety.idinteger or nullID 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.namestring or nullThe 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.activeboolean or nullThe active flag of that stored surety. null when data.surety.id is null.
data.surety.round_before_commissionbooleanDeprecated alias of data.rounding.round_tiers_for_commission, with the same value; never the value the request sent.
data.surety.sourcestringDeprecated: commission_rate when a commission rate priced the quote, else default. Read data.rounding.commission_rate_id instead.
data.referencestringThe reference of the request, unchanged. Present only when a reference was sent.

Shares API

Manage shareable calculator links for clients.

GET /api/v1/shares read

List all share links with optional filtering.

Query Parameters

ParameterTypeDescription
activebooleanFilter by active status
limitintegerMax results (default: 100)
offsetintegerResults to skip (default: 0)
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 new share link.

Request Body

FieldTypeRequiredDescription
namestringYesInternal name for the share
premium_rate_idintegerYesPremium rate to use
client_namestringNoClient name to display
surchargenumberNoSurcharge %, 0 to 100 (e.g., 5 for 5%): a JSON number or a plain decimal string, as the Number Fields of the Calculator API

Example

curl -X POST -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Client Rate Calculator",
    "premium_rate_id": 15,
    "client_name": "ABC Construction",
    "surcharge": 5
  }' \
  "https://ratecalc.pclbonds.com/api/v1/shares"

Response

{
  "success": true,
  "data": {
    "id": 5,
    "token": "abc123xyz789def0",
    "name": "Client Rate Calculator",
    "share_url": "https://ratecalc.pclbonds.com/s/abc123xyz789def0",
    ...
  }
}
PUT /api/v1/shares/:id write

Update an existing share link. Partial updates are supported -- only include the fields you want to change.

Request Body

FieldTypeDescription
namestringInternal name for the share
client_namestringClient name to display
premium_rate_idintegerPremium rate to use (must reference an active rate)
surchargenumberSurcharge %, 0 to 100 (e.g., 5 for 5%): a JSON number or a plain decimal string, as the Number Fields of the Calculator API
DELETE /api/v1/shares/:id write

Deactivate a share link (soft delete).

API Keys API

Manage API keys. Requires admin scope.

GET /api/v1/api-keys admin

List all API keys (metadata only, keys are never returned).

Query Parameters

ParameterTypeDescription
activebooleanFilter by active status (omit to return all keys)
limitintegerMax results to return (default: 100)
offsetintegerNumber of results to skip (default: 0)
GET /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"
POST /api/v1/api-keys admin

Create a new API key. The key is only returned once.

Request Body

FieldTypeRequiredDescription
namestringYesName for the key
descriptionstringNoDescription
scopesstringNoComma-separated scopes: read, write, admin, quote (default: read)
rate_limitintegerNoCalls the key may make in any 60 seconds (default 1000), enforced with 429 RATE_LIMITED (see Rate Limits under Authentication)
expires_atstringNoExpiration 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."
  }
}
PUT /api/v1/api-keys/:id admin

Update API key metadata. Partial updates are supported -- only include the fields you want to change.

Request Body

FieldTypeDescription
namestringName for the key
descriptionstringDescription
scopesstringComma-separated scopes (read, write, admin, quote)
rate_limitintegerCalls 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_atstringExpiration datetime (ISO 8601)
activebooleanEnable or disable the key
DELETE /api/v1/api-keys/:id admin

Revoke an API key.

Error Handling

The API uses standard HTTP status codes and returns detailed error information.

StatusCodeDescription
400VALIDATION_ERRORInput validation failed
400CALCULATION_ERRORCalculation engine error (e.g., invalid rate configuration)
400, 413, 415BAD_REQUESTRequest 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)
401UNAUTHORIZEDMissing API key
401INVALID_API_KEYInvalid or inactive key
401API_KEY_EXPIREDKey has expired
403INSUFFICIENT_SCOPEKey lacks required scope, for example a quote key outside POST /api/v1/calculate
404NOT_FOUNDResource not found
409CONFLICTResource already exists
429RATE_LIMITEDRate 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
500INTERNAL_ERRORServer 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.

StatusCodeMessageWhen
400VALIDATION_ERRORThe request has fields this endpoint does not read; they are listed in error.details.unknown_fieldsThe 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)
400VALIDATION_ERRORpremium_rate_id must be a positive whole numberpremium_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
400VALIDATION_ERRORcommission_rate_id must be a positive whole numberThe same for commission_rate_id; leave it out or send null or "" for a premium-only quote
400VALIDATION_ERRORcommission_rate_id must name an active Commission rateNo rate has that ID, the rate is inactive, or it is a Premium rate
400VALIDATION_ERROR<field> must be text of at most 200 charactersproject_name, client_name or bond_type on POST /api/v1/calculate is not text or is longer than 200 characters
400VALIDATION_ERRORdate must be a calendar date written YYYY-MM-DDdate on POST /api/v1/calculate is not a calendar date written YYYY-MM-DD
400VALIDATION_ERRORsurety must be text or an objectsurety on POST /api/v1/calculate is an array, a number or a boolean
400VALIDATION_ERRORsurety.id must be a whole numbersurety.id is not a whole JSON number, for example "3", 1.5 or true
400VALIDATION_ERRORsurety.id does not match a stored suretyNo stored surety has that ID
400VALIDATION_ERRORsurety.name must be textsurety.name is not text
400VALIDATION_ERRORround_before_commission must be true or falseround_before_commission on POST /api/v1/calculate is not true, false, "true", "false" or null (the field is deprecated and changes no price)
400VALIDATION_ERRORsurety.round_before_commission must be true or falsesurety.round_before_commission is not true or false; the strings are refused (the field is deprecated and changes no price)
400VALIDATION_ERRORreference must be printable text of at most 100 charactersreference is not text, is longer than 100 characters, or holds control or invisible characters
404NOT_FOUNDSurety not foundGET /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)