DevelopersAPI reference

Commissions API

REST endpoints for commissions in ServFlo: 8 operations with parameters, request and response fields, permissions and curl examples.

Base URL: https://app.servflo.ai/api. Every call needs Authorization: Bearer sfk_… (Authentication); {organizationId} ($ORGANIZATION_ID in the examples) is your business's id.

OperationEndpointRisk
List commission rulesGET /organizations/{organizationId}/commission-rulesread
Create a commission rulePOST /organizations/{organizationId}/commission-ruleswrite
Update a commission rulePATCH /organizations/{organizationId}/commission-rules/{commissionRuleId}write
Delete a commission ruleDELETE /organizations/{organizationId}/commission-rules/{commissionRuleId}sensitive
The commission report for a periodGET /organizations/{organizationId}/commissionsread
Calculate commissions for a pay periodPOST /organizations/{organizationId}/commissions/calculatewrite
Approve commissions or mark them paidPOST /organizations/{organizationId}/commissions/statussensitive
Export commissions as CSVGET /organizations/{organizationId}/commissions/exportread

List commission rules

GET /organizations/{organizationId}/commission-rules

The organization's commission rules. Read-only.

Permissioncommissions.manage (Owner, Admin)
Riskread, OAuth scope servflo.read. Read: reads only.
MCP toolcommissionRules_list (toolset team)

Example

curl "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commission-rules" \
  -H "Authorization: Bearer $SERVFLO_API_KEY"

Response

200: the answer's fields

An array of objects:

FieldTypeDescription
idstring
organizationIdstring
namestring
typeenumJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
ratePercentnumber
flatCentsintegerInteger cents.
splitenumJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
technicianIdsarray of string
activeboolean
createdAtstring (date-time)
updatedAtstring (date-time)

Create a commission rule

POST /organizations/{organizationId}/commission-rules

Adds a rule (percent of job revenue, of sold quotes or of membership sales; flat per job or visit) for every technician or the ones named. It counts from the next calculation. Returns it.

Permissioncommissions.manage (Owner, Admin)
Riskwrite, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.
MCP toolcommissionRules_create (toolset team)

Request body

FieldTypeRequiredDescription
namestringYesUp to 200 characters.
typeenumYesJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
ratePercentnumberNoFor the percent types. 0–100.
flatCentsintegerNoFor the flat types. 0–10000000.
splitenumNoJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
technicianIdsarray of stringNoOnly these technicians earn from the rule; empty means everyone. Up to 500 items.
activebooleanNo

Example

curl -X POST "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commission-rules" \
  -H "Authorization: Bearer $SERVFLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Dana Whitfield","type":"JOB_REVENUE_PERCENT"}'

Response

201: the answer's fields
FieldTypeDescription
idstring
organizationIdstring
namestring
typeenumJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
ratePercentnumber
flatCentsintegerInteger cents.
splitenumJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
technicianIdsarray of string
activeboolean
createdAtstring (date-time)
updatedAtstring (date-time)

Update a commission rule

PATCH /organizations/{organizationId}/commission-rules/{commissionRuleId}

Changes the fields sent. Approved and paid commissions keep their amounts; pending ones follow at the next calculation. Returns it.

Permissioncommissions.manage (Owner, Admin)
Riskwrite, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.
MCP toolcommissionRules_update (toolset team)

Parameters

NameInTypeRequiredDescription
commissionRuleIdpathstringYes

Request body

FieldTypeRequiredDescription
namestringNoUp to 200 characters.
typeenumNoJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
ratePercentnumberNoFor the percent types. 0–100.
flatCentsintegerNoFor the flat types. 0–10000000.
splitenumNoJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
technicianIdsarray of stringNoOnly these technicians earn from the rule; empty means everyone. Up to 500 items.
activebooleanNo

Example

curl -X PATCH "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commission-rules/{commissionRuleId}" \
  -H "Authorization: Bearer $SERVFLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Dana Whitfield","type":"JOB_REVENUE_PERCENT","ratePercent":1}'

Response

200: the answer's fields
FieldTypeDescription
idstring
organizationIdstring
namestring
typeenumJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
ratePercentnumber
flatCentsintegerInteger cents.
splitenumJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
technicianIdsarray of string
activeboolean
createdAtstring (date-time)
updatedAtstring (date-time)

Delete a commission rule

DELETE /organizations/{organizationId}/commission-rules/{commissionRuleId}

Destructive: deletes the rule and its pending commissions; refused (400) when it has approved or paid ones (turn it off instead).

Permissioncommissions.manage (Owner, Admin)
Risksensitive, OAuth scope servflo.sensitive. Sensitive: moves money, deletes, sends or shows something to a customer, or grants or revokes access.
MCP toolcommissionRules_delete (toolset team)
ApprovalOver MCP, this tool always waits for your approval in ServFlo. See Approvals.

Parameters

NameInTypeRequiredDescription
commissionRuleIdpathstringYes

Example

curl -X DELETE "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commission-rules/{commissionRuleId}" \
  -H "Authorization: Bearer $SERVFLO_API_KEY"

Response

200: the answer's fields
FieldTypeDescription
oktrue

The commission report for a period

GET /organizations/{organizationId}/commissions

Commission lines whose source falls in the period (start/end), by technician or status, with totals per technician (pending, approved, paid). A technician sees only their own lines. Calculate the period first with POST /commissions/calculate. Read-only.

Permission: commissions.read (Owner, Admin, Technician (own commissions)); risk read (OAuth scope servflo.read).

Permissioncommissions.read
Riskread, OAuth scope servflo.read. Read: reads only.
MCP toolcommissions_list (toolset team)

Parameters

