---
title: "Prepare a draft batch that creates one Median account in a new or established QuickBooks file (#3605)"
method: POST
path: "/accountant/companies/{customerId}/integrations/quickbooks/writebacks/account-create"
tags: ["Accountants"]
---

# Prepare a draft batch that creates one Median account in a new or established QuickBooks file (#3605)

`POST /accountant/companies/{customerId}/integrations/quickbooks/writebacks/account-create`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/companies/{customerId}/integrations/quickbooks/writebacks/account-create`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Builds ONE draft write-back batch holding a single pending `create_account` item (purpose `single_account_create`) for the named Median account, after the same judgement as the GET preview. Unlike the chart push it runs in an established QuickBooks file. Nothing is sent: the batch is approved and posted through the write-back batch routes with its `manifestSha256`; the created account is read back and then recorded as the QuickBooks account mapping of the Median account. A Bank or Credit Card mapping is recorded with cash source `quickbooks`, so a journal entry with a line on that account stays blocked (QUICKBOOKS_WRITEBACK_CASH_FROM_QUICKBOOKS_FEED) until the mapping is re-approved through `account-mappings` with cash source `median`. A Bank or Credit Card account is refused here, as in the preview, when its GL account cannot back its QuickBooks reconciliation account (BUSINESS_RULE_VIOLATION, the check verify runs before mapping). Before an approved single-account create is sent, posting repeats that Bank/Card check; a refusal leaves the batch approved and sends nothing. If the GL account or its bank row changes after that check or an earlier send and verify then refuses, QuickBooks already has the account: the item stays `sent` and the batch `posting`, which cannot be cancelled, and `account-mappings` refuses the same pair; fix the GL account or its bank row, then post the same batch again (QuickBooks is not sent a second create). 422 QUICKBOOKS_ACCOUNT_CREATE_NOT_FOUND, QUICKBOOKS_ACCOUNT_CREATE_REFUSED (`reason` in the problem; an account another batch holds is refused here), BUSINESS_RULE_VIOLATION (a Bank or Credit Card account, above), QUICKBOOKS_CHART_PUSH_NO_INVENTORY, QUICKBOOKS_CHART_PUSH_NEWER_READ_UNFINISHED while a newer QuickBooks read is queued, running or failed (`newerRunStatus` in the problem), QUICKBOOKS_WRITEBACK_NO_CUTOFF, QUICKBOOKS_LEDGER_NOT_CONNECTED. 409 QUICKBOOKS_WRITER_WINDOW_HELD while another QuickBooks write or read holds the company's writer window (retry), QUICKBOOKS_BATCH_AUTHORITY_CHANGED when the mappings or cutoff changed during preparation, QUICKBOOKS_WRITEBACK_ALREADY_HELD when a concurrent prepare took the account first.

## Path parameters

- `customerId` string, uuid, required

## Request body

- object
  - `glAccountId` string, uuid, required

## Response `201`

The draft batch with its one item

- object
  - `success` true, required
  - `data` QuickBooksWritebackBatchDetail, required
    - `batch` QuickBooksWritebackBatch, required
      - `id` string, uuid, required
      - `companyId` string, uuid, required
      - `entityId` string, uuid, required
      - `connectionId` string, uuid, required
      - `realmId` string, required
      - `cutoffId` string, uuid, required
      - `dateFrom` string, date, nullable, required
      - `dateTo` string, date, nullable, required
      - `status` 'draft' | 'approved' | 'posting' | 'posted' | 'failed' | 'cancelled', required
      - `manifestSha256` string, required
      - `preparedByUserId` string, uuid, required
      - `preparedAt` string, date-time, required
      - `approvedByUserId` string, uuid, nullable, required
      - `approvedAt` string, date-time, nullable, required
      - `postedByUserId` string, uuid, nullable, required
      - `postingStartedAt` string, date-time, nullable, required
      - `postedAt` string, date-time, nullable, required
      - `cancelledByUserId` string, uuid, nullable, required
      - `cancelledAt` string, date-time, nullable, required
      - `errorCode` string, nullable, required
    - `items` QuickBooksWritebackItem[], required
      - `id` string, uuid, required
      - `batchId` string, uuid, required
      - `companyId` string, uuid
      - `kind` 'create_journal_entry' | 'sparse_update' | 'create_account' | 'create_transaction' | 'delete_transaction' | 'create_correcting_journal_entry', required: create_transaction and delete_transaction are the bank-feed push (#2642 phase 2; create_transaction also from named rows,
      - `journalEntryId` string, uuid, nullable, required
      - `linkId` string, uuid, nullable, required
      - `glAccountId` string, uuid, nullable, required: The Median GL account a create_account (chart push) item creates, maps or skips; null for other kinds
      - `transactionId` string, uuid, nullable, required: The native bank-feed transaction a bank-feed push item (create_transaction, delete_transaction, or a sparse_update of a pushed object) concerns; null otherwise
      - `reason` string, nullable, required: Why a create_correcting_journal_entry item is made (required for that kind, immutable, kept in Median only); null for other kinds
      - `requestId` string, uuid, required: Intuit requestid idempotency key
      - `requestSha256` string, required
      - `payload` object, required: The exact QuickBooks request body (amounts as decimal strings; sent as JSON numbers)
      - `expected` object, required: What the read-back must show (or the block reasons of a blocked item)
      - `status` 'pending' | 'approved' | 'sending' | 'sent' | 'verified' | 'failed' | 'blocked' | 'cancelled', required
      - `blockCode` string, nullable, required
      - `qboObjectType` 'JournalEntry' | 'Purchase' | 'Deposit' | 'Account', required
      - `qboId` string, nullable, required
      - `qboSyncToken` string, nullable, required
      - `readbackSha256` string, nullable, required
      - `pushLinkId` string, uuid, nullable, required
      - `attempts` integer, required
      - `lastErrorCode` string, nullable, required
      - `preparedByUserId` string, uuid
      - `preparedAt` string, date-time
      - `approvedByUserId` string, uuid, nullable
      - `approvedAt` string, date-time, nullable
      - `sentAt` string, date-time, nullable
      - `verifiedAt` string, date-time, nullable

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `409`: The writer window is held (QUICKBOOKS_WRITER_WINDOW_HELD, retry), the mappings or cutoff changed during preparation (QUICKBOOKS_BATCH_AUTHORITY_CHANGED), or a concurrent prepare took the account (QUICKBOOKS_WRITEBACK_ALREADY_HELD)
- `422`: Missing or invalid glAccountId, an account Median would not create, a Bank or Credit Card account whose GL account cannot back its reconciliation account, no completed or a newer unfinished QuickBooks read, no cutoff, or QuickBooks not connected

## Changes

- **2026-10-31** `6e6a8e3c23e5`: 1 warning, 1 info
  - added the new `create_correcting_journal_entry` enum value to the `data/items/items/kind` response property for the response status `201`
  - added the required property `data/items/items/reason` to the response with the `201` status
- **2026-10-22** `294f6d703846`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/companies/:customerId/integrations/quickbooks/writebacks/account-create/post.md)

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) - [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) - [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/4f4c2d34276b?raw)
