onboarding

Create Company

Create a company with its books — this is the one to use.

There are two create_company operations. This one collects everything a company needs to be booked in: chart of accounts, fiscal year, opening balances, VAT setup, optional integrations and payroll — and grants the creator owner. Callable by an administrator, an owner of any company, or a user who is a member of none.

The other, companies_create_company (POST /companies/), is admin-only and writes the tenant row and nothing else — no chart, no fiscal year, no opening balances, no membership. A company created that way cannot be booked in and nobody can see it. Reach for it only when an administrator will populate the company by other means.

The sole write path of onboarding. Persists company + integrations + accounting (settings, VAT, chart, balances, opening entries), posts the opening entries to the GL, grants the creator self-membership, and consumes the caller's resumable draft — all in one db.tx(), so any failure rolls everything back (keeping the draft). Runs under the SystemPrincipal elevation (module docstring); user.id is passed explicitly for provenance/membership/draft consumption. Rate-limited per user (10/min — one legitimate create per run); non-admin creators re-check creation-quota inside the transaction (advisory lock — module docstring TOCTOU note). 409 if the CREATOR already has a company by that name (ConflictError → global handler; scoped per creator, so it discloses nothing about other tenants); 422 if the collected data cannot be persisted (e.g. unbalanced opening entries, or opening entries the opening-entries preview refuses), the caller gained a membership since the gate (concurrent create), or a non-admin sends integrations.

An API-key caller may not send opening_entries (422 forbidden.openingEntriesFromApiKey). Keep the prior year's closing sheet in balance_snapshot and the first year to book in target_fiscal_year, leave opening_entries out, then call generate_opening_entries and post_opening_entries — Zeno builds the opening from the balance sheet.

post/onboarding/companies

Request

  • Base URL: https://app.zeno-works.ch (the document declares no server; this is the origin it was published from)
  • URL: https://app.zeno-works.ch/onboarding/companies
  • Auth: none declared

Query parameters

on_behalf_of_user_idstring nullable

Headers

authorizationstring nullable

Cookies

access_tokenstring nullable

Request body

target_fiscal_yearinteger nullable

Response

Successful Response

company_idstring required

Changes

No recorded changes to this operation across all 1 revision of this API.