---
title: "Preview a project time invoice"
method: POST
path: "/companies/{company}/projects/{project}/time-invoices/preview"
tags: ["Projects"]
---

# Preview a project time invoice

`POST /companies/{company}/projects/{project}/time-invoices/preview`

## Request

- Base URL: `https://api.factuarea.com/v1`
- URL: `https://api.factuarea.com/v1/companies/{company}/projects/{project}/time-invoices/preview`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Preview the invoice lines that invoicing the selected time would produce, without creating anything.
- Entries that cannot be invoiced return 422 `task_time_not_invoiceable`.
- Read-only POST: no `Idempotency-Key` needed.

## Path parameters

- `company` string, uuid, required
- `project` string, uuid, required

## Headers

- `Factuarea-Version` string, date

## Request body

- PreviewTaskTimeInvoiceV1Request
  - `entry_ids` string[]: Concrete time entries to invoice (mutually exclusive with `period`).
  - `period` object: Period, by the start date of the entries (mutually exclusive with `entry_ids`).
    - `from` string, date
    - `to` string, date
  - `grouping` 'per_task' | 'per_entry' | 'single_line', required: How the invoice lines are grouped.

## Response `200`

- object
  - `data` TaskTimeInvoicePreview, required: Invoice lines that invoicing the selected time would produce. Nothing is created.
    - `object` 'task_time_invoice_preview', required: Stripe-like discriminator. Always `task_time_invoice_preview` for this resource.
    - `project_id` string, uuid, required: UUID of the project.
    - `customer_id` string, uuid, required: UUID of the contact that would be invoiced.
    - `customer_name` string, required: Name of that contact.
    - `grouping` 'per_task' | 'per_entry' | 'single_line', required: How the time becomes invoice lines: one per task, one per entry, or a single line.
    - `lines` object[], required: Invoice lines, before taxes.
      - `description` string, required: Line text.
      - `quantity` string, required: Hours, as a decimal string.
      - `unit` string, required: Unit code (`HUR`, hours).
      - `unit_price` string, required: Hourly rate, as a decimal string.
      - `amount` string, required: Line amount before taxes, as a decimal string.
    - `total_seconds` integer, required: Seconds invoiced.
    - `total_hours` string, required: Hours invoiced, as a decimal string.
    - `total_amount` string, required: Sum of the line amounts before taxes, as a decimal string.
    - `entry_ids` string[], required: UUIDs of the time entries that would be invoiced.
    - `warnings` string[], required: Adjustments to review before invoicing, in Spanish.

## Other responses

- `400`: `parameter_unknown` with `subcode` `retired_active_profile_header`: the retired `X-Active-Profile` header was sent; the company goes in the path. `parameter_invalid_format` on `Factuarea-Version`: the header is not a `YYYY-MM-DD` date. `unsupported_api_version`: the `Factuarea-Version` date is not a supported version.
- `401`: Missing or invalid API key.
- `403`: The request is authenticated but not allowed: the API key lacks the required scope (`insufficient_scope`), the plan does not include the public API or this feature (`addon_not_active`, `feature_not_available_in_plan`), or the module is not available with a test key (`module_not_available_in_sandbox`).
- `404`: The requested resource does not exist or belongs to another company.
- `422`: Validation failed. The `error.param` field identifies which input is invalid.
- `429`: Rate limit exceeded. Retry after the duration in `Retry-After`.
- `500`: Unexpected server error.

---

[API](https://skmtc.dev/factuarea/apis/factuarea-public-api.md) · [All operations](https://skmtc.dev/factuarea/apis/factuarea-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/factuarea/apis/factuarea-public-api/revisions/718e77934422?raw)