NameInTypeRequiredDescription
startquerystringNoA calendar date in the business's own calendar, YYYY-MM-DD.
endquerystringNoA calendar date in the business's own calendar, YYYY-MM-DD.
technicianIdquerystringNo
statusqueryenumNoPENDING (recomputed on each calculation), APPROVED, PAID (never recomputed). One of PENDING, APPROVED, PAID.
limitqueryintegerNoPage size, 1–200. Default 50.
offsetqueryintegerNoRows to skip; the answer's total counts every match. Default 0.

Example

curl "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commissions" \
  -H "Authorization: Bearer $SERVFLO_API_KEY"

Response

200: the answer's fields
FieldTypeDescription
itemsarray of object
items[].idstring
items[].ruleIdstring
items[].technicianIdstring
items[].sourceTypestringJOB, VISIT, QUOTE or MEMBERSHIP.
items[].sourceIdstring
items[].sourceIdentifierstring
items[].sourceDatestring
items[].periodStartstring
items[].periodEndstring
items[].basisCentsintegerInteger cents.
items[].ratePercentnumber or null
items[].amountCentsintegerInteger cents.
items[].statusenumPENDING (recomputed on each calculation), APPROVED, PAID (never recomputed). One of PENDING, APPROVED, PAID.
items[].approvedAtstring (date-time) or null
items[].paidAtstring (date-time) or null
items[].technicianobject
items[].technician.idstring
items[].technician.namestring
items[].technician.colorstring
items[].ruleobject
items[].rule.idstring
items[].rule.namestring
items[].rule.typeenumJOB_REVENUE_PERCENT (percent of a completed job's revenue), SOLD_QUOTE_PERCENT (percent of quotes the technician sold, on approval), FLAT_PER_JOB, FLAT_PER_VISIT (completed), MEMBERSHIP_SALE_PERCENT (percent of a sold membership's term value). One of JOB_REVENUE_PERCENT, SOLD_QUOTE_PERCENT, FLAT_PER_JOB, FLAT_PER_VISIT, MEMBERSHIP_SALE_PERCENT.
items[].rule.splitenumJob and visit rules: LEAD (all to the lead technician) or CREW (split evenly). One of LEAD, CREW.
totalinteger
totalsarray of object
totals[].technicianIdstring
totals[].namestring
totals[].colorstring
totals[].pendingCentsintegerInteger cents.
totals[].approvedCentsintegerInteger cents.
totals[].paidCentsintegerInteger cents.
totals[].totalCentsintegerInteger cents.
totalCentsintegerInteger cents.

Calculate commissions for a pay period

POST /organizations/{organizationId}/commissions/calculate

Computes every commission the active rules earn from jobs and visits completed, quotes approved and memberships sold in the period, and writes them as PENDING lines. Idempotent: a source is paid once (unique per rule, technician and source); pending lines are recomputed, approved and paid ones are never changed. Returns the counts.

Permissioncommissions.manage (Owner, Admin)
Riskwrite, OAuth scope servflo.write. Write: creates or changes records inside the business; nothing leaves it.
MCP toolcommissions_calculate (toolset team)

Request body

FieldTypeRequiredDescription
startstringYesFirst day of the pay period.
endstringYesLast day of the pay period (inclusive).

Example

curl -X POST "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commissions/calculate" \
  -H "Authorization: Bearer $SERVFLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"start":"string","end":"string"}'

Response

200: the answer's fields
FieldTypeDescription
createdinteger
updatedinteger
settledintegerLines already approved or paid, left as they were.
removedintegerPending lines no longer earned.
linesinteger
totalCentsintegerInteger cents.
periodobject
period.startstring
period.endstring

Approve commissions or mark them paid

POST /organizations/{organizationId}/commissions/status

MONEY (pay): moves lines PENDING → APPROVED → PAID (or APPROVED back to PENDING). Paid lines never change. Approved and paid lines are kept through recalculations. Returns how many changed.

Permissioncommissions.manage (Owner, Admin)
Risksensitive, OAuth scope servflo.sensitive. Sensitive: moves money, deletes, sends or shows something to a customer, or grants or revokes access.
MCP toolcommissions_setStatus (toolset team)
ApprovalOver MCP, this tool always waits for your approval in ServFlo. See Approvals.

Request body

FieldTypeRequiredDescription
lineIdsarray of stringYesUp to 1000 items.
statusenumYesPENDING (recomputed on each calculation), APPROVED, PAID (never recomputed). One of PENDING, APPROVED, PAID.

Example

curl -X POST "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commissions/status" \
  -H "Authorization: Bearer $SERVFLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lineIds":["line_id"],"status":"PENDING"}'

Response

200: the answer's fields
FieldTypeDescription
updatedinteger

Export commissions as CSV

GET /organizations/{organizationId}/commissions/export

The period's lines as CSV (technician, rule, source, date, basis, rate, amount, status) for payroll. A technician exports only their own. Read-only.

Permission: commissions.read (Owner, Admin, Technician (own commissions)); risk read (OAuth scope servflo.read).

Permissioncommissions.read
Riskread, OAuth scope servflo.read. Read: reads only.
MCP toolcommissions_export (toolset team)

Parameters

NameInTypeRequiredDescription
startquerystringNoA calendar date in the business's own calendar, YYYY-MM-DD.
endquerystringNoA calendar date in the business's own calendar, YYYY-MM-DD.
technicianIdquerystringNo
statusqueryenumNoPENDING (recomputed on each calculation), APPROVED, PAID (never recomputed). One of PENDING, APPROVED, PAID.

Example

curl "https://app.servflo.ai/api/organizations/$ORGANIZATION_ID/commissions/export" \
  -H "Authorization: Bearer $SERVFLO_API_KEY"

Response

200: the answer's fields
FieldTypeDescription
fileNamestring
csvstring
countinteger

On this page