PushizoDocs
Users & segments

Companies (B2B accounts)

In B2B products, people belong to a company (an account or workspace): a billing reminder goes to the company's admin and a feature announcement to all of its users. In Pushizo a company is a separate object…

In B2B products, people belong to a company (an account or workspace): a billing reminder goes to the company's admin and a feature announcement to all of its users. In Pushizo a company is a separate object; users are linked to one or more companies with a role, and company properties are used in segments and templates. Available on all plans (ADR-0090).

Data model

FieldDescription
external_idThe company's ID in your CRM or account system. Unique within the app; cannot contain spaces (at most 128 characters).
nameDisplay name (optional, at most 200 characters).
domainDomain (e.g. example.com); lowercased, https:// and a trailing / are removed.
propertiesFree-form JSON properties (e.g. plan, seats, mrr); at most 5 levels and 16 KB. Updates are merge-patched and null removes a key.
Membership roleThe user's role in the company: lowercase letters, digits, _ and - (e.g. admin, member, billing); member when omitted.

A user can belong to several companies. The user's current company is the one linked (or whose membership was updated) most recently; the company variable in templates is this company.

API

Dashboard: Audience → Companies (create and edit companies, add and remove users) and the Companies card on the user profile. The public API endpoints use the users:read (read) and users:write (write) scopes:

EndpointDescription
GET /v1/apps/{app_id}/companiesList (q, external_id, domain, limit, cursor), newest first.
POST /v1/apps/{app_id}/companiesCreate or update by external_id.
POST /v1/apps/{app_id}/companies/batchBulk create or update (at most 1000 per request).
GET, PATCH, DELETE /v1/apps/{app_id}/companies/{company_id}Get, update, delete (memberships are removed, users are kept).
GET /v1/apps/{app_id}/companies/{company_id}/membersUsers of the company (role filter).
PUT, DELETE /v1/apps/{app_id}/companies/{company_id}/members/{user_id}Link a user / change the role, remove.
POST /v1/apps/{app_id}/companies/{company_id}/members/batchAdd users in bulk (user_id or the user's external_id).
GET /v1/apps/{app_id}/users/{user_id}/companiesA user's companies; the users/by/{label}/{value}/companies form is also available.
curl -X POST https://api.pushizo.com/v1/apps/$APP_ID/companies/batch \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{"companies":[{"external_id":"acme-001","name":"Acme Inc.","domain":"acme.com","properties":{"plan":"enterprise","seats":120}}]}'

curl -X POST https://api.pushizo.com/v1/apps/$APP_ID/companies/$COMPANY_ID/members/batch \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{"members":[{"external_id":"ayse","role":"admin"},{"external_id":"mehmet","role":"billing"}]}'

In bulk member adds, users that are not found do not fail the request; they are returned in request order in the not_found list of the response.

Node SDK

const acme = await hs.companies.upsert({ external_id: 'acme-001', name: 'Acme Inc.', properties: { plan: 'enterprise' } });
await hs.companies.batchMembers(acme.id, { members: [{ external_id: 'ayse', role: 'admin' }] });
await hs.companies.setMember(acme.id, 'usr_01H...', { role: 'billing' });
const { data } = await hs.companies.forUserBy('external_id', 'ayse');

Segment conditions

The field has the form company.<name>. The reserved names are id, external_id, name, domain and role; any other name is a company property (company.plan → properties.plan).

ConditionMeaning
company.plan eq enterpriseUsers with at least one company on the enterprise plan.
company.seats gte 50Numeric property comparison (non-numeric values do not match).
company.role in [admin, billing]Users who have one of these roles in any of their companies.
company.domain neq competitor.comUsers none of whose companies has this domain (users without a company included).
company.id exists / not_existsUsers linked / not linked to any company.

Negative operators (neq, not_in, not_exists) mean "none of the user's companies matches". Each condition is evaluated on its own: when company.plan eq enterprise and company.role eq admin are combined, the two conditions may be satisfied by different companies.

Personalization in templates

company is the user's current company; companies holds all of their companies (at most 10, most recently linked first). For a user without a company, company is empty; use the default filter for fallback text.

Hi {{ user.tags.first_name }}, your {{ company.name | default: "team" }} account has
{{ company.properties.seats }} seats. Your role: {{ company.role }}.
{% for c in companies %}{{ c.name }} ({{ c.role }}) {% endfor %}

The variables are the same when rendering push, email, SMS and the other channels. The template preview uses a sample company (Acme, role admin).

SQL views

In SQL segments (Growth and above) the companies and company_members views can be read; see the SQL query and SQL segment guide for details.

Privacy and data lifecycle

  • When a user is deleted (KVKK/GDPR erasure), all of the user's company memberships are deleted; the company record is kept because it does not belong to the user.
  • The user data export (/export) includes the derived.companies list with the user's companies and roles.
  • When users are merged, memberships move to the target user; if the target is already in the same company, the target's role is kept.
  • When a company is deleted, its memberships are deleted and users are kept. "Clear data" also deletes companies and memberships.

Client SDKs

The web and mobile SDKs have no setCompany-style method. Company properties are shared across users, and a write from the client (even with identity verification) does not prove that the user belongs to that company; a user could add themselves to another company and receive that company's messages and properties. Write companies and memberships from your server (public API, Node SDK, bulk import or Reverse ETL).

On this page