SupportDashboard
Getting StartedAPI ReferenceRoadmapBlog
Getting StartedAPI ReferenceRoadmapBlog
    • Resources
    • Authentication
    • Pagination
    • Rate limiting
  • API Keys
    • GETList api keys
    • GETGet api key
    • POSTCreate api key
    • PUTUpdate api key
    • DELDelete api key
  • Environments
    • POSTCreate environment
    • PUTUpdate environment
    • DELDelete environment
  • Plans
    • The Plan object
    • GETList plans
    • GETGet plan
    • POSTCreate plan
    • PUTUpdate plan
    • DELDelete plan
    • PUTUpdate audience
    • DELDelete audience
  • Companies
    • The Company object
    • GETList companies
    • POSTUpsert company
    • GETLookup company
    • DELDelete company
    • POSTDelete company by keys
    • GETList company memberships
    • POSTGet or create company membership
    • DELDelete company membership
    • POSTUpsert company trait
  • Users
    • The User object
    • GETList users
    • GETLookup user
    • POSTUpsert user
    • DELDelete user
    • POSTDelete user by keys
    • POSTUpsert user trait
  • Events
    • The Event object
    • GETList events
    • POSTCreate event
    • POSTCreate event batch
    • GETGet event
  • Features
    • The Feature object
    • GETList features
    • GETGet feature
    • POSTCreate feature
    • PUTUpdate feature
    • DELDelete feature
  • Flags
    • The Flag object
    • GETList flags
    • GETGet flag
    • POSTCreate flag
    • PUTUpdate flag
    • DELDelete flag
    • PUTUpdate flag rules
    • POSTCheck flag
    • POSTCheck flags
  • Entitlements
    • GETList company overrides
    • GETGet company override
    • POSTCreate company override
    • PUTUpdate company override
    • DELDelete company override
    • GETList plan entitlements
    • GETGet plan entitlement
    • POSTCreate plan entitlement
    • PUTUpdate plan entitlement
    • DELDelete plan entitlement
  • Feature Usage
    • GETList feature usage
    • GETGet feature usage by company
LogoLogo
SupportDashboard
Companies

