{"openapi":"3.1.0","info":{"title":"POST /api/v1/transactions/suggest-categories","version":"1.0.0","description":"Category suggestions"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/transactions/suggest-categories":{"post":{"tags":["transactions"],"summary":"Category suggestions","description":"Suggest ledger categories for uncategorized transactions.  By default only fast pattern-matching layers run (<1 s).  Pass include_ai=true to also run LLM categorization for transactions the pattern layers could not resolve.","operationId":"suggest_categories_api_v1_transactions_suggest_categories_post","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}},{"name":"only_uncategorized","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Only Uncategorized"}},{"name":"include_ai","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Ai"}},{"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"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestCategoriesResponse"}}}},"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"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CategorySuggestionItem":{"properties":{"transaction_id":{"type":"string","title":"Transaction Id","description":"ID of the transaction"},"suggested_ledger_id":{"type":"string","title":"Suggested Ledger Id","description":"Suggested ledger/account ID"},"suggested_ledger_name":{"type":"string","title":"Suggested Ledger Name","description":"Suggested ledger/account name"},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Confidence score 0-1"},"reason":{"type":"string","title":"Reason","description":"Brief reason for this suggestion"}},"type":"object","required":["transaction_id","suggested_ledger_id","suggested_ledger_name","confidence","reason"],"title":"CategorySuggestionItem"},"CounterpartySuggestionGroup":{"properties":{"counterparty":{"type":"string","title":"Counterparty","description":"Counterparty name"},"suggested_ledger_id":{"type":"string","title":"Suggested Ledger Id","description":"Suggested ledger/account ID"},"suggested_ledger_name":{"type":"string","title":"Suggested Ledger Name","description":"Suggested ledger/account name"},"confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Confidence","description":"Avg confidence score"},"reason":{"type":"string","title":"Reason","description":"Strategy or pattern that matched"},"transaction_ids":{"items":{"type":"string"},"type":"array","title":"Transaction Ids","description":"IDs of transactions in this group (from analyzed batch)"},"transaction_count":{"type":"integer","title":"Transaction Count","description":"Total transactions for this counterparty (may exceed analyzed batch)"},"sample_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sample Description","description":"Example transaction description for context"}},"type":"object","required":["counterparty","suggested_ledger_id","suggested_ledger_name","confidence","reason","transaction_count"],"title":"CounterpartySuggestionGroup","description":"A group of transactions sharing the same counterparty and suggested category."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"SuggestCategoriesResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/CategorySuggestionItem"},"type":"array","title":"Suggestions"},"groups":{"items":{"$ref":"#/components/schemas/CounterpartySuggestionGroup"},"type":"array","title":"Groups","description":"Suggestions grouped by counterparty for bulk operations"},"count":{"type":"integer","title":"Count","description":"Number of suggestions returned","default":0},"total_uncategorized":{"type":"integer","title":"Total Uncategorized","description":"Total uncategorized transactions in the business","default":0}},"type":"object","title":"SuggestCategoriesResponse"},"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":[]}]}