Expenses

4 operations. Paths start at your portal’s /api/v1.

Approve ticket expenses

POST/expenses/approve

Scope write:expenses_approveChanges data

Requires the write:expenses_approve scope (or management), and the staff member who made the key must be allowed to do this in the portal right now.

Parameters

  • Idempotency-Keystringin header

    Optional. Send a unique value per intended change; a retry with the same value within 24 hours replays the first answer instead of changing anything twice. Scoped to your API key.

Request body

  • itemsobject[]Required

    The expenses to approve, 25 at most.

    Up to 25 items.

  • items[].ticketIdintegerRequired

    The ticket number the expense is on.

  • items[].expenseIdstringRequired

    The expense id.

    Up to 100 characters.

  • items[].markupPctstring or number

    Honoured only for someone who may override the rate.

  • reasonstringRequired

    Why this destructive action is being done (recorded in the audit log with the door it came through).

    At least 3 characters. Up to 2000 characters.

Response 200

  • dataobjectRequired

    What happened to each expense.

  • data.resultsobject[]Required

    One entry per expense in the call, in order.

  • data.results[].ticketIdnumberRequired

    The ticket number.

  • data.results[].expenseIdstringRequired

    The expense id.

  • data.results[].resultstringRequired

    What happened to this expense. Unchanged: it was already in that state. Duplicate: listed twice in the call.

    One of: approved, rejected, unchanged, duplicate, refused.

  • data.results[].messagestring

    The reason, when refused.

  • data.approvednumberRequired

    How many were approved.

  • data.unchangednumberRequired

    How many were already approved.

  • data.refusednumberRequired

    How many were refused.

Errors (400, 401, 402, 403, 404, 429)
  • 400 The body or a parameter is not valid for this operation (apiInvalidInput); the sentence names the field.
  • 401 Missing or invalid API key (apiKeyRequired / apiKeyInvalid). A key also stops working, with apiKeyInvalid, when the staff member who made it is deactivated, blocked or removed.
  • 402 This portal is locked for changes (a trial ended or a payment is overdue): writes are refused until it is settled; reads keep working (apiLocked).
  • 403 The key may not do this (apiKeyScopeInsufficient when it lacks the required scope, apiKeyMakerInsufficient when the staff member who made it does not hold the permission now). Or its organization is inactive (apiKeyOrgInactive). Or the key is limited to one client, which is not supported yet (apiClientKeyUnsupported).
  • 404 Not found for this key (a record in another organization is also a 404, never a 403).
  • 429 Rate limit exceeded; wait Retry-After seconds.

Reject ticket expenses

POST/expenses/reject

Scope write:expenses_approveChanges data

Requires the write:expenses_approve scope (or management), and the staff member who made the key must be allowed to do this in the portal right now.

Parameters

  • Idempotency-Keystringin header

    Optional. Send a unique value per intended change; a retry with the same value within 24 hours replays the first answer instead of changing anything twice. Scoped to your API key.

Request body

  • itemsobject[]Required

    The expenses to reject, 25 at most.

    Up to 25 items.

  • items[].ticketIdintegerRequired

    The ticket number the expense is on.

  • items[].expenseIdstringRequired

    The expense id.

    Up to 100 characters.

  • reasonstringRequired

    Why this destructive action is being done (recorded in the audit log with the door it came through).

    At least 3 characters. Up to 2000 characters.

Response 200

  • dataobjectRequired

    What happened to each expense.

  • data.resultsobject[]Required

    One entry per expense in the call, in order.

  • data.results[].ticketIdnumberRequired

    The ticket number.

  • data.results[].expenseIdstringRequired

    The expense id.

  • data.results[].resultstringRequired

    What happened to this expense. Unchanged: it was already in that state. Duplicate: listed twice in the call.

    One of: approved, rejected, unchanged, duplicate, refused.

  • data.results[].messagestring

    The reason, when refused.

  • data.rejectednumberRequired

    How many were rejected.

  • data.unchangednumberRequired

    How many were already rejected.

  • data.refusednumberRequired

    How many were refused.

