## Create a transaction `POST https://getkollek.com/api/copies/{copy}/transactions` Record a transaction against a copy. **Permissions:** Owners and editors. Viewers get a 404 response. ### Path parameters - `copy` (integer, required): The ID of the copy the transaction belongs to. ### Body parameters - `type` (string, required): What kind of exchange this records. One of purchase, sale, trade, gift_received, gift_given, inheritance, refund, fee, tax, shipping or other. - `occurred_at` (string, required): The date the exchange happened, in YYYY-MM-DD format. - `counterparty` (string, optional): Who was on the other side of the exchange, such as the seller or the buyer. - `amount` (integer, optional): The headline price, in the smallest currency unit (e.g. cents), before tax, fees and shipping. - `currency_code` (string, optional): The three letter currency code every amount on the transaction is expressed in. Defaults to the currency of the collection. - `tax_amount` (integer, optional): The tax paid, in the smallest currency unit. - `fee_amount` (integer, optional): The fees paid, in the smallest currency unit. - `shipping_amount` (integer, optional): The shipping paid, in the smallest currency unit. - `total_amount` (integer, optional): What actually changed hands, in the smallest currency unit. Leave it out and the total is read as the sum of the amount, the tax, the fees and the shipping. - `reference_number` (string, optional): An order or invoice number for the exchange. - `source_url` (string, optional): A link to the listing or the receipt the exchange came from. - `note` (string, optional): A free form note about the exchange. **Returns:** The created transaction object. ### Example request ```bash curl https://getkollek.com/api/copies/1/transactions \ -X POST \ -H "Authorization: Bearer $API_KEY" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "type": "purchase", "occurred_at": "2024-01-15", "counterparty": "Central Perk Collectibles", "amount": "5000", "currency_code": "USD", "tax_amount": "400", "fee_amount": "250", "shipping_amount": "900", "total_amount": "6550", "reference_number": "INV-1994", "source_url": "https://example.com/listings/1994", "note": "Haggled down at the flea market." }' ``` ### Example response `Status: 201` ```json { "data": { "type": "transaction", "id": "1", "attributes": { "copy_id": "1", "type": "purchase", "counterparty": "Central Perk Collectibles", "amount": 5000, "currency_code": "USD", "tax_amount": null, "fee_amount": null, "shipping_amount": null, "total_amount": 6550, "total": 6550, "occurred_at": 1752537600, "reference_number": null, "source_url": null, "note": null, "created_at": 1752537600, "updated_at": 1752537600 }, "links": { "self": "https://getkollek.com/api/copies/1/transactions/1" } } } ```