# Updating an existing Invoice

This endpoint returns structured Invoice 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 invoices top-level JSON key.
Please see our Response Format section for more information.

Endpoint: PUT /invoices/{id}
Version: 1.0.0

## Path parameters:

  - `id` (integer, required)
    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.
- additional_items (AdditionalItem) - When included, the additional_item_ids array will reference all additional items included in the invoice.
- billing_milestones (BillingMilestone) - When included, the billing_milestone_ids array will reference all billing milestones included in the invoice.
- expenses (Expense) - When included, the expense_ids array will reference all expenses included in the invoice.
- external_references (ExternalReference) - Includes references to external integrations for this object.
- fixed_fee_items (FixedFeeItem) - When included, the fixed_fee_items array will reference all fixed fee items included in the invoice.
- recipient (User) - The User who received the invoice. Namely, the client lead at the time that the invoice
was created (or null, if no lead client existed at the time).
- time_entries (TimeEntry) - When included, the time_entry_ids array will reference all time entries included in the invoice.
- user (User) - The user who created the invoice.
- workspaces (Workspace) - When included, the workspace_ids array will reference all projects covered by the invoice.

## Request fields (application/json):

  - `invoice` (object)

  - `invoice.time_entry_ids` (array)
    An array of [Time Entry](/tag/Time-Entries) IDs. Setting this field updates the invoice's complete list of time entries; it behaves as an overwrite. Any time entries not included in your request will be removed from the invoice. Additionally, sending an empty array will remove all time entries from the invoice. At least one time entry, expense, fixed fee item, additional item, or billing milestone must be on the invoice.

  - `invoice.expense_ids` (array)
    An array of [Expense](/tag/Expenses) IDs. Setting this field updates the invoice's complete list of expenses; it behaves as an overwrite. Any expenses not included in your request will be removed from the invoice. Additionally, sending an empty array will remove all expenses from the invoice. At least one time entry, expense, fee item, additional item, or billing milestone must be on the invoice.

  - `invoice.payment_schedule` (integer)
    The number of days within which the total amount of the invoice is expected to be paid. For example, use 30 for a Net 30 payment schedule. See https://en.wikipedia.org/wiki/Net_D.

  - `invoice.invoice_date` (string)
    The invoice date.  Determines the date from which the payment schedule will start. The date must be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format.

  - `invoice.user_invoice_number` (integer)
    The invoice number (defined by the user).

  - `invoice.draft` (boolean)
    Whether the invoice is a draft.

  - `invoice.message` (string)
    Notes to be displayed on the invoice.

  - `invoice.user_invoice_title` (string)
    The invoice title (defined by the user).

  - `invoice.purchase_order` (string)
    The invoice purchase order (defined by the user).

  - `invoice.project_code` (string)
    The invoice project code (defined by the user).

  - `invoice.billing_milestone_ids` (array)
    The IDs of [billing milestones](/tag/Billing-Milestones) to add to the invoice. Setting this field updates the invoice's complete list of billing milestones; it behaves as an overwrite. Any billing milestones not included in your request will be removed from the invoice. Additionally, sending an empty array will remove all billing milestones from the invoice. At least one time entry, expense, fixed fee item, additional item, or billing milestone must be on the invoice.

  - `invoice.external_reference` (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 Jira issue to a Kantata OX Project).

  - `invoice.external_reference.service_name` (string, required)
    The provider name of the integration. If you are adding multiple external references to the same object, the service_name must be unique.

  - `invoice.external_reference.service_model` (string, required)
    The object type of the external object this external reference belongs to.

  - `invoice.external_reference.service_model_ref` (string, required)
    The object ID of the external object this external reference belongs to.

  - `invoice.external_reference.status` (string)
    The status of the integration. Options are successful, pending,  or failed.

  - `invoice.external_reference.external_message` (string)
    The message on the external object.

  - `invoice.external_reference.external_link` (string)
    The link to the external object.

  - `invoice.external_reference.external_status` (string)
    The status of the external object in the external system.

  - `invoice.external_reference.locked` (boolean)
    Whether the subject is locked.

## Response 200 fields (application/json):

  - `count` (integer)

  - `meta` (object)

  - `meta.count` (integer)

  - `meta.page_count` (integer)

  - `meta.page_number` (integer)

  - `meta.page_size` (integer)

  - `results` (array)

  - `results.key` (string)

  - `results.id` (string)

  - `invoices` (object)

  - `external_references` (object)

  - `users` (object)

  - `workspaces` (object)

  - `additional_items` (object)

  - `time_entries` (object)

  - `expenses` (object)

  - `fixed_fee_items` (object)

  - `billing_milestones` (object)

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)


