# Fetch a single ad hoc document by its id.

Operation ID: `getAdHocDocument`

Group: Accounting › Ad Hoc Documents

[Open in the interactive reference](https://lensing.ai/api-docs/lensing/v1/endpoints/getAdHocDocument)

`GET /accounting/ad-hoc-documents/{id}`

Read-only: Reads and returns; changes nothing.

Retrieves one ad hoc document by its id. The response is the full record, including its lines and the uuid references a write needs — the posting account, the posting period, the counterparty and, on each line, its account, tax configuration line and reporting tags. POST accounting/ad-hoc-documents/search returns the same fields for many documents at once.

This resource replaces GET tax-documents/manual-taxable-documents/:id, which is served in v1 only. Every request carries an `Api-Version` header; without it the request is rejected with 400, and a route that exists in another version answers 404.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `id` | path | string | yes | Id of the ad hoc document to fetch (a UUID); bound from the :id path segment. Example: `"3f2a9c14-7b6d-4e58-9a01-2c8f5d6e7a0b"`. |

## Response

`200` Success

Under `data` (getAdHocDocumentOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Id of the ad hoc document (a UUID) — the public identifier used by this route. Example: `"3f2a9c14-7b6d-4e58-9a01-2c8f5d6e7a0b"`. |
| `type` | string | no | Kind of document. One of: `"outgoingInvoice"` (A customer-facing invoice. Its incoming payment can be matched to a bank deposit.), `"outgoingCredit"` (A credit issued to a customer, reducing what they owe.), `"incomingInvoice"` (An invoice received from a vendor, employee or intercompany entity.), `"incomingCredit"` (A credit received from a vendor, employee or intercompany entity.). Example: `"outgoingInvoice"`. |
| `taxDocumentNumber` | string | no | System-generated ad hoc document number, unique per tenant and human-readable. Absent until one has been assigned. Example: `"ADH-1042"`. |
| `documentNumber` | string | no | Document number as it appears on the source document — the counterparty's own number for an incoming document, or the number carried over from an external system. Distinct from taxDocumentNumber, which Everest assigns. Example: `"INV-2026-0188"`. |
| `title` | string | no | Title of the document, as shown on the record. Example: `"Consulting services, October"`. |
| `description` | string | no | Free-text description of the document. Example: `"Recharge of advisory hours"`. |
| `invoiceDate` | date | no | Date the document was issued. Format YYYY-MM-DD. Example: `"2026-10-31"`. |
| `serviceDate` | date | no | Date the underlying service was provided. Drives the tax point where it differs from the invoice date. Format YYYY-MM-DD. Example: `"2026-10-31"`. |
| `dueDate` | date | no | Date payment falls due. Absent when no due date has been set. Format YYYY-MM-DD. Example: `"2026-11-30"`. |
| `currency` | string | no | Currency of this document as a 3-letter ISO 4217 code (e.g. USD, EUR, GBP). It governs every amount on the record, on the header and on every line alike. Example: `"EUR"`. |
| `paymentStatus` | string | no | Settlement status of the document, derived by the server from the document's allocations and the AR-ness of its posting account. One of: `"paid"` (Fully settled by payments.), `"partiallyPaid"` (Settled in part by payments; a balance remains.), `"unpaid"` (Receivable or payable in full, with nothing settled yet.), `"noPaymentNeeded"` (Posted to an account that carries no settlement, so no payment is expected.), `"voided"` (Voided. The journal entry it posted has been reversed and the document can no longer be settled.), `"applied"` (A credit fully applied against other documents.), `"unapplied"` (A credit with nothing applied yet.), `"partiallyApplied"` (A credit applied in part; a balance remains.), `"noApplicationNeeded"` (A credit posted to an account that carries no application, so none is expected.). Example: `"unpaid"`. |
| `paymentTerms` | string | no | Payment terms recorded on the document, as free text (e.g. 'Net 30'). Example: `"Net 30"`. |
| `totalTaxAmount` | decimal | no | Sum of the tax amounts of every line, in the document currency (see currency). Example: `"190.00"`. |
| `totalAmount` | decimal | no | Sum of the total amounts of every line — the gross document total, in the document currency (see currency). Example: `"1190.00"`. |
| `totalAllocatedAmount` | decimal | no | Amount already allocated to this document by payments or credits, in the document currency (see currency). Example: `"0.00"`. |
| `totalOpenAmount` | decimal | no | Remaining unallocated balance on this document, in the document currency (see currency). A voided document keeps its open amount and a noPaymentNeeded one shows its full total here, so this alone does not tell whether a document is still open; use paymentStatus unpaid or partiallyPaid for that. Example: `"1190.00"`. |
| `hasAttachment` | boolean | no | True when the document has at least one attachment. The attachments themselves are not published by this API; document delivery is a separate concern with its own permission. Example: `false`. |
| `accountId` | string | no | Id of the account the document posts its offsetting entry to (a UUID). Whether this account is a receivable account is what decides the document's paymentStatus. Example: `"a41b6c70-2d85-4f19-8c03-5e7a9b1d2f46"`. |
| `postingPeriodId` | string | no | Id of the accounting period the document posted into (a UUID). Derived by the server from invoiceDate when the document is created, and read-only from then on. Example: `"c82d4e90-1f63-4a27-b5d8-093e6c7a1b45"`. |
| `customerId` | string | no | Id of the customer the document is issued to (a UUID). Set on customer-facing documents; absent on vendor, employee or intercompany ones. Example: `"7d1e8f20-3a4b-4c5d-9e60-1f2a3b4c5d6e"`. |
| `customerName` | string | no | Display name of the customer. Personal and counterparty data — it is returned here but is not a filter on GET accounting/ad-hoc-documents, so it never travels in a URL. Example: `"Northwind GmbH"`. |
| `customerNumber` | string | no | System-generated customer number of the customer, unique per tenant. Example: `"CUST-0231"`. |
| `vendorId` | string | no | Id of the vendor the document is received from (a UUID). Set on vendor documents; absent otherwise. |
| `employeeId` | string | no | Id of the employee the document is received from (a UUID). Set on employee documents; absent otherwise. |
| `intercompanyEntityId` | string | no | Id of the intercompany entity the document is exchanged with (a UUID). Set on intercompany documents; absent otherwise. |
| `entityId` | string | no | Id of the legal entity the document belongs to (a UUID). Example: `"1a9c4e70-38b5-4d26-9f01-7c2e5b8a6d43"`. |
| `entityName` | string | no | Name of the legal entity the document belongs to. Example: `"Everest Europe B.V."`. |
| `lastModifiedDate` | date-time | yes | Instant the document record last changed. Poll on this to sync incrementally rather than re-reading the whole collection. ISO 8601 UTC (YYYY-MM-DDTHH:mm:ss.sssZ). Example: `"2026-11-02T09:30:00.000Z"`. |
| `lines` | array<object> | no | Lines of the document, each carrying one taxable position. Empty on a document with no lines. All line amounts are in the document currency (see currency). Example: `[{"id":"9b0c1d2e-4f5a-4b6c-8d7e-0f1a2b3c4d5e","lineNumber":"1","description":"Advisory hours, October","taxableBasis":"1000.00","taxAmount":"190.00","totalAmount":"1190.00","accountId":"5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f","taxConfigurationLineId":"2e3f4a5b-6c7d-4e8f-9a0b-1c2d3e4f5a6b"}]`. |
| `lines[].id` | string | yes | Id of the document line (a UUID). |
| `lines[].lineNumber` | string | no | System-generated line number within the document. Absent until one has been assigned. |
| `lines[].description` | string | no | Free-text description of the line item. |
| `lines[].taxableBasis` | decimal | no | Basis amount the tax is calculated on, in the document currency (see currency). |
| `lines[].taxAmount` | decimal | no | Tax charged on the line, in the document currency (see currency). |
| `lines[].totalAmount` | decimal | no | Line total, in the document currency (see currency): taxableBasis plus taxAmount, or taxableBasis alone on a reverse-charge line. Computed by the server. |
| `lines[].accountId` | string | no | Id of the account this line books its revenue or cost to (a UUID). |
| `lines[].taxConfigurationLineId` | string | no | Id of the tax configuration line that governs this line's tax (a UUID). Absent on a document whose entity has no tax configuration. |
| `lines[].reportingTags` | array<object> | no | The reporting tags this line carries, in the same shape as a journal entry line's. Includes the customer, vendor or employee tag set from the document's counterparty. Empty when the line has none. |
| `lines[].reportingTags[].dimensionCode` | string | yes | The reporting dimension this tag is for. Possible values: 'department', 'businessUnit', 'team', 'location', 'region', 'psaProject', 'employee', 'vendor', 'customer', 'product', 'valueCenter', 'custom'. |
| `lines[].reportingTags[].modelId` | string | yes | The dimension record this tag points to (a UUID), on the model that dimensionCode names. |
| `lines[].reportingTags[].customDimensionId` | string | no | The custom dimension this tag belongs to (a UUID). Present only for a custom-dimension tag. |
| `lines[].reportingTags[].isActive` | boolean | yes | Whether the referenced dimension record is currently active. A document can carry tags that point at records since made inactive. |

```json
{
  "data": {
    "id": "3f2a9c14-7b6d-4e58-9a01-2c8f5d6e7a0b",
    "type": "outgoingInvoice",
    "taxDocumentNumber": "ADH-1042",
    "documentNumber": "INV-2026-0188",
    "title": "Consulting services, October",
    "description": "Recharge of advisory hours",
    "invoiceDate": "2026-10-31",
    "serviceDate": "2026-10-31",
    "dueDate": "2026-11-30",
    "currency": "EUR",
    "paymentStatus": "unpaid",
    "paymentTerms": "Net 30",
    "totalTaxAmount": "190.00",
    "totalAmount": "1190.00",
    "totalAllocatedAmount": "0.00",
    "totalOpenAmount": "1190.00",
    "hasAttachment": false,
    "accountId": "a41b6c70-2d85-4f19-8c03-5e7a9b1d2f46",
    "postingPeriodId": "c82d4e90-1f63-4a27-b5d8-093e6c7a1b45",
    "customerId": "7d1e8f20-3a4b-4c5d-9e60-1f2a3b4c5d6e",
    "customerName": "Northwind GmbH",
    "customerNumber": "CUST-0231",
    "vendorId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "employeeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "intercompanyEntityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entityId": "1a9c4e70-38b5-4d26-9f01-7c2e5b8a6d43",
    "entityName": "Everest Europe B.V.",
    "lastModifiedDate": "2026-11-02T09:30:00.000Z",
    "lines": [
      {
        "id": "9b0c1d2e-4f5a-4b6c-8d7e-0f1a2b3c4d5e",
        "lineNumber": "1",
        "description": "Advisory hours, October",
        "taxableBasis": "1000.00",
        "taxAmount": "190.00",
        "totalAmount": "1190.00",
        "accountId": "5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f",
        "taxConfigurationLineId": "2e3f4a5b-6c7d-4e8f-9a0b-1c2d3e4f5a6b"
      }
    ]
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Errors

| Code | Status |
| --- | --- |
| `NOT_FOUND` | 400 |

## Statuses

- `400` — Invalid request or business failure. Codes: NOT_FOUND
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
