vevee.analytics.setAttributes()POST /api/v1/attributes/values/batchsk_live_
Write many attribute values in one call. Partial-success on purpose: a single invalid value is recorded in rejected and the rest still apply. Use this for bulk onboarding imports.
Privileged.
setAttributesalways requires a secret key, even when the workspace’s “Client-side attribute writes” flag is ON. Browser code uses setAttribute() one at a time instead.Signature
vevee.analytics.setAttributes(args: {
distinctId: string;
attributes: Record<string, string | number | boolean | string[]>;
}): Promise<{
personId: string;
applied: number;
rejected: Array<{ key: string; reason: string }>;
}>Parameters
| Name | Type | Description | |
|---|---|---|---|
distinctId | required | string | Your user’s identifier. |
attributes | required | Record<string, …> | A map of key → value. Keys must match attribute keys declared in the dashboard. Values follow the same shape rules as setAttribute()- type depends on each attribute’s declaration. |
Returns
| Field | Type | Description |
|---|---|---|
personId | string | The resolved person id for distinctId. |
applied | number | Number of values successfully written. |
rejected | Array<{ key, reason }> | Entries that failed. Possible reason values: attribute_not_defined, attribute_archived, attribute_value_invalid. These are NOT thrown - inspect this array after the call. |
Errors
| Code | Status | When |
|---|---|---|
requires_secret_key | 403 | Called with a pk_* key. |
invalid_request | 400 | Body shape is wrong - e.g. attributes is missing or not an object. |
Per-row validation failures are returned in the rejected array, not thrown. The call succeeds as long as the request itself is well-formed.
Example
const result = await vevee.analytics.setAttributes({
distinctId: user.id,
attributes: {
persona: 'teacher',
goal: 'lesson_planning',
unknown_one: 'x', // attribute not in dashboard → rejected
persona_typo_key: 'student', // attribute not defined → rejected
},
});
// result.applied === 2
// result.rejected === [
// { key: 'unknown_one', reason: 'attribute_not_defined' },
// { key: 'persona_typo_key', reason: 'attribute_not_defined' },
// ]Related: setAttribute() for single writes (also browser-safe with the workspace flag ON), getAttributes() to read current values, and the Attributes guide.