---
title: "Post a purchase"
method: POST
path: "/companies/{companyId}/purchases"
tags: ["Partner API"]
---

# Post a purchase

`POST /companies/{companyId}/purchases`

## Request

- Base URL: `https://ledgerhq.pro/api/v1`
- URL: `https://ledgerhq.pro/api/v1/companies/{companyId}/purchases`
- Auth: one of:
  - HTTP bearer and API key in header `x-organization-id`
  - HTTP bearer and API key in header `x-organization-id`

## Path parameters

- `companyId` string, uuid, required

## Headers

- `Idempotency-Key` string, required

## Request body

- PurchasePostRequest
  - `paymentType` 'cash' | 'check' | 'credit_card' | 'bank_transfer' | 'other'
  - `sourceAccountId` string, uuid, required
  - `date` string, date, required
  - `amountCents` integer, required: Integer cents. Example: 1250 means $12.50.
  - `categoryAccountId` string, uuid, required
  - `classId` string, uuid, nullable: Optional class UUID from GET /classes; tags the income or expense line for Profit & Loss by Class
  - `description` string, required
  - `contactId` string, uuid, nullable
  - `taxRateId` string, uuid, nullable
  - `reference` string, nullable
  - `currencyCode` string
  - `metadata` object

## Response `200`

Idempotent replay

- PostingResponse
  - `data` PostingReceipt
    - `id` string, uuid, required
    - `resourceType` 'purchase' | 'deposit' | 'transfer' | 'bill_payment' | 'journal_entry', required
    - `status` 'draft' | 'posted', required
    - `journalEntryId` string, uuid, required
    - `bankTransactionIds` string[], required
    - `paymentId` string, uuid
    - `ruleResults` PostedTransactionRuleResult[]
      - `bankTransactionId` string, uuid, required
      - `status` 'created' | 'updated' | 'existing' | 'skipped' | 'failed', required
      - `created` boolean, required
      - `ruleId` string, uuid
      - `reason` string
      - `message` string
    - `affectedAccountIds` string[], required
    - `idempotentReplay` boolean, required
    - `createdAt` string, date-time, required

## Other responses

- `201`: Posting created
- `409`: Idempotency conflict
- `default`: Structured posting error

---

[API](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api.md) · [All operations](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/revisions/9a8269f0a586?raw)
