Reference
REST API
You can read and change the data of your Household through the Kosh API. The iPhone app uses the same routes.
- Base URL:
https://api.ourkosh.com - Paths: every route below starts with
/api/v1/. - Auth:
Authorization: Bearer <session token>from the sign-in below. - Bodies: JSON, except the file routes, which take
multipart/form-data. - Money: an integer in minor units with an ISO 4217 code. In replies, money is
{ "minor": 100000, "currency": "INR" }(1,000.00 rupees). - Dates:
YYYY-MM-DDin the Household time zone. Months:YYYY-MM. - Errors:
{ "error": { "code", "message", "field?" } }. See Errors.
Every route can return unauthenticated (401). Every route that needs a Household can also return no_household (403). The Errors column lists the other codes. ? marks an optional field. A write reply with no other status is 200.
Sign in
Sign-in uses the Better-Auth email code routes under /api/auth, not /api/v1.
POST /api/auth/email-otp/send-verification-otpwith{ "email", "type": "sign-in" }. Kosh emails a 6-digit code. Errors:rate_limited,email_not_sent.POST /api/auth/sign-in/email-otpwith{ "email", "otp" }. The session token is in theset-auth-tokenreply header.POST /api/auth/sign-outends the session.
Household and Members
GET /api/v1/me: Who is signed in. Works without a Household.- Request: none
- Reply:
email,member,household,pendingInvite,aiConsent:{ askServer, pdfStatement, categoryProposals }for the caller, ornullwithout a Household - Errors: none
DELETE /api/v1/me: Deletes the caller from Kosh. Works without a Household. See Delete me from Kosh.- Request:
scope:meorhousehold,confirm:DELETE - Reply:
deleted(meorhousehold),appStorePlanActive. The session ends. - Errors:
validation_failed(confirm),koshadhyaksha_must_hand_over,forbidden(householdby a Member),no_household,billing_provider_failed(nothing was deleted)
- Request:
PUT /api/v1/me/ai-consent: Turns one outside-model path on or off for the caller.- Request:
path:ask_server,pdf_statementorcategory_proposals;granted;textVersion(1–40) - Reply:
askServer,pdfStatement,categoryProposals - Errors:
validation_failed
- Request:
POST /api/v1/households: Creates the Household. The caller becomes Koshadhyaksha.- Request:
name(1–60),displayName?(1–40),baseCurrency?,locale?,timeZone?,fyStartMonth?(1–12) - Reply: 201 Household
- Errors:
already_in_household,validation_failed
- Request:
GET /api/v1/household: The caller's Household.- Request: none
- Reply:
id,name,baseCurrency,locale,timeZone,fyStartMonth,owner - Errors: none
POST /api/v1/household/koshadhyaksha: Gives the Koshadhyaksha role to another active Member. Koshadhyaksha only.- Request:
memberId - Reply: Household
- Errors:
forbidden,conflict(memberId),review_household
- Request:
PATCH /api/v1/household: Changes the Household settings. Any Member.- Request:
name?,baseCurrency?,locale?,timeZone?,fyStartMonth? - Reply: Household
- Errors:
validation_failed
- Request:
GET /api/v1/members: Every Member, removed ones too.- Request: none
- Reply: Member:
id,displayName,email,role,state,removedAt - Errors: none
PATCH /api/v1/members/me: Renames the caller.- Request:
displayName(1–40) - Reply: Member
- Errors:
validation_failed
- Request:
DELETE /api/v1/members/{id}: Removes a Member and revokes their MCP tokens. Koshadhyaksha only.- Request: none
- Reply: Member
- Errors:
forbidden,not_found,owner_cannot_leave,conflict
POST /api/v1/reassign: Gives Holdings and Plan Items of one Member to another. Koshadhyaksha only.- Request:
fromMemberId,toMemberId,holdingIds?,planItemIds? - Reply:
holdings,planItems(counts) - Errors:
forbidden,validation_failed
- Request:
GET /api/v1/invites: Pending and past invites. Koshadhyaksha only.- Request: none
- Reply: Invite:
id,email,status,invitedBy,createdAt,expiresAt - Errors:
forbidden
POST /api/v1/invites: Invites a person by email (valid 7 days). Koshadhyaksha only.- Request:
email - Reply: 201 Invite
- Errors:
forbidden,plan_required,already_in_household,conflict,validation_failed
- Request:
DELETE /api/v1/invites/{id}: Cancels a pending invite. Koshadhyaksha only.- Request: none
- Reply: Invite
- Errors:
forbidden,not_found,conflict
POST /api/v1/invites/accept: Joins the Household whose pending invite matches the caller's email.- Request:
displayName(1–40) - Reply: 201 Member
- Errors:
already_in_household,not_found,plan_required,validation_failed
- Request:
Accounts
GET /api/v1/accounts: Open Accounts with today's balance, by name.- Request: none
- Reply: Account:
id,name,kind,currency,liquidity,maskedNumber,member,typedBalance,balance,archivedAt - Errors: none
POST /api/v1/accounts: Creates an Account. Liquidity comes from the kind if left out.- Request:
name(1–60),kind(bank,card,wallet,loan),currency,memberId,liquidity?,maskedNumber?(4 characters),typedBalance?(minor,date) - Reply: 201 Account
- Errors:
validation_failed
- Request:
PATCH /api/v1/accounts/{id}: Changes an Account. Kind and currency stay fixed.- Request:
name?,memberId?,liquidity?,maskedNumber?,typedBalance? - Reply: Account
- Errors:
not_found,validation_failed
- Request:
DELETE /api/v1/accounts/{id}: Archives an Account. Its Entries stay.- Request: none
- Reply:
archived - Errors:
not_found
GET /api/v1/accounts/{id}/balance: The balance, its anchor, and any difference from a newer typed balance.- Request: none
- Reply:
balance,anchor(date,balance,source),differs - Errors:
not_found
Entries
GET /api/v1/entries: Entries by date.- Request: query
accountId?,from?,to? - Reply: Entry:
id,accountId,date,direction,amount,description,payeeKey(the payee words of the description;nullwhen it has none),categoryId,source,status,statementId,chequeNumber,chequeExpiresOn,inTransfer(true: one side of a Transfer, so its direction is fixed),transferWaiting(true: a Transfer that waits for its other side; neither spending nor income; never true withinTransfer),possibleDuplicates?(on an unconfirmed typed Entry: the ids of statement lines it may repeat) - Errors:
not_found,validation_failed
- Request: query
POST /api/v1/entries: Creates a typed Entry, "not on a statement".- Request:
accountId,date,direction(debit,credit),amountMinor,currency,description(up to 140),categoryId?,chequeNumber?(debit only, 1–12 digits) - Reply: 201 Entry. With no
categoryId, a remembered payee of the same payee and direction gives the Category. When one imported statement line already shows it: 200 with that line andmatched(statement), and nothing new is saved. When two or more lines could: 201 withpossibleDuplicates(their ids) - Errors:
currency_mismatch,not_found,validation_failed
- Request:
PATCH /api/v1/entries/{id}: Changes an Entry. A statement Entry changes only its Category and its Transfer mark. A new date on one side of a Transfer moves the other side too, and so does a new amount, when the other side is typed. On a Transfer of two amounts (rewards part), a new amount changes this side only. After a new date or amount, Kosh looks for the statement line as on create.- Request:
date?,direction?,amountMinor?,description?,categoryId?,chequeNumber?(debit only),transferWaiting?. NotaccountIdorcurrency.transferWaiting: truemarks the Entry as a Transfer: Kosh pairs it at once when its other side is in Kosh (the reply hasinTransfer: true), else it waits (transferWaiting: true); its Category is removed.transferWaiting: false, or acategoryId, ends the wait. NottransferWaiting: truewith acategoryId - Reply: Entry, or the statement line with
matched(statement) when one line now shows it;possibleDuplicates?;counterpart?(the other side of its Transfer, when the edit moved it);onlyThisSide?(true: the new amount is on this side only);alsoCategorised?(a new Category: Kosh remembers the payee, and this many other Entries of that payee and direction without a Category took it; only when above 0).categoryId: nullchanges this Entry only. - Errors:
conflict(a statement line: "A statement line is fixed. Only its Category can change."; a new amount when the other side is a statement line: "The other side of this Transfer is a statement line. Change the amount there by importing the statement."; a new direction on a Transfer side;transferWaiting: trueon a side of a Transfer),not_found,validation_failed
- Request:
DELETE /api/v1/entries/{id}: Deletes a typed Entry.- Request: none
- Reply:
deleted - Errors:
conflict,not_found
POST /api/v1/entries/{id}/keep: Keeps a typed Entry that a Statement did not list, as confirmed.- Request: none
- Reply: Entry
- Errors:
not_found
POST /api/v1/entries/{id}/discard: Deletes a typed Entry that a Statement did not list.- Request: none
- Reply:
deleted - Errors:
conflict,not_found
POST /api/v1/entries/{id}/link: Links a typed Entry to the statement line it repeats. The line takes its place in any Transfer, and the typed Entry is removed.- Request:
statementEntryId(same Account, direction, amount and currency; not one side of a Transfer) - Reply: the statement line, as an Entry
- Errors:
conflict("This statement line is already one side of a Transfer.", "This statement line is already linked to another Entry."),not_found,validation_failed
- Request:
Statements
POST /api/v1/statements/preview: Reads a statement file and shows what applying it would do. Writes nothing.- Request: multipart
accountId,file(CSV, OFX, QIF, Excel or PDF, up to 10 MB),password?,links? - Reply:
format,from,to(the period the file prints when it holds every row, else the first and last row dates),opening,closing,check,lines[](status:new,matches,duplicate;entryId,nearEntryId),duplicateOf({ statementId, importedOn }: the stored Statement of this Account with the same dates and closing balance, or the same end date and closing balance and the same lines (row count, money-out sum and money-in sum); without a closing balance, the same end date and the same lines;nullwhen none),unmatchedTyped - Errors:
validation_failed,not_found,currency_mismatch,statement_unbalanced,import_wrong_password,import_unreadable,import_unknown_format,import_extraction_invalid,import_too_large,import_extractor_unavailable,usage_limit,ai_consent_required(pdf_statement: a PDF that needs the model)
- Request: multipart
POST /api/v1/statements/apply: Adds new lines, confirms matched typed Entries, skips repeats, in one batch.- Request: the same multipart form; or JSON from a PDF preview:
accountId,format(pdf),from,to,openingMinor,closingMinor,lines[](1–500:date,direction,amountMinor,description),links? - Reply: 201
statementId,added,confirmed,duplicates,categorised(new lines that took the Category of a remembered payee),transferred(paired: Transfers made, a new line paired with its other side or with a waiting Transfer;waiting: new lines of a Transfer payee that wait for their other side),unmatchedTyped - Errors: the same as preview, and
statement_duplicate(409) whenduplicateOfis notnull: nothing is saved
- Request: the same multipart form; or JSON from a PDF preview:
links is a list of { "line", "entryId" }: the 0-based row of a near match and the typed Entry it confirms. In the multipart form it is a JSON string. See Statement import.
Payees
A remembered payee is a payee key, a direction and a Category. Kosh gives that Category to every Entry of the payee and direction that has no Category and is not one side of a Transfer. It never changes an Entry that has a Category. See Categories for Entries.
A Transfer payee is a payee key and a direction whose Entries are money moved between the Household's own Accounts. Kosh pairs each Entry of the payee without a Category with its other side: an Entry in another Account of the Household, the other direction, the same currency and amount, within 5 days, not yet in a Transfer. With two or more, the nearest date wins. If two are equally near, Kosh makes no pair. An Entry with no other side in Kosh waits for it (transferWaiting). A new Entry that is the other side of a waiting Transfer pairs with it, for any payee. A tie pairs nothing. See Transfers.
GET /api/v1/payees/pending: Entries without a Category, by payee.- Request: none
- Reply:
total(Entries without a Category, not Transfer sides and not waiting Transfers),ungrouped(those with no payee words),payees(every payee group that waits, before the limit of 50 ongroups; for "Showing 50 of 199 payees"),groups[](at most 50, largest first, then by key:payeeKey,direction,count,latestDate,sample: the newest description,ownName: true when the key holds the first and last name of an active Member, as words in any order or joined; a hint that the Entries may be Transfers),suggestUsesQuestion(true whensuggestcounts one server question; false when it counts one Category-proposal call),transferWaiting(Entries that wait for their other side: set, not to sort, so not intotal) - Errors: none
POST /api/v1/payees/suggest: The server's Category provider proposes a Category for each pending payee it can place. It sees the payee keys, their directions and the Category names only. Saves nothing.- Request:
{} - Reply:
suggestions[]:payeeKey,direction,categoryId(only pending payees, only the Household's Categories, only picks the provider is sure of). Counts one Category-proposal call: 200 a month for each Household, on every plan, apart from the monthly questions. Only when the server model stands in for TypeSafe (suggestUsesQuestionis true) does it count one server question instead. With nothing pending: an empty list and no count - Errors:
ai_consent_required(category_proposals),usage_limit,import_extractor_unavailable,validation_failed
- Request:
PUT /api/v1/payees: Remembers payees and gives each Category to the pending Entries of that payee and direction. A Transfer payee pairs its pending Entries instead.- Request:
items[](1–50, each payee and direction once):payeeKey(aspendinggives it),direction, and eithercategoryIdortransfer: true(exactly one of the two) - Reply:
items[]:id,payeeKey,direction,categoryId(null for a Transfer payee),transfer,applied(Entries that took the Category, or were paired),pairedandwaiting(for a Transfer payee: its Entries without a Category paired now, and those that wait for their other side; 0 for a Category payee) - Errors:
validation_failed
- Request:
GET /api/v1/payees: The remembered payees, by key.- Request: none
- Reply:
payees[]:id,payeeKey,direction,categoryId,transfer(false),count(Entries of this payee and direction whose Category iscategoryIdnow; 0 is valid);transferPayees[]:id,payeeKey,direction,categoryId(null),transfer(true),countandpaired(Entries of this payee and direction that are one side of a Transfer; 0 is valid),waiting(those that wait for their other side) - Errors: none
DELETE /api/v1/payees/{id}: Forgets a remembered payee. Its Entries keep their Category, and the Transfers a Transfer payee made stay.DELETE /api/v1/transfers/{id}undoes one pair.- Request: none
- Reply: 204
- Errors:
not_found
Transfers
GET /api/v1/transfers/suggested: Debit and credit pairs on two of your own Accounts, not yet confirmed. A waiting Transfer can be one side. Confirming the pair (POST /api/v1/transfers) ends the wait.- Request: none
- Reply:
debit,credit(Entries),kind(same_currency,cross_currency) - Errors: none
POST /api/v1/transfers: Confirms a pair as a Transfer.- Request:
debitEntryId,creditEntryId - Reply: 201 Transfer:
id,debitEntryId,creditEntryId,kind - Errors:
conflict,not_found,validation_failed
- Request:
POST /api/v1/transfers/pay: Pays one Account from another: a debit, a credit and the Transfer. A side that an imported statement line already shows is that line.- Request:
fromAccountId,toAccountId,date,amountMinor(what the receiving Account got),fromAmountMinor?(what the paying Account paid, when rewards paid part),description? - Reply: 201
transfer,debit,credit(each withmatched?orpossibleDuplicates?),fromStatement(debit,credit: the sides that are statement lines) - Errors:
currency_mismatch,not_found,validation_failed
- Request:
DELETE /api/v1/transfers/{id}: Removes a Transfer. Both Entries count as spending or income again.- Request: none
- Reply:
deleted - Errors:
not_found
Money
GET /api/v1/money: Accounts and Holdings by Liquidity, in their own currency and the Base currency.- Request: none
- Reply:
baseCurrency,rateDate,netWorth,spendable,groups[](liquidity,total,lines),rates - Errors: none
GET /api/v1/money/spending: Money out and in for a month in the Base currency, without confirmed Transfers.- Request: query
period(YYYY-MM) - Reply:
period,baseCurrency,total,inflow,byCategory,unconverted,rateDate - Errors:
validation_failed
- Request: query
Categories
GET /api/v1/categories: The Household's Categories.- Request: none
- Reply: Category:
id,name,nature,holdingCount - Errors: none
POST /api/v1/categories: Creates a Category.- Request:
name(1–40),nature(asset,liability,tracked) - Reply: 201 Category
- Errors:
conflict,validation_failed
- Request:
PATCH /api/v1/categories/{id}: Renames a Category or changes its kind.- Request:
name?,nature? - Reply: Category
- Errors:
conflict,not_found,validation_failed
- Request:
DELETE /api/v1/categories/{id}: Removes a Category. Refused while a Holding uses it.- Request: none
- Reply: removed
- Errors:
conflict,not_found
GET /api/v1/asset-classes: The Household's Asset classes.- Request: none
- Reply: AssetClass:
id,name,holdingCount - Errors: none
POST /api/v1/asset-classes: Creates an Asset class.- Request:
name(1–40) - Reply: 201 AssetClass
- Errors:
conflict,validation_failed
- Request:
DELETE /api/v1/asset-classes/{id}: Removes an Asset class. Refused while a Holding uses it.- Request: none
- Reply: removed
- Errors:
conflict,not_found
Holdings
GET /api/v1/holdings: Active Holdings with their newest Snapshot.- Request: none
- Reply: Holding:
id,name,kind,currency,liquidity,fundHouse,isin,folioLabel,category,assetClass,tags,goalId,member,latestSnapshot,unitsMilli,unitsOnDate,nav - Errors: none
POST /api/v1/holdings: Creates a Holding. Liquidity comes from the kind if left out.- Request:
name(1–80),memberId,kind(fund,stock,fd,ppf,nps,epf,property,insurance,other),currency,liquidity?,fundHouse?,isin?,categoryId?,assetClassId?,tags?(up to 10),unitsMilli?,unitsOnDate? - Reply: 201 Holding
- Errors:
not_found,validation_failed
- Request:
PATCH /api/v1/holdings/{id}: Changes a Holding. Currency stays fixed.- Request: any Holding field except
currency - Reply: Holding
- Errors:
not_found,validation_failed
- Request: any Holding field except
DELETE /api/v1/holdings/{id}: Archives a Holding. Its Snapshots stay.- Request: none
- Reply: Holding
- Errors:
not_found
GET /api/v1/holdings/{id}/snapshots: Snapshots of one Holding, oldest first.- Request: query
from?,to? - Reply: Snapshot:
holdingId,onDate,value,source - Errors:
not_found,validation_failed
- Request: query
PUT /api/v1/holdings/{id}/snapshots/{date}: Sets the value on one date. One value per date.- Request:
valueMinor(0 or more) - Reply: Snapshot
- Errors:
not_found,validation_failed
- Request:
DELETE /api/v1/holdings/{id}/snapshots/{date}: Deletes the Snapshot of one date.- Request: none
- Reply:
deleted - Errors:
not_found,validation_failed
POST /api/v1/navs/refresh: Checks AMFI for new NAVs now, at most once a minute.- Request: none
- Reply:
checkedAt,okAt,stale,failure - Errors: none
Imports (CAS)
POST /api/v1/imports: Reads a CAS and returns a preview, open for 30 minutes. Writes no Holding.- Request: multipart
type(cas),file(up to 10 MB and 60 pages),password?,memberId? - Reply: 201
id,type,statementDate,expiresAt,items[](action:create,update;holding,snapshot,xirrBp),xirrByFundHouse,notices - Errors:
validation_failed,import_too_large,import_wrong_password,import_unreadable,import_unknown_format
- Request: multipart
GET /api/v1/imports/{id}: The open preview.- Request: none
- Reply: the preview
- Errors:
not_found
POST /api/v1/imports/{id}/apply: Writes the Holdings and Snapshots of the preview.- Request: none
- Reply:
holdingsCreated,holdingsUpdated,snapshotsUpserted,transactionsAdded - Errors:
not_found
POST /api/v1/imports/{id}/discard: Closes the preview. Nothing is written.- Request: none
- Reply: 204
- Errors:
not_found
Plan Items
GET /api/v1/plan-items: Every Plan Item.- Request: query
state?(active,paused,stopped) - Reply: PlanItem:
id,name,amount,direction,accountId,member,schedule,startDate,endDate,linkedHoldingId,goalId,state,notification,mutedByMe - Errors:
validation_failed
- Request: query
POST /api/v1/plan-items: Creates a Plan Item and its Occurrences.- Request:
name(1–80),amountMinor,currency,direction(in,out),memberId,schedule,accountId?,startDate?,endDate?,linkedHoldingId? - Reply: 201
planItem,occurrencesCreated - Errors:
currency_mismatch,not_found,validation_failed
- Request:
GET /api/v1/plan-items/{id}: One Plan Item.- Request: none
- Reply: PlanItem
- Errors:
not_found
PATCH /api/v1/plan-items/{id}: Changes a Plan Item. Future pending Occurrences are made again.- Request: any Plan Item field
- Reply: PlanItem
- Errors:
currency_mismatch,not_found,validation_failed
POST /api/v1/plan-items/{id}/pause: Pauses. Future pending Occurrences go.- Request: none
- Reply: PlanItem
- Errors:
conflict,not_found
POST /api/v1/plan-items/{id}/resume: Resumes a paused Plan Item.- Request: none
- Reply: PlanItem
- Errors:
conflict,not_found
POST /api/v1/plan-items/{id}/stop: Stops for good. Future pending Occurrences go.- Request: none
- Reply: PlanItem
- Errors:
conflict,not_found
PUT /api/v1/plan-items/{id}/notification: Sets the notification for every phone.- Request:
enabled,leadDays(0–30) - Reply: PlanItem
- Errors:
not_found,validation_failed
- Request:
PUT /api/v1/plan-items/{id}/mute: Mutes the Plan Item on the caller's phone only.- Request: none
- Reply: PlanItem
- Errors:
not_found
DELETE /api/v1/plan-items/{id}/mute: Unmutes it on the caller's phone.- Request: none
- Reply: PlanItem
- Errors:
not_found
schedule is one of: { "kind": "monthly", "dayOfMonth", "intervalMonths?", "anchorDate?" } (an interval above 1 needs anchorDate), { "kind": "yearly", "dayOfMonth", "month" }, { "kind": "once", "date" }, { "kind": "weekly", "weekday" (0 = Monday … 6 = Sunday), "intervalWeeks", "anchorDate" }, { "kind": "dates", "dates" (1–60) }.
Occurrences and Today
GET /api/v1/occurrences: Occurrences, with the status worked out for today.- Request: query
from?,to?,status?(pending,done,overdue) - Reply: Occurrence:
id,planItem,member,dueDate,amount,status,doneAt,doneBy - Errors:
validation_failed
- Request: query
POST /api/v1/occurrences/{id}/done: Marks done and records the Member.- Request: none
- Reply: Occurrence
- Errors:
not_found
POST /api/v1/occurrences/{id}/undo: Undoes a done mark.- Request: none
- Reply: Occurrence
- Errors:
not_found
GET /api/v1/today: The Today data for the app and the widget.- Request: none
- Reply:
asOf,next,overdue,dueToday,month(done,total) - Errors: none
Goals
GET /api/v1/goals: Goals with links and progress.- Request: none
- Reply: Goal:
id,name,target,targetDate,member,holdingIds,planItemIds,progress(saved,remaining,savedBp,monthsLeft) - Errors: none
POST /api/v1/goals: Creates a Goal. The target date must be after today.- Request:
name(1–60),targetMinor,currency,targetDate,memberId? - Reply: 201 Goal
- Errors:
not_found,validation_failed
- Request:
PATCH /api/v1/goals/{id}: Changes a Goal. Currency stays fixed.- Request:
name?,targetMinor?,targetDate?,memberId? - Reply: Goal
- Errors:
not_found,validation_failed
- Request:
PUT /api/v1/goals/{id}/links: Replaces the linked Holdings and Plan Items.- Request:
holdingIds(up to 500),planItemIds(up to 500) - Reply: Goal
- Errors:
not_found,validation_failed
- Request:
DELETE /api/v1/goals/{id}: Deletes a Goal. Its Holdings and Plan Items stay.- Request: none
- Reply:
deleted - Errors:
not_found
Rules
GET /api/v1/rules: The Household's Rules.- Request: none
- Reply: Rule:
id,name,measure,scope,op,threshold,enabled - Errors: none
POST /api/v1/rules: Creates a Rule.- Request:
name(1–60),measure,scope(kind,id?),op(above,below),threshold({ "kind": "bp", "value" }or{ "kind": "money", "minor", "currency" }) - Reply: 201 Rule
- Errors:
not_found,validation_failed
- Request:
PATCH /api/v1/rules/{id}: Changes a Rule, or turns it off.- Request: any Rule field,
enabled? - Reply: Rule
- Errors:
not_found,validation_failed
- Request: any Rule field,
DELETE /api/v1/rules/{id}: Deletes a Rule.- Request: none
- Reply:
deleted - Errors:
not_found
GET /api/v1/rules/status: Checks every enabled Rule against a month. The text states the fact only.- Request: query
period(YYYY-MM) - Reply:
ruleId,label,broken,textfor each subject - Errors:
not_found,validation_failed
- Request: query
See Rules for the measures and scopes.
Ask
GET /api/v1/ask/catalog: The text a model reads to plan a question.- Request: none
- Reply:
summary,members[](id,firstName): the active Members - Errors: none
POST /api/v1/ask: Asks the server model. Counts one server question first.- Request:
question(1–300 characters),memberId?: an active Member of this Household. It filters every query to that Member and wins over the model's plan. - Reply:
outOfScope,parts[](type,text,fact),text,steps,memberId: the Member the answer is filtered to, ornullfor the whole Household - Errors:
ai_consent_required(ask_server),usage_limit,import_extractor_unavailable,validation_failed(memberIdof no active Member of this Household)
- Request:
POST /api/v1/ask/run: Runs a plan from the caller's own model. Not counted.- Request:
plan:{ "queries" (up to 4), "outOfScope" }. Each query may havememberId. - Reply: the same as
POST /api/v1/ask - Errors:
validation_failed(fieldplan.queries.N.memberIdfor a Member that is not active in this Household)
- Request:
See Ask for the query types and About one Member.
MCP tokens
GET /api/v1/mcp-tokens: The caller's tokens. Never the secret.- Request: none
- Reply:
id,name,tokenPrefix,createdAt,expiresAt,lastUsedAt,revokedAt - Errors: none
POST /api/v1/mcp-tokens: Makes a token. The secret is in this reply only.- Request:
name(1–40),expiresInDays(1–90) - Reply: 201 the token and
secret - Errors:
plan_required,validation_failed
- Request:
DELETE /api/v1/mcp-tokens/{id}: Revokes a token: your own, or any as Koshadhyaksha.- Request: none
- Reply: the token
- Errors:
forbidden,not_found
App data
GET /api/v1/sync: A full refresh of the phone's local copy. Checks AMFI first, at most every 15 minutes.- Request: none
- Reply:
serverTime,household,members,planItems,occurrences,holdings,navStatus - Errors: none
POST /api/v1/events: Sends one product count from the app to OpenPanel. Works without a Household. Fixed names only.- Request:
name,properties?(short values) - Reply: 202, no body
- Errors:
validation_failed
- Request:
Plan and billing
Kosh is free during private testing, and checkout is not open. These routes report the plan; the payment routes take no payments now.
India pays through Dodo Payments in INR, and the INR price includes GST. Every other country pays through Paddle in USD, and Paddle adds tax at checkout. A Household that has or had a subscription keeps its provider and its currency. The two billing GET replies are never cached (Cache-Control: private, no-store, Vary: CF-IPCountry).
GET /api/v1/billing/terms: What a visitor from this country pays. No sign-in.- Request: none
- Reply:
currency(INRorUSD),taxInclusive,prices(soloandhousehold, eachmonthandyear, as{ minor, available }),checkoutOpen,paddle. No ids. availableisfalsewhen the price is under the provider's minimum charge. Dodo takes no subscription under 1 USD, so it applies when the INR price is under 1 USD at the latest ECB rate.paddleis{ environment, clientToken }for Paddle.js (sandboxorproduction). The client-side token is public by design. The value is null while Paddle is not configured or has no token.- Errors: none
GET /api/v1/billing: The Household's plan, this month's use and the plans. Any Member.- Request: none
- Reply:
plan(free,soloorhousehold),name,interval(month,yearor null),source(subscription,managed,freeorbilling_off),status,currentPeriodEnd,cancelAtPeriodEnd,testMode,canBuy,currency,limits,usage(month,questionsandpdfPages, eachusedandallowed),plans(id,name,limits,prices.monthandprices.yearas{ minor, currency, available, change }, minor units incurrency;availableas in/billing/terms, alwaystrueon Free;changeis when a change to that plan and interval would start:now,period_endorunavailable, and null for Free, the current choice, no subscription, or while a change waits),managed,provider,taxInclusive,paymentFailed,planEndsAt,canResume,changesTo,paidThrough,doublePaid changesTois{ plan, interval, on }while a downgrade waits for the end of the paid period, else null.onisYYYY-MM-DDin the Household time zone. Untilon,planandintervalstay the larger plan.- While a change waits for its payment,
changesTois{ plan, interval, on: null, waitingForPayment: true }, andplanandintervalstay the current plan. The change applies when the provider confirms it. If the payment fails,changesTois null again and the plan does not change. paidThroughsays who takes the money for the plan in force:apple(iPhone in-app purchase),paddleordodo(web). It is null on Free, on a managed plan and while payments are off.sourcestayssubscriptionfor all three.doublePaidistruewhen two sources pay at once (the web and the App Store). The higher plan holds. Stop one of them.- Errors: none
POST /api/v1/billing/checkout: Not open during private testing. Koshadhyaksha only.- Request:
plan(soloorhousehold),interval(monthoryear) - Reply:
url,plan,interval,currency,minor(the price thatGET /api/v1/billingshows) - Dodo gives its hosted page. Paddle gives its checkout URL for this payment:
https://ourkosh.com/checkout?_ptxn=<id>. That page loads Paddle.js. After payment the buyer returns to the Household screen of the web app. - A plan and interval with
available: falsegivesconflictbefore any provider call, for example "Kosh Solo monthly is not offered here. Choose the yearly plan." - While the plan is paid through the App Store, the reply is
paid_elsewhere(409). - Errors:
forbidden,conflict,paid_elsewhere,plan_managed,billing_provider_failed,billing_unavailable,validation_failed
- Request:
POST /api/v1/billing/change: Changes the plan or the interval at the Household's provider. Koshadhyaksha only.- Request:
plan(soloorhousehold),interval(monthoryear) - Reply:
plan,interval,upgrade,effective(now,period_endoron_payment),on(YYYY-MM-DDor null). - The plan and the interval decide
effective, never the price.upgradeistruefor a higher plan.Change effectiveSame interval, higher plan (Solo to Household) nowSame interval, lower plan (Household to Solo) period_endMonthly to yearly, any plan nowYearly to monthly Higher plan: now. Same or lower plan:period_endwith Dodo Payments;plan_change_unavailablewith Paddle now: the new plan starts now. The provider charges the new price and credits the unused part of the paid period.onis null.period_end: the Household keeps the paid plan untilon(the day the new plan starts). There is no refund and no extra charge.on_payment: a change that starts now but waits for its payment. Dodo Payments applies it only when the charge clears (in India, up to 2 days). The current plan stays until then, andGET /api/v1/billingshows the change inchangesTo. A second change while one waits givesconflict.plan_change_unavailable(409): Paddle cannot set a change for a later date, and a change now would end the paid year. The message gives the date: "A yearly plan changes to monthly only at its end. Cancel the plan; it stays active until 2027-01-15. Then choose the monthly plan." Kosh makes no provider call.GET /api/v1/billinggives the same answer before the tap, inplans[].prices.month.changeandplans[].prices.year.change.- While a downgrade waits, a second change gives
conflict. - Errors:
forbidden,not_found,conflict,paid_elsewhere,plan_change_unavailable,plan_managed,billing_provider_failed,billing_unavailable,validation_failed
- Request:
POST /api/v1/billing/portal: Not open during private testing. Koshadhyaksha only.- Request: none
- Reply:
url - Errors:
forbidden,not_found,paid_elsewhere,plan_managed,billing_provider_failed,billing_unavailable
POST /api/v1/billing/cancel: The plan stays until the paid period ends. Koshadhyaksha only.- Request: none
- Reply:
ok - Errors:
forbidden,not_found,paid_elsewhere,plan_managed,billing_provider_failed,billing_unavailable
POST /api/v1/billing/resume: Undoes a scheduled cancel before the period ends. Paddle only. Koshadhyaksha only.- Request: none
- Reply:
ok - Errors:
forbidden,not_found,conflict,paid_elsewhere,resume_unavailable,plan_managed,billing_provider_failed,billing_unavailable
GET /api/v1/billing/apple/token: The Household's account token for iPhone purchases. Any Member.- Request: none
- Reply:
appAccountToken: a random UUID. The iPhone sets it on each App Store purchase, so the purchase names the Household. The first call by the Koshadhyaksha makes it, and it never changes. A Member getsnulluntil it exists. - Errors:
billing_unavailable
POST /api/v1/billing/apple/link: Ties an App Store purchase to the Household. The iPhone sends it after a purchase, a restore or an update.- Request:
signedTransaction: the purchase as the App Store signed it (StoreKit 2jwsRepresentation). - Reply: the same as
GET /api/v1/billing. - Kosh checks that Apple signed the purchase (the chain ends at Apple Root CA - G3), that it is a Kosh plan, and that it carries this Household's token.
- A first purchase: Koshadhyaksha only. While a Paddle or Dodo plan pays, the reply is
paid_elsewhereand nothing is linked. - A restore or a renewal of a purchase the Household has: any Member.
- Errors:
forbidden,paid_elsewhere,apple_other_household,validation_failed,billing_unavailable
- Request:
POST /webhooks/apple: App Store Server Notifications, version 2. No sign-in.- Request:
signedPayload, signed by Apple. - Reply:
applied. A bad signature givesunauthenticated(401). Each notification applies once (by itsnotificationUUID).
- Request: