# Creating a new 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: POST /invoices
Version: 1.0.0

## 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, required)
    [Time Entry](/tag/Time-Entries) IDs. (At least one of the following is required: time_entry_ids, expense_ids, additional_items, fixed_fee_items, or billing_milestone_ids.).

  - `invoice.expense_ids` (array, required)
    [Expense](/tag/Expenses) IDs. (At least one of the following is required: time_entry_ids, expense_ids, additional_items, fixed_fee_items, or billing_milestone_ids.).

  - `invoice.fixed_fee_items` (array, required)
    Fixed fee item objects to create (At least one of the following is required: time_entry_ids, expense_ids, additional_items, fixed_fee_items, or billing_milestone_ids.).

  - `invoice.fixed_fee_items.notes` (string)
    Notes to display on the fixed fee item.

  - `invoice.fixed_fee_items.amount` (integer)
    The value of the fixed fee item, in the currency's main unit. Dollars, for example.

  - `invoice.fixed_fee_items.taxable` (boolean)
    Whether the fixed fee item is taxable.

  - `invoice.fixed_fee_items.story_id` (integer)
    The ID of the [Story](/tag/Stories) associated with the fixed fee item.

  - `invoice.fixed_fee_items.workspace_id` (integer)
    The ID of the [Workspace](/tag/Workspaces) associated with the fixed fee item.

  - `invoice.additional_items` (array, required)
    Additional item objects to create (At least one of the following is required: time_entry_ids, expense_ids, additional_items, fixed_fee_items, or billing_milestone_ids.).

  - `invoice.additional_items.notes` (string)
    Notes to be displayed on the additional item.

  - `invoice.additional_items.amount` (integer)
    The value of the additional item, in the currency's main unit. Dollars, for example.

  - `invoice.additional_items.taxable` (boolean)
    Whether the additional item is taxable.

  - `invoice.additional_items.workspace_id` (integer)
    The ID of the [Workspace](/tag/Workspaces) associated with the additional item.

  - `invoice.workspace_id` (integer, required)
    The ID of the [Workspace](/tag/Workspaces) in which to create the invoice.

  - `invoice.payment_schedule` (integer, required)
    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.workspace_ids` (array)
    The IDs of the [Workspaces](/tag/Workspaces) in which to create the (multi-project) invoice.

  - `invoice.invoice_date` (string)
    The invoice date. 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.suppress_emails` (boolean)
    Setting suppress_emails to true will prevent creation emails from being sent.

  - `invoice.billing_milestone_ids` (array)
    The IDs of [billing milestones](/tag/Billing-Milestones) to add to the invoice. (At least one of the following is required: time_entry_ids, expense_ids, additional_items, fixed_fee_items, or billing_milestone_ids.).

  - `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)