Errors (400, 401, 402, 403, 404, 429)
  • 400 The body or a parameter is not valid for this operation (apiInvalidInput); the sentence names the field.
  • 401 Missing or invalid API key (apiKeyRequired / apiKeyInvalid). A key also stops working, with apiKeyInvalid, when the staff member who made it is deactivated, blocked or removed.
  • 402 This portal is locked for changes (a trial ended or a payment is overdue): writes are refused until it is settled; reads keep working (apiLocked).
  • 403 The key may not do this (apiKeyScopeInsufficient when it lacks the required scope, apiKeyMakerInsufficient when the staff member who made it does not hold the permission now). Or its organization is inactive (apiKeyOrgInactive). Or the key is limited to one client, which is not supported yet (apiClientKeyUnsupported).
  • 404 Not found for this key (a record in another organization is also a 404, never a 403).
  • 429 Rate limit exceeded; wait Retry-After seconds.

Log a ticket expense

POST/tickets/{ticketId}/expenses

Scope write:expensesChanges data

Requires the write:expenses scope (or management), and the staff member who made the key must be allowed to do this in the portal right now.

Parameters

  • ticketIdintegerin pathRequired

    Ticket number.

  • Idempotency-Keystringin header

    Optional. Send a unique value per intended change; a retry with the same value within 24 hours replays the first answer instead of changing anything twice. Scoped to your API key.

Request body

  • typestringRequired

    MILEAGE (distance driven) or RECEIPT (a purchase with its file).

    One of: MILEAGE, RECEIPT.

  • expenseDatestringRequired

    The day of the expense, YYYY-MM-DD.

  • requestIdstring

    A key that makes a double submit one expense (8 to 100 characters). Left out, one is made for this call.

    Up to 100 characters.

  • descriptionstring

    What the expense was for.

    Up to 500 characters.

  • distancestring or number

    Mileage only: the distance driven, in the portal distance unit.

  • reimbursementRatestring or number

    Mileage only: honoured only for someone who may override the rate.

  • billableboolean

    Mileage only: bill the client for it.

  • markupPctstring or number

    Mileage only: honoured only for someone who may override the rate.

  • amountstring or number

    Receipt only: the receipt total.

  • receiptAttachmentIdstring

    Receipt only: a file already on this ticket.

    Up to 100 characters.

  • linkedTicketItemIdstring or null

    Receipt only: a ticket charge that bills it.

Response 200

  • dataobjectRequired

    The logged expense.

  • data.expenseobjectRequired

    One ticket expense.

  • data.expense.idstringRequired

    Expense id.

  • data.expense.typestringRequired

    MILEAGE or RECEIPT.

  • data.expense.statusstringRequired

    SUBMITTED, APPROVED or REJECTED.

  • data.expense.descriptionstringRequired

    What the expense was for.

  • data.expense.expenseDatestringRequired

    The calendar day of the expense (ISO 8601, UTC).

  • data.expense.distancestring or nullRequired

    Mileage: the distance driven (decimal string), else null.

  • data.expense.distanceUnitstring or nullRequired

    Mileage: mi or km, else null.

  • data.expense.reimbursementRatestring or nullRequired

    Mileage: the rate paid to the technician per unit (decimal string), else null.

  • data.expense.amountstringRequired

    What it cost the MSP (decimal string).

  • data.expense.markupPctstringRequired

    Markup percent on the client charge (decimal string).

  • data.expense.billAmountstring or nullRequired

    The charge to the client, when billable (decimal string).

  • data.expense.billablebooleanRequired

    Whether the client is billed for it.

  • data.expense.rejectReasonstring or nullRequired

    Why it was rejected, when it was.

  • data.expense.userIdstringRequired

    Id of the technician who logged it.

  • data.expense.userNamestringRequired

    Name of the technician who logged it.

  • data.expense.mintedbooleanRequired

    A billable charge was created on the ticket for this expense.

  • data.expense.billedbooleanRequired

    That charge is on an invoice, so the expense is locked.

  • data.expense.reimbursementPaidbooleanRequired

    The technician has been paid back.

  • data.expense.receiptobject or nullRequired

    The receipt file, for a receipt expense.

  • data.expense.receipt.fileNamestringRequired

    The receipt file name.

  • data.expense.receipt.hrefstringRequired

    Where the receipt file is served.

  • data.repeatbooleanRequired

    True when this requestId was already used: the first expense is returned and nothing was written.

Errors (400, 401, 402, 403, 404, 429)
  • 400 The body or a parameter is not valid for this operation (apiInvalidInput); the sentence names the field.
  • 401 Missing or invalid API key (apiKeyRequired / apiKeyInvalid). A key also stops working, with apiKeyInvalid, when the staff member who made it is deactivated, blocked or removed.
  • 402 This portal is locked for changes (a trial ended or a payment is overdue): writes are refused until it is settled; reads keep working (apiLocked).
  • 403 The key may not do this (apiKeyScopeInsufficient when it lacks the required scope, apiKeyMakerInsufficient when the staff member who made it does not hold the permission now). Or its organization is inactive (apiKeyOrgInactive). Or the key is limited to one client, which is not supported yet (apiClientKeyUnsupported).
  • 404 Not found for this key (a record in another organization is also a 404, never a 403).
  • 429 Rate limit exceeded; wait Retry-After seconds.

