{"openapi":"3.1.0","info":{"title":"PUT /api/v1/journal-entries/{journal_entry_id}","version":"1.0.0","description":"Update journal entry"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/journal-entries/{journal_entry_id}":{"put":{"tags":["journal-entries"],"summary":"Update journal entry","description":"Update an existing journal entry's description, date, or line entries.","operationId":"update_journal_entry_api_v1_journal_entries__journal_entry_id__put","parameters":[{"name":"journal_entry_id","in":"path","required":true,"schema":{"type":"string","title":"Journal Entry Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntryResponse"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"detail":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CommentResponse":{"properties":{"comment":{"type":"string","maxLength":10000,"minLength":1,"title":"Comment","description":"The comment text content"},"comment_id":{"type":"string","title":"Comment Id","description":"Unique identifier for the comment"},"thread_id":{"type":"string","title":"Thread Id","description":"UUID of the thread this comment belongs to"},"user_id":{"type":"string","title":"User Id","description":"UUID of the user who created the comment"},"user_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Name","description":"Display name of the comment author"},"object_type":{"type":"string","title":"Object Type","description":"Type of object this comment is attached to"},"object_id":{"type":"string","title":"Object Id","description":"UUID of the object this comment is attached to"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp when the comment was created"}},"type":"object","required":["comment","comment_id","thread_id","user_id","object_type","object_id","created_at"],"title":"CommentResponse","description":"Schema for comment response."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JournalEntryResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for this journal entry (UUID7)."},"description":{"type":"string","title":"Description","description":"Human-readable description of the transaction."},"currency":{"type":"string","title":"Currency","description":"Currency for the journal entry (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"entry_date":{"type":"string","format":"date","title":"Entry Date","description":"The date this transaction occurred."},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Id","description":"UUID of linked invoice, if this entry relates to an invoice."},"inventory_order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inventory Order Id","description":"UUID of linked inventory order (PO), if this entry relates to a PO."},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"Backend origin: manual, invoice, bill, credit_memo, transaction, stripe, shopify, plaid, ramp, square, system, teal"},"creation_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Creation Method","description":"User-facing creation method: ai (system-generated) or manual (user-typed)"},"business_id":{"type":"string","title":"Business Id","description":"UUID of the business this entry belongs to."},"line_entries":{"anyOf":[{"items":{"$ref":"#/components/schemas/LineEntryResponse"},"type":"array"},{"type":"null"}],"title":"Line Entries","description":"The debit and credit line entries that make up this journal entry. Will be empty list if not expanded."},"thread":{"anyOf":[{"$ref":"#/components/schemas/JournalEntryThreadResponse"},{"type":"null"}],"description":"Comment thread information if this journal entry has comments. Contains thread_id, comments array, and comment_count."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When this journal entry was created."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"When this journal entry was last modified."}},"additionalProperties":true,"type":"object","required":["id","description","entry_date","business_id"],"title":"JournalEntryResponse","description":"Response schema for a journal entry.\n\nA journal entry is a complete double-entry accounting record consisting of\ntwo or more line entries that must balance (total debits = total credits).","example":{"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","description":"Record sale to customer - Invoice #1234","entry_date":"2024-01-15","id":"019ab37c-0001-7000-8000-000000000001","invoice_id":"019ab37c-e5b3-7c49-96e1-7c3b4d9f0e2b","line_entries":[{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"},{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"credit","description":"Sales Revenue","entry_date":"2024-01-15","id":"019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a","updated_at":"2024-01-15T10:30:00Z"}],"updated_at":"2024-01-15T10:30:00Z"}},"JournalEntryThreadResponse":{"properties":{"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id","description":"UUID of the associated comment thread."},"comments":{"items":{"$ref":"#/components/schemas/CommentResponse"},"type":"array","title":"Comments","description":"List of comments in the thread."},"comment_count":{"type":"integer","title":"Comment Count","description":"Total number of comments.","default":0}},"type":"object","title":"JournalEntryThreadResponse","description":"Nested thread information for journal entries.\n\nContains comment thread data when a journal entry has associated comments/discussion."},"JournalEntryUpdateRequest":{"properties":{"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Updated description for the journal entry."},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date","description":"Updated date in ISO 8601 format (e.g., '2024-01-15')."},"line_entry_changes":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Line Entry Changes","description":"Object containing arrays of line entry changes. Supports 'create' (new entries), 'update' (modify existing by ID), and 'delete' (remove by ID) operations."}},"additionalProperties":true,"type":"object","title":"JournalEntryUpdateRequest","description":"Request schema for updating an existing journal entry.\n\nYou can update the description, datetime, and/or modify line entries.\nLine entry modifications use a change-based approach with create, update,\nand delete operations.\n\nNote: When updating line entries, ensure the journal entry remains balanced\n(total debits = total credits) after all changes are applied.","example":{"date":"2024-01-16","description":"Updated: Record sale to customer - Invoice #1234 (corrected)","line_entry_changes":{"create":[{"amount":5000,"debit_credit":"debit","description":"Shipping charges","ledger_id":"019ab37c-f6c4-7d5a-a7f2-8d4c5e0f1g3c"},{"amount":5000,"debit_credit":"credit","description":"Shipping revenue","ledger_id":"019ab37c-d4a2-7b38-85f0-6b2a3c8e9f1a"}],"delete":["019ab37c-b2c3-7d4e-f5a6-7b8c9d0e1f2a"],"update":[{"description":"Updated line entry description","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f"}]}}},"LineEntryResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Unique identifier for this line entry (UUID7)."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents (e.g., 15000 = $150.00). Always positive; direction determined by debit_credit."},"currency":{"type":"string","title":"Currency","description":"Currency for the line entry (USD, CAD, AUD, EUR, or GBP).","default":"USD"},"debit_credit":{"type":"string","title":"Debit Credit","description":"Whether this is a 'debit' or 'credit' entry. Debits increase asset/expense accounts; credits increase liability/equity/revenue accounts."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Description of what this specific line entry represents."},"entry_date":{"type":"string","format":"date","title":"Entry Date","description":"Date of the line entry (typically matches parent journal entry)."},"ledger_id":{"type":"string","title":"Ledger Id","description":"UUID of the ledger account this entry affects (e.g., Cash, Accounts Receivable)."},"ledger_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ledger Name","description":"Human-readable name of the ledger account (e.g., 'Cash', 'Accounts Receivable')."},"journal_entry_id":{"type":"string","title":"Journal Entry Id","description":"UUID of the parent journal entry this line belongs to."},"business_id":{"type":"string","title":"Business Id","description":"UUID of the business this entry belongs to."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"When this line entry was created."},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At","description":"When this line entry was last modified."}},"type":"object","required":["id","amount","debit_credit","entry_date","ledger_id","journal_entry_id","business_id"],"title":"LineEntryResponse","description":"Response schema for a line entry within a journal entry.\n\nEach line entry represents one side of the double-entry accounting record,\neither a debit or credit to a specific ledger account.","example":{"amount":150000,"business_id":"019ab37c-0002-7000-8000-000000000002","created_at":"2024-01-15T10:30:00Z","debit_credit":"debit","description":"Accounts Receivable - Customer ABC","entry_date":"2024-01-15","id":"019ab37c-a1b2-7c3d-e4f5-6a7b8c9d0e1f","journal_entry_id":"019ab37c-0001-7000-8000-000000000001","ledger_id":"019ab37c-c309-7698-a8d9-14e0409977d8","updated_at":"2024-01-15T10:30:00Z"}},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}