API reference › Finance › Provider expenses

Store or update provider expenses

POST /v1/finance/provider-expenses

Scope
finance:write
Roles
admin, scheduler

Allows providers or admin/scheduler to submit provider expenses for assignments or shifts. Template rows: for percentage, send amount or expense as submitted receipt (required); optional expense with amount is payout override. For per_unit/per_day/flat, send quantity and/or expense (line total override). maximumReimbursementCap: percentage caps receipt (422 if over); other bases cap line total (422 on explicit override, clamp on calculated). Custom rows (customName): expense amount required.

Parameters

None of its own.

Every call also sends Authorization and X-Tenant-ID; see Getting started.

Request body required

FieldTypeDescription
affectFinancialsboolean or null

Required when the change moves money on a work item whose linked finance document is Sent or Approved; without it the call returns 422 FINANCIAL_CONSENT_REQUIRED. true applies the change to those documents; false saves it and marks them out of sync.

expenses requiredarray of object
expenses[].expensenumber (float)

Non-percentage: reimbursement line total or override. Percentage: receipt when amount omitted, or payout override when amount is also sent.

Example 25.5.

expenses[].amountnumber (float) or null

Percentage: submitted receipt/cost. Non-percentage: optional explicit line total.

Example 120.

expenses[].quantitynumber (float) or null

Miles, days, uses, sessions for template categories

Example 50.

expenses[].reimbursableExpenseIdinteger or null

Example 10.

expenses[].customNamestring or null

Example Parking.

expenses[].statusstring or null

One of: pending, approved. Example pending.

expenses[].idstring or null

Existing provider expense id when updating

Example 123.

expenses[].assignmentId requiredstring

Example ASG-12345.

expenses[].serviceProviderId requiredstring

Example USR-67890.

expenses[].uploadReceiptstring (binary) or null

Receipt file (PDF, JPG, JPEG, max 2MB)

expenses[].isDefaultboolean or null
expenses[].billTostring or null

Who the expense is billed to; defaults to organization.

One of: organization, client. Example organization.

expenses[].sourceReimbursableExpenseobject

Catalog category a custom line is seeded from.

expenses[].sourceReimbursableExpense.idinteger or string

Example 1.

expenses[].sourceReimbursableExpense.labelstring or null

Example Example.

Example

JSON
{
  "affectFinancials": true,
  "expenses": [
    {
      "expense": 25.5,
      "amount": 120,
      "quantity": 50,
      "reimbursableExpenseId": 10,
      "customName": "Parking",
      "status": "pending",
      "id": "123",
      "assignmentId": "ASG-12345",
      "serviceProviderId": "USR-67890",
      "uploadReceipt": "string",
      "isDefault": true,
      "billTo": "organization",
      "sourceReimbursableExpense": {
        "id": 1,
        "label": "Example"
      }
    }
  ]
}

Example request

Shell
curl -X POST "https://api.fetchfido.ai/v1/finance/provider-expenses" \
  -H "Authorization: Bearer $FIDO_API_KEY" \
  -H "X-Tenant-ID: $FIDO_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"affectFinancials":true,"expenses":[{"expense":25.5,"amount":120,"quantity":50,"reimbursableExpenseId":10,"customName":"Parking","status":"pending","id":"123","assignmentId":"ASG-12345","serviceProviderId":"USR-67890","uploadReceipt":"string","isDefault":true,"billTo":"organization","sourceReimbursableExpense":{"id":1,"label":"Example"}}]}'

Try it

Responses

200 Expenses submitted for review

Expenses submitted for review.

JSON
{
  "success": true,
  "message": "Expenses submitted for review.",
  "data": {}
}
Response fields (3)
FieldTypeDescription
successboolean

Example true.

messagestring

Example Expenses submitted for review..

dataobject or null
401 Not signed in

Unauthorized

JSON
{
  "success": false,
  "message": "Invalid API key. Org and user tier keys must send an X-Tenant-ID header naming the organization the key was issued for.",
  "errors": null,
  "code": "API_KEY_MISSING"
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example Invalid API key. Org and user tier keys must send an X-Tenant-ID header naming the organization the key was issued for..

errorsany or null

Null on this status.

codestring

Machine-readable reason, for branching on in client code.

One of: API_KEY_MISSING, API_KEY_INVALID, API_KEY_EXPIRED. Example API_KEY_MISSING.

403 Not allowed

Scope, tenant, IP allow-list or RBAC check failed.

JSON
{
  "success": false,
  "message": "You don't have permission to access this endpoint. This API key is missing the 'finance:write' scope.",
  "errors": null,
  "code": ""
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example You don't have permission to access this endpoint. This API key is missing the 'finance:write' scope..

errorsany or null

Null on this status.

codestring

Always empty on this status.

Example .

422 Validation failed

Validation error

JSON
{
  "status": "error",
  "message": "Unable to save. Please check the highlighted fields",
  "errors": {
    "name": [
      "Please enter a name."
    ],
    "email": [
      "The email has already been taken."
    ]
  }
}
429 Too many requests

Rate limit exceeded. See Retry-After.

JSON
{
  "success": false,
  "message": "You've exceeded this API key's rate limit of 120 requests per minute. Try again in 37 seconds.",
  "errors": null,
  "code": "RATE_LIMITED"
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example You've exceeded this API key's rate limit of 120 requests per minute. Try again in 37 seconds..

errorsany or null

Null on this status.

codestring

Machine-readable reason, for branching on in client code.

One of: RATE_LIMITED. Example RATE_LIMITED.

500 Server error

Internal Server Error

JSON
{
  "success": false,
  "message": "An unexpected error occurred — please try again.",
  "errors": null,
  "code": ""
}
Response fields (4)
FieldTypeDescription
successboolean

Example false.

messagestring

Example An unexpected error occurred — please try again..

errorsstring or null

Null in production. The exception message only when the application runs with debug on, so nothing is leaked to an integrator.

codestring

Always empty: the server-error response carries no error code.

Example .