# POST /api/v1/transactions

> Create transaction

- **Tag:** transactions
- **Operation ID:** `create_transaction_api_v1_transactions_post`

## Description

Manually create a transaction record (not synced from bank).

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `TransactionCreateRequest`

- `amount` (integer) — Amount in cents. Positive for deposits/income, negative for withdrawals/expenses.
- `currency` (string) — Currency code (USD, CAD, AUD, EUR, or GBP). Defaults to business default currency.
- `datetime` (string · date) — Transaction date in ISO 8601 format (YYYY-MM-DD).
- `description` (string) — Human-readable description of the transaction.
- `source_account_id` (string) — UUID of the bank account (ledger) this transaction belongs to.
- `reconciled` (boolean) — Whether this transaction has been reconciled with bank statement.

## Responses

### 201 — Successful Response

Schema: `TransactionResponse`

- `id` (string · required) — Unique identifier (UUID7).
- `amount` (integer · required) — Amount in cents. Positive = deposit/income, negative = withdrawal/expense.
- `currency` (string) — Currency code (USD, CAD, AUD, EUR, or GBP).
- `datetime` (string · date · required) — The date the transaction occurred.
- `counterparty` (string) — Clean counterparty/merchant name extracted from bank data.
- `description` (string) — Transaction memo/description (cleaned).
- `meta` (object) — Additional metadata (raw Plaid description in raw_plaid_description).
- `categorization_method` (string) — How categorized: 'manual', 'rule', 'ai', or null if uncategorized.
- `posted_status` (string) — Bank status: 'pending' or 'posted'.
- `review_status` (string) — Review status: 'unreviewed', 'reviewed', 'flagged'.
- `source` (string) — Transaction origin: 'manual', 'plaid', or 'bulk_upload'. Determines if the transaction can be deleted.
- `opposing_line_entry_ids` (array · string) — Linked line entry UUIDs for categorization.
- `personal` (boolean) — True if marked as personal (non-business) expense.
- `journal_entry_id` (string) — Linked journal entry UUID.
- `teal_id` (string) — External Teal accounting system ID.
- `teal_ledger_id` (string) — Teal ledger ID.
- `teal_source_account_id` (string) — Teal source account ID.
- `ledger_id` (string) — Bank account (ledger) UUID.
- `ledger_name` (string) — Bank account (ledger) name for display.
- `ledger_type` (string) — Ledger account type: asset, liability, equity, revenue, or expense.
- `business_id` (string) — Business UUID.
- `reconciled` (boolean) — True if reconciled with bank statement.
- `invoice_ids` (array · string) — Invoice UUIDs linked via payments (from invoice_payments junction table).
- `bill_ids` (array · string) — Bill UUIDs linked via payments (from bill_payments junction table).
- `created_at` (string · date-time) — Record creation timestamp.
- `updated_at` (string · date-time) — Last update timestamp.
- `thread` (TransactionThreadResponse) — Comment thread if any discussion exists.
- `journal_entry` (JournalEntryResponse) — Full journal entry details if categorized.
- `opposing_line_entries` (array · OpposingLineEntryResponse) → `OpposingLineEntryResponse` — Opposing line entries showing the category/account(s) this transaction was posted to. Empty if uncategorized.
  - `id` (string · required) — Line entry UUID.
  - `amount` (integer · required) — Amount in cents (always positive; direction via debit_credit).
  - `debit_credit` (string · required) — Whether this is a 'debit' or 'credit' entry.
  - `description` (string) — Description of this line entry.
  - `ledger` (OpposingLineEntryLedgerInfo · required) → `OpposingLineEntryLedgerInfo` — The ledger (account) this entry affects.

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/transactions' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": 0,
  "currency": "string",
  "datetime": "2026-01-01",
  "description": "string",
  "source_account_id": "string",
  "reconciled": false
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/transactions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "amount": 0,
  "currency": "string",
  "datetime": "2026-01-01",
  "description": "string",
  "source_account_id": "string",
  "reconciled": false
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "amount": 0,
  "currency": "string",
  "datetime": "2026-01-01",
  "description": "string",
  "source_account_id": "string",
  "reconciled": false
}

response = httpx.post("https://api.ondayzero.com/api/v1/transactions", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/transactions/create-transaction
- OpenAPI slice: https://www.ondayzero.com/docs/reference/transactions/create-transaction/openapi.json
- Other endpoints in **transactions**: https://www.ondayzero.com/docs/reference/transactions
