> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Invoice Contract Line

# Get Invoice Contract Line

Returns the `CoworkerContract` record linked to a specific invoice line. This endpoint is used to enrich invoice lines that originate from a plan/contract charge, providing full contract details (plan name, dates, pricing, status) alongside the invoice.

## Authentication

This endpoint requires an authenticated customer session.

## Path Parameters

<ParamField path="invoiceId" type="number" required>
  The unique identifier of the parent invoice.
</ParamField>

<ParamField path="coworkerContractsUniqueId" type="string" required>
  The `UniqueId` of the contract associated with the invoice line. Available on the invoice line object.
</ParamField>

## Query Parameters

<ParamField query="_shape" type="string">
  Comma-separated list of field paths to include in the response. When provided, only the
  specified fields are returned — useful for reducing payload size. Supports nested paths
  using dot notation. Example: `_shape=Contract.Tariff.Name,Contract.Price,Contract.Active`.
</ParamField>

## Response

Returns a `CoworkerContract` object.

<ResponseField name="Id" type="number">
  Unique identifier of the contract.
</ResponseField>

<ResponseField name="UniqueId" type="string">
  Globally unique identifier of the contract.
</ResponseField>

<ResponseField name="TariffId" type="number">
  ID of the plan associated with this contract.
</ResponseField>

<ResponseField name="TariffName" type="string">
  Display name of the plan.
</ResponseField>

<ResponseField name="StartDate" type="string">
  ISO 8601 date when the contract started.
</ResponseField>

<ResponseField name="RenewalDate" type="string">
  ISO 8601 date of the next renewal.
</ResponseField>

<ResponseField name="Price" type="number">
  Current price of the contract.
</ResponseField>

<ResponseField name="PriceFormatted" type="string">
  Pre-formatted price string (e.g. `"$99.00/mo"`).
</ResponseField>

<ResponseField name="Active" type="boolean">
  Whether the contract is currently active.
</ResponseField>

<ResponseField name="Cancelled" type="boolean">
  Whether the contract has been cancelled.
</ResponseField>

<ResponseField name="IsPaused" type="boolean">
  Whether the contract is currently in a paused state.
</ResponseField>

<ResponseField name="BillingDay" type="number">
  Day of the month on which the contract is billed.
</ResponseField>

<ResponseField name="CurrencyCode" type="string">
  ISO 4217 currency code for the contract.
</ResponseField>

## Example Response

```json theme={null}
{
  "Id": 5001,
  "UniqueId": "c7d8e9f0-1234-5678-abcd-ef0987654321",
  "TariffId": 12,
  "TariffName": "Hot Desk Monthly",
  "StartDate": "2025-01-01",
  "RenewalDate": "2025-11-01",
  "Price": 199.0,
  "PriceFormatted": "$199.00",
  "Active": true,
  "Cancelled": false,
  "IsPaused": false,
  "BillingDay": 1,
  "CurrencyCode": "USD"
}
```

## Usage in Portal

Used to render contract/plan details within invoice line rows in the basket summary and invoice views.

* File: `src/components/Basket/invoiceLines/PlanInvoiceLineRow.tsx`

### Typical integration pattern

```ts theme={null}
// From src/api/endpoints.ts
// endpoints.billing.invoices.coworkerContract = (invoiceId: number, coworkerContractsUniqueId: string) => ({
//   url: `/api/public/billing/invoices/${invoiceId}/coworkerContracts/${coworkerContractsUniqueId}`,
//   type: null as unknown as CoworkerContract,
// })

// Usage in React
const endpoint = endpoints.billing.invoices.coworkerContract(invoice.Id, line.CoworkerContractUniqueId)
const { resource: contract } = useData<typeof endpoint.type>(httpClient, endpoint.url)
```

## Related Endpoints

* `GET /api/public/billing/invoices/{invoiceId}` – Get full invoice details
* `GET /api/public/billing/coworkerContracts/{contractId}` – Get contract details directly

## Error Responses

<ResponseField name="401 Unauthorized" type="error">
  The current user is not authenticated or does not have access to this invoice.
</ResponseField>

<ResponseField name="404 Not Found" type="error">
  The invoice or contract does not exist or cannot be associated.
</ResponseField>