Edit a ticket expense

PATCH/tickets/{ticketId}/expenses/{expenseId}

Scope write:expensesChanges data

Requires the write:expenses scope (or management), and the staff member who made the key must be allowed to do this in the portal right now.

Parameters

  • ticketIdintegerin pathRequired

    Ticket number.

  • expenseIdstringin pathRequired

    Expense id.

  • Idempotency-Keystringin header

    Optional. Send a unique value per intended change; a retry with the same value within 24 hours replays the first answer instead of changing anything twice. Scoped to your API key.

Request body

  • expenseDatestring

    YYYY-MM-DD.

  • descriptionstring

    What the expense was for.

    Up to 500 characters.

  • distancestring or number

    Mileage only.

  • amountstring or number

    Receipt only.

  • reimbursementRatestring or number

    Mileage only: honoured only for someone who may override the rate.

  • markupPctstring or number

    Mileage only: honoured only for someone who may override the rate.

  • billableboolean

    Mileage only.

  • receiptAttachmentIdstring

    Receipt only: a file already on this ticket.

    Up to 100 characters.

  • linkedTicketItemIdstring or null

    Receipt only: a ticket charge that bills it, or null to unlink.

Response 200

  • dataobjectRequired

    The changed expense.

  • data.expenseobjectRequired

    One ticket expense.

  • data.expense.idstringRequired

    Expense id.

  • data.expense.typestringRequired

    MILEAGE or RECEIPT.

  • data.expense.statusstringRequired

    SUBMITTED, APPROVED or REJECTED.

  • data.expense.descriptionstringRequired

    What the expense was for.

  • data.expense.expenseDatestringRequired

    The calendar day of the expense (ISO 8601, UTC).

  • data.expense.distancestring or nullRequired

    Mileage: the distance driven (decimal string), else null.

  • data.expense.distanceUnitstring or nullRequired

    Mileage: mi or km, else null.

  • data.expense.reimbursementRatestring or nullRequired

    Mileage: the rate paid to the technician per unit (decimal string), else null.

  • data.expense.amountstringRequired

    What it cost the MSP (decimal string).

  • data.expense.markupPctstringRequired

    Markup percent on the client charge (decimal string).

  • data.expense.billAmountstring or nullRequired

    The charge to the client, when billable (decimal string).

  • data.expense.billablebooleanRequired

    Whether the client is billed for it.

  • data.expense.rejectReasonstring or nullRequired

    Why it was rejected, when it was.

  • data.expense.userIdstringRequired

    Id of the technician who logged it.

  • data.expense.userNamestringRequired

    Name of the technician who logged it.

  • data.expense.mintedbooleanRequired

    A billable charge was created on the ticket for this expense.

  • data.expense.billedbooleanRequired

    That charge is on an invoice, so the expense is locked.

  • data.expense.reimbursementPaidbooleanRequired

    The technician has been paid back.

  • data.expense.receiptobject or nullRequired

    The receipt file, for a receipt expense.

  • data.expense.receipt.fileNamestringRequired

    The receipt file name.

  • data.expense.receipt.hrefstringRequired

    Where the receipt file is served.

Errors (400, 401, 402, 403, 404, 429)
  • 400 The body or a parameter is not valid for this operation (apiInvalidInput); the sentence names the field.
  • 401 Missing or invalid API key (apiKeyRequired / apiKeyInvalid). A key also stops working, with apiKeyInvalid, when the staff member who made it is deactivated, blocked or removed.
  • 402 This portal is locked for changes (a trial ended or a payment is overdue): writes are refused until it is settled; reads keep working (apiLocked).
  • 403 The key may not do this (apiKeyScopeInsufficient when it lacks the required scope, apiKeyMakerInsufficient when the staff member who made it does not hold the permission now). Or its organization is inactive (apiKeyOrgInactive). Or the key is limited to one client, which is not supported yet (apiClientKeyUnsupported).
  • 404 Not found for this key (a record in another organization is also a 404, never a 403).
  • 429 Rate limit exceeded; wait Retry-After seconds.

All API areas →