# Creating one or many Billing Milestones

Add a billing milestone to your Billing Schedule. Up to 100 billing milestones can be created in one request.

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

Endpoint: POST /billing_milestones
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.
- external_references (ExternalReference) - Includes references to external integrations for this object.
- invoices (Invoice) - Retrieves the invoices that the billing milestones are on. The response will include invoice_ids, which references the data in the invoices top-level key.
- story (Story) - Retrieves the task associated with the billing milestone. The response will include story_id, which references the data in the stories top-level key.
- workspace (Workspace) - Retrieves the project that the billing milestone is in. The response will include workspace_id, which references the data in the workspaces top-level key.

## Request fields (application/json):

  - `billing_milestone` (object)

  - `billing_milestone.title` (string, required)
    The title of the billing milestone.

  - `billing_milestone.amount_in_cents` (integer, required)
    The billing milestone amount, in the subunits of the currency (e.g. cents for USD). Values can also be negative (e.g. -10000).

  - `billing_milestone.workspace_id` (integer, required)
    The ID of the workspace associated with the billing milestone.

  - `billing_milestone.date_to_invoice` (string)
    The date that the billing milestone becomes invoiceable. The date must be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format.

  - `billing_milestone.story_id` (integer)
    The ID of the story associated with the billing milestone. This field is required when the billing_type is set to upon_completion.

  - `billing_milestone.billing_type` (string)
    The billing type of the milestone. Can be 'fixed_date' or 'upon_completion'.

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

  - `billing_milestone.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.

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

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

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

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

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

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

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

  - `billing_milestones` (array)
    Add multiple billing milestones and their attributes in an array.

  - `billing_milestones.title` (string, required)
    The title of the billing milestone.

  - `billing_milestones.amount_in_cents` (integer, required)
    The billing milestone amount, in the subunits of the currency (e.g. cents for USD). Values can also be negative (e.g. -10000).

  - `billing_milestones.workspace_id` (integer, required)
    The ID of the workspace associated with the billing milestone.

  - `billing_milestones.date_to_invoice` (string)
    The date that the billing milestone becomes invoiceable. The date must be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format.

  - `billing_milestones.story_id` (integer)
    The ID of the story associated with the billing milestone. This field is required when the billing_type is set to upon_completion.

  - `billing_milestones.billing_type` (string)
    The billing type of the milestone. Can be 'fixed_date' or 'upon_completion'.

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

  - `billing_milestones.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.

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

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

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

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

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

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

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

  - `billing_milestones` (object)

  - `external_references` (object)

  - `workspaces` (object)

  - `stories` (object)

  - `invoices` (object)

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)


