Kantata Kantata OX Knowledge Base Release Notes Status Page

Expenses

Expenses are defined as costs incurred as part of a project, but not related to time. Once created, expenses can be included in generated invoices.

Fetching a list of Expenses

The expenses endpoint provides a list of every expense that the user making the request is allowed to see— across all projects to which the user belongs.

The response will contain an array of expense objects, sorted by the date attribute in descending order, available under the expenses key.

This endpoint returns structured Expense objects. As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the results array and will be indexed by ID in the expenses top-level JSON key. Please see our Response Format section for more information.

Request
query Parameters
approved
boolean

Filter for expenses that are on approved expense reports, or on a workspace that does not require approvals.

created_after
string

Filter for records created after a specified datetime.

created_before
string

Filter for records created before a specified datetime.

created_by
string <date-time>
date_expensed_between
string

Filter for expenses between the start and end dates in a colon-separated YYYY-MM-DD format. For example, 2013-06-01:2013-08-01. If a date is not specified, it is interpreted as no start/end date.

external_reference_external_message
string

Filter the objects based on the external message of their associated external references. This is an exact match.

external_reference_external_status
string

Filter by the status of the external object in the external system.

external_reference_service_model
string

Filter by the type of the external object this external reference belongs to.

external_reference_service_model_ref
integer <int32>

Filter by the id of the external object this external reference belongs to.

external_reference_service_name
string

Filter by the name of the provider for integration.

external_reference_status
string

Filter by the status of the integration, this can be successful or fail.

from_archived_workspaces
boolean
Default: false

Filter for expenses from archived projects.

has_external_references
boolean

Filter by whether or not the object has external references.

in_active_invoice_id
boolean

Limit results to time entries current in the specified active invoice.

include
string

Any of the below associations can be included in your request by providing the include param, e.g. include=association1,association2.

  • active_submission (ExpenseReportSubmission)
  • expense_category (ExpenseCategory) - The category associated with the expense.
  • external_references (ExternalReference) - Includes references to external integrations for this object.
  • receipt (Attachments::ReceiptAttachment) - Information about receipts associated with this expense, returned in the attachments top-level key.
  • recent_submission (ExpenseReportSubmission) - The most recent expense report the expense was submitted in, including any rejected or cancelled reports.
  • role (Role) - The role of the user.
  • story (Story) - Linked task, returned in the stories top-level key.
  • user (User) - The user who created the expense, returned in the users top-level key.
  • vendor (Vendor) - The party to which the expense is payable.
  • workspace (Workspace) - The project to which this expense belongs, returned in the workspaces top-level key.
invoiced
boolean

Include expenses that have been invoiced.

mine
boolean

Filter for expenses created by the user.

on_my_account
boolean
Default: true

Only include expenses that are on internal projects. On my account false will include internal and external expenses.

only
string

Allows you to request one or more resources directly by ID. Multiple IDs can be supplied in a comma separated list, like GET /api/v1/workspaces.json?only=5,6,7.

optional_fields
Array of strings

Allows you to request one or more optional fields as an array.

Items Value: "user_can_edit"
order
string
Default: "date:desc"

Supply order with the name of a valid sort field for the endpoint and a direction.

Valid values: amount:asc, amount:desc, category:asc, category:desc, created_at:asc, created_at:desc, date:asc, date:desc, notes:asc, notes:desc, vendor_name:asc, and vendor_name:desc.

page
integer <int32>
Default: 1
per_page
integer <int32> <= 200
Default: 20
reimbursable
boolean

Filter for expenses that are reimbursable based on the provided value.

submitted
boolean

Filter for expenses that have been submitted.

uninvoiced
boolean

Filter for expenses that have not been invoiced.

unsubmitted
boolean

Filter for expenses that have not been submitted.

updated_after
string

Filter for records updated after a specified datetime.

updated_before
string

Filter for records updated before a specified datetime.

with_expense_approvals
boolean
with_expense_report_id
integer <int32>

Filter for expenses associated with the specified expense report ID. If the report was canceled or rejected, no result is returned.

with_recent_expense_report_ids
string

