ComRaidComRaid Docs

Contact attributes

Store latest-state audience data on Contacts for targeting and Segments.

What contact attributes are for

Contact attributes describe who someone is for messaging: plan, region, stage, or any other latest-state fields your product supplies. Use them to build Segments and target Notifications. They are not delivery or conversion IDs — those belong to notification attribution.

Example: a Contact with plan=premium and region=us-east-1 can match a “premium US” Segment. When that Contact receives a push, ComRaid still injects separate cr_* attribution keys into the payload for acknowledgements and product-owned reporting.

Preferred: upsert with the contact

Send attributes together with the Contact. Keys are free-form. The first time a Project receives a given key, ComRaid registers a project-level attribute definition; later upserts reuse that definition and store the per-Contact value.

PUT https://api.comraid.io/contacts/{external_user_id}
Authorization: Bearer cr_sk_...
Content-Type: application/json

{
  "name": "Jane Doe",
  "attributes": {
    "plan": "premium",
    "plan_tier": "gold",
    "region": "us-east-1",
    "favorite_category": "electronics",
    "stage": "active_user"
  }
}

Successful responses echo the Contact and which attribute keys changed. Full response schemas live in the API Reference.

Optional: attributes-only alias

If you only need to refresh audience state, you can still call the dedicated endpoint. Prefer the contact upsert when updating profile and attributes together.

PUT https://api.comraid.io/contacts/{external_user_id}/attributes
Authorization: Bearer cr_sk_...
Content-Type: application/json

{
  "attributes": {
    "plan": "silver"
  }
}

From the mobile app

Logged-in Subscriptions can upsert the same Contact attributes with PUT /mobile/subscriptions/{id}/attributes (mobileSubscriptionUpsertAttributes) using the App ID and subscription_credential. Anonymous Subscriptions are rejected — login first. JWT is not accepted on this call. Semantics match the server attributes-only route above; SDKs expose this as setAttributes. See the API Reference for the Mobile request body.

Behavior

  • Upserts/creates the Contact if needed in the authenticated Project (external_user_id from the path).
  • Infers simple types from JSON values: string, number, boolean, datetime string, or JSON.
  • Call again on downgrade, expiry, refund, or any other audience-state change. Unspecified keys are not deleted.
  • Set a key to JSON null to remove that Attribute (API and mobile setAttributes). SDKs that allow nullable values send JSON null the same way.
  • Limits: non-empty keys ≤ 128 characters; values ≤ 4 KB serialized; ≤ 200 keys per Contact. Oversized JSON bodies are rejected (413 body_too_large, 1 MB default).
  • The Dashboard segment builder lists attribute keys from project definitions (including keys that currently have no Contact values). Definitions are not seeded — products must supply keys through the API. Combined audience sizes for multiple filters are computed when you preview targeting, not stored ahead of time.

Do not store purchases, subscriptions, entitlements, refunds, revenue, or order state in ComRaid. Keep those in your product database. Contact attributes are for messaging audience state only.

On this page