POST
https://api.schematichq.com/company-traits
POST
/company-traits
1import { SchematicClient } from "@schematichq/schematic-typescript-node";
2
3const client = new SchematicClient({ apiKey: "YOUR_API_KEY" });
4await client.companies.upsertCompanyTrait({
5 keys: {
6 "key": "value"
7 },
8 trait: "trait"
9});
Try it
1{
2 "data": {
3 "add_ons": [
4 {
5 "id": "string",
6 "name": "string",
7 "added_on": "2024-01-15T09:30:00Z",
8 "billing_product_external_id": "string",
9 "billing_product_id": "string",
10 "description": "string",
11 "image_url": "string",
12 "plan_period": "string",
13 "plan_price": 1
14 }
15 ],
16 "billing_subscriptions": [
17 {
18 "cancel_at_period_end": true,
19 "created_at": "2024-01-15T09:30:00Z",
20 "currency": "string",
21 "customer_external_id": "string",
22 "discounts": [
23 {
24 "coupon_id": "string",
25 "coupon_name": "string",
26 "discount_external_id": "string",
27 "duration": "string",
28 "is_active": true,
29 "started_at": "2024-01-15T09:30:00Z",
30 "subscription_external_id": "string",
31 "amount_off": 1,
32 "currency": "string",
33 "customer_facing_code": "string",
34 "duration_in_months": 1,
35 "ended_at": "2024-01-15T09:30:00Z",
36 "percent_off": 1.1,
37 "promo_code_external_id": "string"
38 }
39 ],
40 "id": "string",
41 "interval": "string",
42 "period_end": 1,
43 "period_start": 1,
44 "products": [
45 {
46 "billing_scheme": "string",
47 "created_at": "2024-01-15T09:30:00Z",
48 "currency": "string",
49 "environment_id": "string",
50 "external_id": "string",
51 "id": "string",
52 "interval": "string",
53 "name": "string",
54 "package_size": 1,
55 "price": 1,
56 "price_external_id": "string",
57 "price_id": "string",
58 "price_tier": [
59 {
60 "flat_amount": 1,
61 "per_unit_price": 1,
62 "per_unit_price_decimal": "string",
63 "up_to": 1
64 }
65 ],
66 "quantity": 1.1,
67 "subscription_id": "string",
68 "updated_at": "2024-01-15T09:30:00Z",
69 "usage_type": "string",
70 "billing_threshold": 1,
71 "meter_id": "string",
72 "price_decimal": "string",
73 "subscription_item_external_id": "string"
74 }
75 ],
76 "status": "string",
77 "subscription_external_id": "string",
78 "total_price": 1,
79 "cancel_at": 1,
80 "company_id": "string",
81 "default_payment_method_id": "string",
82 "expired_at": "2024-01-15T09:30:00Z",
83 "latest_invoice": {
84 "amount_due": 1,
85 "amount_paid": 1,
86 "amount_remaining": 1,
87 "collection_method": "string",
88 "created_at": "2024-01-15T09:30:00Z",
89 "currency": "string",
90 "customer_external_id": "string",
91 "environment_id": "string",
92 "id": "string",
93 "subtotal": 1,
94 "updated_at": "2024-01-15T09:30:00Z",
95 "company_id": "string",
96 "due_date": "2024-01-15T09:30:00Z",
97 "external_id": "string",
98 "payment_method_external_id": "string",
99 "subscription_external_id": "string",
100 "url": "string"
101 },
102 "metadata": {},
103 "payment_method": {
104 "created_at": "2024-01-15T09:30:00Z",
105 "customer_external_id": "string",
106 "environment_id": "string",
107 "external_id": "string",
108 "id": "string",
109 "payment_method_type": "string",
110 "updated_at": "2024-01-15T09:30:00Z",
111 "account_last4": "string",
112 "account_name": "string",
113 "bank_name": "string",
114 "billing_email": "string",
115 "billing_name": "string",
116 "card_brand": "string",
117 "card_exp_month": 1,
118 "card_exp_year": 1,
119 "card_last4": "string",
120 "company_id": "string"
121 },
122 "trial_end": 1,
123 "trial_end_setting": "string"
124 }
125 ],
126 "created_at": "2024-01-15T09:30:00Z",
127 "entity_traits": [
128 {
129 "created_at": "2024-01-15T09:30:00Z",
130 "definition_id": "string",
131 "environment_id": "string",
132 "id": "string",
133 "updated_at": "2024-01-15T09:30:00Z",
134 "value": "string",
135 "definition": {
136 "created_at": "2024-01-15T09:30:00Z",
137 "display_name": "string",
138 "entity_type": "string",
139 "hierarchy": [
140 "string"
141 ],
142 "id": "string",
143 "trait_type": "string",
144 "updated_at": "2024-01-15T09:30:00Z"
145 }
146 }
147 ],
148 "environment_id": "string",
149 "id": "string",
150 "keys": [
151 {
152 "created_at": "2024-01-15T09:30:00Z",
153 "definition_id": "string",
154 "entity_id": "string",
155 "entity_type": "string",
156 "environment_id": "string",
157 "id": "string",
158 "key": "string",
159 "updated_at": "2024-01-15T09:30:00Z",
160 "value": "string",
161 "definition": {
162 "created_at": "2024-01-15T09:30:00Z",
163 "entity_type": "string",
164 "id": "string",
165 "key": "string",
166 "updated_at": "2024-01-15T09:30:00Z"
167 }
168 }
169 ],
170 "metrics": [
171 {
172 "account_id": "string",
173 "captured_at_max": "2024-01-15T09:30:00Z",
174 "captured_at_min": "2024-01-15T09:30:00Z",
175 "company_id": "string",
176 "created_at": "2024-01-15T09:30:00Z",
177 "environment_id": "string",
178 "event_subtype": "string",
179 "month_reset": "string",
180 "period": "string",
181 "value": 1,
182 "valid_until": "2024-01-15T09:30:00Z"
183 }
184 ],
185 "name": "string",
186 "payment_methods": [
187 {
188 "created_at": "2024-01-15T09:30:00Z",
189 "customer_external_id": "string",
190 "environment_id": "string",
191 "external_id": "string",
192 "id": "string",
193 "payment_method_type": "string",
194 "updated_at": "2024-01-15T09:30:00Z",
195 "account_last4": "string",
196 "account_name": "string",
197 "bank_name": "string",
198 "billing_email": "string",
199 "billing_name": "string",
200 "card_brand": "string",
201 "card_exp_month": 1,
202 "card_exp_year": 1,
203 "card_last4": "string",
204 "company_id": "string"
205 }
206 ],
207 "plans": [
208 {
209 "id": "string",
210 "name": "string",
211 "description": "string",
212 "image_url": "string"
213 }
214 ],
215 "updated_at": "2024-01-15T09:30:00Z",
216 "user_count": 1,
217 "billing_credit_balances": {},
218 "billing_subscription": {
219 "cancel_at_period_end": true,
220 "created_at": "2024-01-15T09:30:00Z",
221 "currency": "string",
222 "customer_external_id": "string",
223 "discounts": [
224 {
225 "coupon_id": "string",
226 "coupon_name": "string",
227 "discount_external_id": "string",
228 "duration": "string",
229 "is_active": true,
230 "started_at": "2024-01-15T09:30:00Z",
231 "subscription_external_id": "string",
232 "amount_off": 1,
233 "currency": "string",
234 "customer_facing_code": "string",
235 "duration_in_months": 1,
236 "ended_at": "2024-01-15T09:30:00Z",
237 "percent_off": 1.1,
238 "promo_code_external_id": "string"
239 }
240 ],
241 "id": "string",
242 "interval": "string",
243 "period_end": 1,
244 "period_start": 1,
245 "products": [
246 {
247 "billing_scheme": "string",
248 "created_at": "2024-01-15T09:30:00Z",
249 "currency": "string",
250 "environment_id": "string",
251 "external_id": "string",
252 "id": "string",
253 "interval": "string",
254 "name": "string",
255 "package_size": 1,
256 "price": 1,
257 "price_external_id": "string",
258 "price_id": "string",
259 "price_tier": [
260 {
261 "flat_amount": 1,
262 "per_unit_price": 1,
263 "per_unit_price_decimal": "string",
264 "up_to": 1
265 }
266 ],
267 "quantity": 1.1,
268 "subscription_id": "string",
269 "updated_at": "2024-01-15T09:30:00Z",
270 "usage_type": "string",
271 "billing_threshold": 1,
272 "meter_id": "string",
273 "price_decimal": "string",
274 "subscription_item_external_id": "string"
275 }
276 ],
277 "status": "string",
278 "subscription_external_id": "string",
279 "total_price": 1,
280 "cancel_at": 1,
281 "company_id": "string",
282 "default_payment_method_id": "string",
283 "expired_at": "2024-01-15T09:30:00Z",
284 "latest_invoice": {
285 "amount_due": 1,
286 "amount_paid": 1,
287 "amount_remaining": 1,
288 "collection_method": "string",
289 "created_at": "2024-01-15T09:30:00Z",
290 "currency": "string",
291 "customer_external_id": "string",
292 "environment_id": "string",
293 "id": "string",
294 "subtotal": 1,
295 "updated_at": "2024-01-15T09:30:00Z",
296 "company_id": "string",
297 "due_date": "2024-01-15T09:30:00Z",
298 "external_id": "string",
299 "payment_method_external_id": "string",
300 "subscription_external_id": "string",
301 "url": "string"
302 },
303 "metadata": {},
304 "payment_method": {
305 "created_at": "2024-01-15T09:30:00Z",
306 "customer_external_id": "string",
307 "environment_id": "string",
308 "external_id": "string",
309 "id": "string",
310 "payment_method_type": "string",
311 "updated_at": "2024-01-15T09:30:00Z",
312 "account_last4": "string",
313 "account_name": "string",
314 "bank_name": "string",
315 "billing_email": "string",
316 "billing_name": "string",
317 "card_brand": "string",
318 "card_exp_month": 1,
319 "card_exp_year": 1,
320 "card_last4": "string",
321 "company_id": "string"
322 },
323 "trial_end": 1,
324 "trial_end_setting": "string"
325 },
326 "default_payment_method": {
327 "created_at": "2024-01-15T09:30:00Z",
328 "customer_external_id": "string",
329 "environment_id": "string",
330 "external_id": "string",
331 "id": "string",
332 "payment_method_type": "string",
333 "updated_at": "2024-01-15T09:30:00Z",
334 "account_last4": "string",
335 "account_name": "string",
336 "bank_name": "string",
337 "billing_email": "string",
338 "billing_name": "string",
339 "card_brand": "string",
340 "card_exp_month": 1,
341 "card_exp_year": 1,
342 "card_last4": "string",
343 "company_id": "string"
344 },
345 "last_seen_at": "2024-01-15T09:30:00Z",
346 "logo_url": "string",
347 "plan": {
348 "id": "string",
349 "name": "string",
350 "added_on": "2024-01-15T09:30:00Z",
351 "billing_product_external_id": "string",
352 "billing_product_id": "string",
353 "description": "string",
354 "image_url": "string",
355 "plan_period": "string",
356 "plan_price": 1
357 },
358 "traits": {}
359 },
360 "params": {}
361}
Was this page helpful?
Previous

The User object

Next
Built with
Upsert company trait

Headers

X-Schematic-Api-KeystringRequired

Request

This endpoint expects an object.
keysmap from strings to stringsRequired

Key/value pairs to identify a company or user

traitstringRequired
Name of the trait to update
incrinteger or nullOptional

Amount to increment the trait by (positive or negative)

setstring or nullOptional
Value to set the trait to
update_onlyboolean or nullOptional
Unless this is set, the company or user will be created if it does not already exist

Response

OK
dataobject
paramsobject
Input parameters

Errors