public-logo

36Blocks Docs

Welcome to 36Blocks
Getting Started
Widgets
Sessions & Tokens
Companies & Roles
Security & Access
Webhooks
OAuth 2.0 Module
API Reference
Built with DocStar
  1. /
  2. Companies & Roles
  3. /
  4. Companies

Companies

A company is an organization that users belong to. A user can be a member of several companies and always has one current company. Their role, permissions and the data they see come from it.

Get the list of companies a user belongs to from the c_companies array returned by GET /c/getDetails.

#

Switching companies

Call POST /c/switchCompany with the company's id as company_ref_id to switch the user's current company. The same proxy_auth_token stays valid after switching. The user must be a member of the company you switch to.

If you're using the JWT model, the switchCompany response also includes a fresh JWT for the new current company. See Session & Authorization.

#

Creating a company

Call POST /c/createCompany to create a new company. The user becomes its creator, and needs the create_c_company permission. The user is not automatically switched into the new company after creating it.

#

Leaving a company

Call POST /c/inviteAction/leave with the company_id to leave a company. A user can't leave their current company, and the last remaining creator can't leave a company that still has other members. The Profile widget lets users do this from the UI.

#

Logging out

Call DELETE /c/logout to end the user's session. It also revokes their refresh tokens.

#

In the widgets

The Organization, Management and Profile widgets cover these actions in a ready-made UI. See Widgets.

Was this helpful?
Built with DocStar
On this page
Switching companies
Creating a company
Leaving a company
Logging out
In the widgets
Was this helpful?