# Create Journal Entry

`POST /accounting/journal-entries`

Group: Accounting › Journal Entries · Operation ID: `createJournalEntry`

Creates one journal entry with its debit and credit lines. The response contains only the new entry's id. Read the entry with GET accounting/journal-entries/:id.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=createJournalEntry)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"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`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |

## Request body

Required, `application/json`: createJournalEntryInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | The display name of the journal entry. |
| `description` | string | no | A free-form description of the journal entry. |
| `postingDate` | string (date) | yes | The date the entry posts to the general ledger. Use format YYYY-MM-DD. Each line takes this as its transaction date. |
| `reversalDate` | string (date) | no | The reversal date recorded on the header. Use format YYYY-MM-DD. This does not post a reversal. To post one, use POST accounting/journal-entries/:id/reverse. |
| `reversalReason` | string | no | The reason recorded on the header for a later reversal. Accepted values: 'accrualReversal', 'revaluationReversal', 'estimate', 'rebook', 'reversingSFD', 'other'. |
| `reversalDescription` | string | no | A free-form reversal description recorded on the header. |
| `url` | string | no | A link to the source document this entry comes from. |
| `bookId` | string | yes | The accounting book this entry posts to. See id on GET accounting/books/:id. |
| `deriveToAllBooks` | boolean | no | Whether to replicate the entry to every accounting book. Defaults to false. Has no effect unless multi-book accounting is enabled. |
| `lines` | array of object | yes | The debit and credit lines of the entry. Each line is a debit or a credit in its transactionalCurrency. |
| `lines[].accountId` | string | yes | The general ledger account this line posts to. See id on GET accounting/accounts/:id. |
| `lines[].entityId` | string | yes | The legal entity this line posts to. See id on GET base/entities. |
| `lines[].transactionalCurrency` | string | yes | The currency of this line's debit or credit amount. Format ISO 4217, for example 'USD'. |
| `lines[].description` | string | no | A free-form description of the line. |
| `lines[].intercompanyPartnerId` | string | no | The intercompany counterparty for this line. Set on intercompany lines. |
| `lines[].debit` | string (decimal) | no | The debit amount for this line, in its transactionalCurrency. A line sets either debit or credit, not both. |
| `lines[].credit` | string (decimal) | no | The credit amount for this line, in its transactionalCurrency. A line sets either debit or credit, not both. |
| `lines[].exchangeRate` | string (decimal) | no | The exchange rate from the line's transactionalCurrency to the entity's functional currency. It applies only when the two currencies differ. For a same-currency line it is 1 and any value you send is ignored. When you omit it on a foreign-currency line, it defaults to the latest rate on or before the posting date. |
| `lines[].reportingTags` | array of object | no | The reporting tags for this line, one per reporting dimension. Each tag pairs a dimensionCode with a modelId. A line has at most one tag per dimensionCode. The referenced record must exist and be active, or the call fails with REFERENCED_RECORD_NOT_FOUND. Omit or send an empty array for an untagged line. |
| `lines[].reportingTags[].dimensionCode` | string | yes | The reporting dimension this tag is for. It determines which model modelId points to. Accepted values: 'department', 'businessUnit', 'team', 'location', 'region', 'employee', 'vendor', 'customer', 'valueCenter', 'custom'. |
| `lines[].reportingTags[].modelId` | string | yes | The dimension record this tag points to, on the model that dimensionCode names. For example, a department record when dimensionCode is 'department'. It must be an existing, active record. |

Example:

```json
{
  "name": "<name>",
  "description": "<description>",
  "postingDate": "2026-01-15",
  "reversalDate": "2026-01-15",
  "reversalReason": "<reversalReason>",
  "reversalDescription": "<reversalDescription>",
  "url": "<url>",
  "bookId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "deriveToAllBooks": true,
  "lines": [
    {
      "accountId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "transactionalCurrency": "<transactionalCurrency>",
      "description": "<description>",
      "intercompanyPartnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "debit": "19.99",
      "credit": "19.99",
      "exchangeRate": "19.99",
      "reportingTags": [
        {
          "dimensionCode": "<dimensionCode>",
          "modelId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        }
      ]
    }
  ]
}
```

## Response

`200` Success

Under `data` (createJournalEntryOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the created journal entry. |

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `REFERENCED_RECORD_NOT_FOUND` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: REFERENCED_RECORD_NOT_FOUND
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests
- `500` — Internal server error
