expense-rules

Stable. Describes behaviour that is built and covered by tests in this repository.

API reference

GET /v1/expense-rules #

The recurring-vendor rules

Not paged: the response is the complete list.

Responses

StatusMeaningBody
200OKListExpenseRulesResponse
Example response
{
  "rules": [
    {
      "id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e",
      "vendor_match": "string",
      "category": "infrastructure",
      "currency": "string",
      "tax_bps": 0,
      "expected_amount_minor": "string",
      "tolerance_bps": 0,
      "auto_approve": false,
      "app_id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e"
    }
  ]
}
curl
curl -X GET https://YOUR-API-ADDRESS/v1/expense-rules \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY"

POST /v1/expense-rules #

Add a recurring-vendor rule

A vendor whose name contains vendor_match gets the category, currency and tax of the rule. With auto_approve the console records the expense on its own when the amount read from the document is within tolerance_bps of expected_amount_minor.

Request body

FieldTypeDescription
idstring · uuid
vendor_match requiredstringCase-insensitive text the vendor name contains
category requiredExpenseCategory
currency requiredstring
tax_bpsintegerThe tax share of the amount, in basis points
expected_amount_minorstring · int64What this vendor usually bills, in minor units; 0: no expectation
tolerance_bpsinteger
auto_approvebooleanNeeds an expected amount
app_idstring · uuid
Example
{
  "vendor_match": "string",
  "category": "infrastructure",
  "currency": "string"
}

Responses

StatusMeaningBody
201CreatedExpenseRule
400Error envelopeError
409Error envelopeError
Example response
{
  "id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e",
  "vendor_match": "string",
  "category": "infrastructure",
  "currency": "string",
  "tax_bps": 0,
  "expected_amount_minor": "string",
  "tolerance_bps": 0,
  "auto_approve": false,
  "app_id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e"
}
curl
curl -X POST https://YOUR-API-ADDRESS/v1/expense-rules \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vendor_match":"string","category":"infrastructure","currency":"string"}'

PUT /v1/expense-rules/{id} #

Replace a recurring-vendor rule

Parameters

NameInTypeDescription
id requiredpathstring · uuid

Request body

FieldTypeDescription
idstring · uuid
vendor_match requiredstringCase-insensitive text the vendor name contains
category requiredExpenseCategory
currency requiredstring
tax_bpsintegerThe tax share of the amount, in basis points
expected_amount_minorstring · int64What this vendor usually bills, in minor units; 0: no expectation
tolerance_bpsinteger
auto_approvebooleanNeeds an expected amount
app_idstring · uuid
Example
{
  "vendor_match": "string",
  "category": "infrastructure",
  "currency": "string"
}

Responses

StatusMeaningBody
200OKExpenseRule
400Error envelopeError
404Error envelopeError
Example response
{
  "id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e",
  "vendor_match": "string",
  "category": "infrastructure",
  "currency": "string",
  "tax_bps": 0,
  "expected_amount_minor": "string",
  "tolerance_bps": 0,
  "auto_approve": false,
  "app_id": "0192f0b4-6f6e-7c3a-9a3e-6a1f2b3c4d5e"
}
curl
curl -X PUT https://YOUR-API-ADDRESS/v1/expense-rules/<id> \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"vendor_match":"string","category":"infrastructure","currency":"string"}'

DELETE /v1/expense-rules/{id} #

Delete a recurring-vendor rule

Parameters

NameInTypeDescription
id requiredpathstring · uuid

Responses

StatusMeaningBody
204Deleted
404Error envelopeError
curl
curl -X DELETE https://YOUR-API-ADDRESS/v1/expense-rules/<id> \
  -H "Authorization: Bearer $PAYRUDDER_API_KEY"

Models

Error

FieldTypeDescription
error requiredobject

ExpenseCategory

infrastructure | payment_fees | marketing | payroll | tax | software | other

ExpenseRule

FieldTypeDescription
id requiredstring · uuid
vendor_match requiredstringCase-insensitive text the vendor name contains
category requiredExpenseCategory
currency requiredstring
tax_bps requiredintegerThe tax share of the amount, in basis points
expected_amount_minor requiredstring · int64What this vendor usually bills, in minor units; 0: no expectation
tolerance_bps requiredinteger
auto_approve requiredbooleanNeeds an expected amount
app_id requiredstring · uuid

ExpenseRuleInput

FieldTypeDescription
idstring · uuid
vendor_match requiredstringCase-insensitive text the vendor name contains
category requiredExpenseCategory
currency requiredstring
tax_bpsintegerThe tax share of the amount, in basis points
expected_amount_minorstring · int64What this vendor usually bills, in minor units; 0: no expectation
tolerance_bpsinteger
auto_approvebooleanNeeds an expected amount
app_idstring · uuid

ListExpenseRulesResponse

FieldTypeDescription
rules requiredarray of ExpenseRule