Filter for expenses associated with the specified expense report IDs, including from canceled and rejected reports. Give multiple report IDs in a comma separated list.

    **Note**: Expenses are only associated with the most recent reports they were submitted in (`recent_submission`).
    If you re-submit an expense from a canceled or rejected report in a new report, the expense will only be returned
    in association with that most recent submission`.
without_external_reference_service_name
string

Exclude by the existence of an external reference with the specified service name.

workspace_id
integer <int32>

Filter for expenses associated with the specified project ID.

Responses
200

A list of Expenses have been retrieved.

Response Schema: application/json
count
integer <int32>
object
Array of objects
object
object
object
object
object
object
object
object
object
object
400

Bad Request

401

Unauthorized request

403

Forbidden request

404

Page Not Found

422

Unprocessable Entity

503

Service is unavailable

get/expenses
Request samples
Response samples
application/json
{
  • "count": 0,
  • "meta": {
    },
  • "results": [
    ],
  • "expenses": {
    },
  • "external_references": {
    },
  • "stories": {
    },
  • "workspaces": {
    },
  • "users": {
    },
  • "attachments": {
    },
  • "expense_report_submissions": {
    },
  • "expense_categories": {
    },
  • "roles": {
    },
  • "vendors": {
    }
}

Creating a new Expense

You can create multiple expenses in a single request if you send an expenses array. An example would be to send a request with the following parameters encoded as application/json:

{"expenses": [ {"workspace_id": 1, "date": "2013-02-19T17:13:23-08:00", "category": "Food", "amount_in_cents": 5000}, {"workspace_id": 1, "date": "2015-02-19T17:13:23-08:00", "category": "Travel", "amount_in_cents": 10000} ]}

This endpoint returns structured Expense objects. As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the results array and will be indexed by ID in the expenses top-level JSON key. Please see our Response Format section for more information.

Request
query Parameters
include
string

Any of the below associations can be included in your request by providing the include param, e.g. include=association1,association2.

  • active_submission (ExpenseReportSubmission)
  • expense_category (ExpenseCategory) - The category associated with the expense.
  • external_references (ExternalReference) - Includes references to external integrations for this object.
  • receipt (Attachments::ReceiptAttachment) - Information about receipts associated with this expense, returned in the attachments top-level key.
  • recent_submission (ExpenseReportSubmission) - The most recent expense report the expense was submitted in, including any rejected or cancelled reports.
  • role (Role) - The role of the user.
  • story (Story) - Linked task, returned in the stories top-level key.
  • user (User) - The user who created the expense, returned in the users top-level key.
  • vendor (Vendor) - The party to which the expense is payable.
  • workspace (Workspace) - The project to which this expense belongs, returned in the workspaces top-level key.
optional_fields
Array of strings

Allows you to request one or more optional fields as an array.

Items Value: "user_can_edit"
Request Body schema: application/json
object
workspace_id
required
integer <int32>

The ID of the project in which the expense will be created.

date
required
string <date>

The date of the expense in ISO8601 format.

expense_category_id
required
integer <int32>

The ID of the category with which the expense will be associated.

category
required
string

The category of the expense as a string.

amount_in_cents
required
integer <int32>

The amount of the expense, in cents. If 'foreign_exchange_amount' is specified, that overrides the 'amount_in_cents'.

object

If you have permission to convert expenses, this is the expense in foreign currency units.

user_id
integer <int32>

The internal ID of the user the expense is associated with. This parameter is ignored unless the authorizing user has financial access in the project and is on the consultants team (or if the authorizing user is an account administrator and has proxy permissions via an account member with those permissions).

notes
string

Freeform text related to the expense.

billable
boolean

A boolean that indicates whether or not the expense is billable.

receipt_id
integer <int32>

The optional ID of an attached receipt for the expense.

story_id
integer <int32>

The optional ID of a task in the project (this will be linked to this expense).

reimbursable
boolean

A boolean that indicates whether the expense is reimbursable to the user.

vendor_id
integer <int32>

The optional ID of the vendor to which the expense is reimbursable.

object

Typically populated programmatically by a third party system via an integration, this is an optional object that holds data from an external system. It connects objects in an external system with objects in Kantata OX (for example, to connect a HubSpot Deal to a Kantata OX Project).

Responses
200

Expense has been created.

Response Schema: application/json
count
integer <int32>
object
Array of objects
object
object
object
object
object
object
object
object
object
object
400

Bad Request

401

Unauthorized request

403

Forbidden request

404

Page Not Found

422

Unprocessable Entity

503

Service is unavailable

post/expenses
Request samples
application/json
{
  • "expense": {
    }
}
Response samples
application/json
{
  • "count": 0,
  • "meta": {
    },
  • "results": [
    ],
  • "expenses": {
    },
  • "external_references": {
    },
  • "stories": {
    },
  • "workspaces": {
    },
  • "users": {
    },
  • "attachments": {
    },
  • "expense_report_submissions": {
    },
  • "expense_categories": {
    },
  • "roles": {
    },
  • "vendors": {
    }
}

Fetching a single Expense

You can request either GET /api/v1/expenses.json?only=5 or GET /api/v1/expenses/5.json. In both cases, default filters will be applied. Unless you provide the from_archived_workspaces:true filter you won't receive expenses from archived projects, and will get a 404 status on the "show" route.

This endpoint returns structured Expense objects. As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the results array and will be indexed by ID in the expenses top-level JSON key. Please see our Response Format section for more information.

Request
path Parameters
id
required
integer

The ID of the Model.

query Parameters
include
string

Any of the below associations can be included in your request by providing the include param, e.g. include=association1,association2.

  • active_submission (ExpenseReportSubmission)
  • expense_category (ExpenseCategory) - The category associated with the expense.
  • external_references (ExternalReference) - Includes references to external integrations for this object.
  • receipt (Attachments::ReceiptAttachment) - Information about receipts associated with this expense, returned in the attachments top-level key.
  • recent_submission (ExpenseReportSubmission) - The most recent expense report the expense was submitted in, including any rejected or cancelled reports.
  • role (Role) - The role of the user.
  • story (Story) - Linked task, returned in the stories top-level key.
  • user (User) - The user who created the expense, returned in the users top-level key.
  • vendor (Vendor) - The party to which the expense is payable.
  • workspace (Workspace) - The project to which this expense belongs, returned in the workspaces top-level key.
optional_fields
Array of strings

Allows you to request one or more optional fields as an array.

Items Value: "user_can_edit"
Responses
200

The Expense has been retrieved.

Response Schema: application/json
count
integer <int32>
object
Array of objects
object
object
object
object
object
object
object
object
object
object
400

Bad Request

401

Unauthorized request

403

Forbidden request

404

Page Not Found

422

Unprocessable Entity

503

Service is unavailable

get/expenses/{id}
Request samples
Response samples
application/json
{
  • "count": 0,
  • "meta": {
    },
  • "results": [
    ],
  • "expenses": {
    },
  • "external_references": {
    },
  • "stories": {
    },
  • "workspaces": {
    },
  • "users": {
    },
  • "attachments": {
    },
  • "expense_report_submissions": {
    },
  • "expense_categories": {
    },
  • "roles": {
    },
  • "vendors": {
    }
}

Updating an existing Expense

An expense that has already been created can be updated with an HTTP PUT request. Any required or optional attribute, with the exception of workspace_id, can be changed in an update.

This endpoint returns structured Expense objects. As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the results array and will be indexed by ID in the expenses top-level JSON key. Please see our Response Format section for more information.

Request
path Parameters
id
required
integer

The ID of the Model.

query Parameters
include
string

Any of the below associations can be included in your request by providing the include param, e.g. include=association1,association2.

  • active_submission (ExpenseReportSubmission)
  • expense_category (ExpenseCategory) - The category associated with the expense.
  • external_references (ExternalReference) - Includes references to external integrations for this object.
  • receipt (Attachments::ReceiptAttachment) - Information about receipts associated with this expense, returned in the attachments top-level key.
  • recent_submission (ExpenseReportSubmission) - The most recent expense report the expense was submitted in, including any rejected or cancelled reports.
  • role (Role) - The role of the user.
  • story (Story) - Linked task, returned in the stories top-level key.
  • user (User) - The user who created the expense, returned in the users top-level key.
  • vendor (Vendor) - The party to which the expense is payable.
  • workspace (Workspace) - The project to which this expense belongs, returned in the workspaces top-level key.
optional_fields
Array of strings

Allows you to request one or more optional fields as an array.

Items Value: "user_can_edit"
Request Body schema: application/json
object
date
string <date>

The date of the expense in ISO8601 format.

expense_category_id
integer <int32>

The ID of the category to which the expense will be associated.

category
string

The category of the expense as a string.

amount_in_cents
required
integer <int32>

The amount of the expense, in cents. If 'foreign_exchange_amount' is specified, that overrides the 'amount_in_cents'.

object

If you have permission to convert expenses, this is the expense in foreign currency units.

user_id
integer <int32>

The internal ID of the user with whom the expense is associated. This parameter is ignored unless the authorizing user has financial access in the project and is on the consultants team; or if they are an Account Administrator that has proxy permissions through an account member with the necessary permissions.

notes
string

Freeform text related to the expense.

billable
boolean

A boolean that indicates whether or not this expense is billable.

receipt_id
integer <int32>

The optional ID of an attached receipt for this expense.

story_id
integer <int32>

The optional ID of a task in a project linked to this expense.

object

Typically populated programmatically by a third party system via an integration, this is an optional object that holds data from an external system. It connects objects in an external system with objects in Kantata OX (for example, to connect a HubSpot Deal to a Kantata OX Project).

Responses
200

Expense has been updated.

Response Schema: application/json
count
integer <int32>
object
Array of objects
object
object
object
object
object
object
object
object
object
object
400

Bad Request

401

Unauthorized request

403

Forbidden request

404

Page Not Found

422

Unprocessable Entity

503

Service is unavailable

put/expenses/{id}
Request samples
application/json
{
  • "expense": {
    }
}
Response samples
application/json