Unidy Docs

Profile and user operations

Read and update the authenticated customer.

Profile and user operations

Use /user when you need the signed-in customer's record and /profile when you need a configurable profile form. Send the SDK client API key in Authorization: Bearer … and the customer's current JWT in X-ID-Token.

OperationPurposeResponse
GET /api/sdk/v1/userRead the customer record.One object with values, identity and brand information.
GET /api/sdk/v1/profileRender a profile form.One object whose fields contain values and form metadata.
PATCH /api/sdk/v1/profileSave editable profile values.The refreshed form definition.
GET /api/sdk/v1/service_connectionsList applications the customer has authorized.A bare array of connections.
DELETE /api/sdk/v1/service_connections/{client_id}Disconnect one application.204 No Content.

For tickets, subscriptions and orders, use the dedicated collection endpoints. For brand consent during sign-in, follow sign-in and registration operations.

A record is different from a form

GET /user returns flat values such as first_name, email and custom_attributes, plus the customer's UNIDY ID, account state and brands. There is no PATCH /user on this API.

GET /profile wraps each built-in attribute and each custom attribute in a field definition. For example:

json
{
  "first_name": {
    "value": "Alex",
    "type": "text",
    "required": false,
    "label": "First name",
    "attr_name": "first_name"
  },
  "custom_attributes": {
    "sports_interests": {
      "value": ["soccer"],
      "type": "checkbox",
      "required": false,
      "label": "Sports interests",
      "attr_name": "sports_interests",
      "readonly": false,
      "options": [
        { "value": "soccer", "label": "Soccer" },
        { "value": "tennis", "label": "Tennis" }
      ]
    }
  }
}

Use attr_name for form and request keys; labels are display text and can be translated. Do not assume a field readable through /user is writable through /profile.

Include owning-brand metadata

GET /api/sdk/v1/profile?include_brand=true adds optional metadata to custom-attribute field definitions:

  • brand: the owning brand's id, name and display_name, or null when no owner is present.
  • cross_brand_visible: true when the definition is visible without a direct link to the requesting brand.

The default response omits both properties. Built-in user fields do not gain them. Ownership describes the definition; it does not move the customer's value into another account or grant permission to edit the field. Continue honoring visibility, readonly and lock rules.

Render the field contract

Field propertyUse
valueStored value, including null or an array where applicable.
typeInput hint such as text, textarea, tel, date, datetime-local, number, select, radio or checkbox.
requiredRequired-field hint from the configured minimum-length rules. Other server validations can still reject a value.
label, attr_nameDisplay label and stable attribute key.
optionsSelect or multi-select choices as { value, label }.
radio_optionsRadio choices with value, label and checked. Preserve the JSON type of each value.
readonlyPresent for custom attributes that are visible but not editable.
locked, locked_textLock state and the administrator's explanation, when a lock applies.

The Locked User Attributes list in the Unidy dashboard, empty

LOCKED USER ATTRIBUTES, at Settings → Locked User Attributes — the screen that puts locked and locked_text into a profile field. It is empty on the seeded instance, which is why no payload on this page shows those keys. One row here is enough to add them to every affected field, and to remove that field from what PATCH will accept.

Built-in field names include names, contact/address fields, date_of_birth, salutation, country_code, email and preferred_language. Custom fields live under custom_attributes.

When constructing the form:

  1. Handle loading and failure before rendering inputs; provide an explicit empty state if your configured subset has no fields.
  2. Render visible values, but do not submit readonly or locked fields. A disabled control missing from FormData must not become an accidental null update.
  3. Render email as readonly. It appears in the response but this endpoint does not permit email changes.
  4. Use a configured language picker for preferred_language; the text hint does not mean every string is accepted. Skip the country separator option whose value is --.
  5. Convert input values deliberately. A multi-select needs an array, a radio boolean needs its boolean value, and an integer needs an integer. Decimal attributes may be returned as strings even though their input type is number.

Built-in labels follow the request's effective locale. Custom attribute labels use their configured translations, with a fallback to their display name. lang only changes the locale when the brand enables multiple languages; avoid assuming every label in a response has the same language.

Custom attribute visibility

Administrator settingEffect
Accessible via APIControls inclusion in /user custom attributes.
Profile access: HiddenExcludes the definition from the normal profile form and profile writes.
Profile access: ShowIncludes it with readonly: true; profile writes do not accept it.
Profile access: EditAllows profile writes, subject to locks, brand visibility and validation.

These settings are independent. A successful profile save can update a value that is intentionally absent from /user; re-render from the returned profile response.

The setting Only show the active brand's attributes restricts the profile to the active brand when enabled. When disabled, definitions from other brands can also appear when the customer already has a value. See Custom attributes for configuration.

Save changed values

Send built-in attributes at the top level and custom attributes inside custom_attributes. This differs from required-fields operations during sign-in, which use a user wrapper.

http
PATCH /api/sdk/v1/profile
Authorization: Bearer YOUR_SDK_API_KEY
X-ID-Token: CUSTOMER_ID_TOKEN
Content-Type: application/json

{
  "first_name": "Alex",
  "country_code": "DE",
  "custom_attributes": {
    "sports_interests": ["soccer", "tennis"],
    "active_membership": false
  },
  "_validate_only_sent_fields": true
}

The custom keys above are examples: use the definitions configured for your installation.

IntentRequest value
Leave a field unchangedOmit its key.
Clear an optional built-in scalarSend an empty string or null; the server normalizes blank built-in values to null.
Clear an optional scalar custom attributeSend null. Radio inputs may also send the returned "_NOT_SET_" choice, which becomes null.
Clear a multi-select custom attributeSend []. A scalar null is not an accepted replacement for the required array shape.
Set a multi-selectSend the entire desired array; it replaces that attribute's previous selection.
Set a boolean custom attributePrefer JSON true or false. Recognized boolean strings are cast by the server, but preserving the boolean type avoids ambiguous form values.

The generated Swagger UI showing the PATCH /api/sdk/v1/profile request body example

THE GENERATED SPEC for PATCH /profile, at /swagger/sdk/html with SDK API V1 selected · highlight on the request body. Three things are wrong with it, which is why the table above is written from the controller instead: there is no custom_attributes property, there is no _validate_only_sent_fields, and the brand property at the top is not implemented — the brand is resolved from the host and that key is dropped with everything else unpermitted.

Clearing still has to satisfy configured and built-in validation. Readonly, locked, unknown and otherwise unpermitted keys can be silently dropped; a 200 does not prove every submitted field changed. Compare the refreshed values with the intended changes.

On success, the server returns 200 and the full profile form definition. Replace local values and metadata with that response. The write uses profile validation, including date-of-birth range checks; do not assume that passing a frontend check guarantees the save.

Validate the fields in a partial form

_validate_only_sent_fields: true limits configurable validation rules to permitted attributes present in the request. It does not turn off model validations, type checks or locks. When the permitted set is empty, it is not a way to bypass validation.

Display save errors

A validation failure returns 422 with field errors:

json
{
  "error_identifier": "invalid_request",
  "error_details": {
    "country_code": ["is not included in the list"],
    "custom_attributes.sports_interests": ["is invalid"]
  }
}

Map built-in keys directly and custom keys by the custom_attributes. prefix. Keep unsaved values visible, show errors beside their inputs, and display unmatched errors in a form-level summary. This response does not require a meta field. Authentication and account-state failures need separate recovery; see SDK troubleshooting.

The Validation Rules list in the Unidy dashboard showing one active rule

VALIDATION RULES, at Settings → Validation Rules — where the configurable half of error_details comes from. The Attribute name column prints custom_attributes.unique_code: the dashboard and the API agree on the key, so this screen is a reliable way to predict what a client will have to render. Only rules with Active set to Yes run.

List and disconnect connected services

GET /service_connections returns a bare array, with no results or pagination wrapper:

json
[
  {
    "id": "OAUTH_CLIENT_ID",
    "name": "Ticketshop",
    "description": "Manage your tickets",
    "logo_url": null,
    "connected_at": "2026-09-01T09:00:00Z"
  }
]

id is the OAuth application's client ID, which belongs in the disconnect path. connected_at is the oldest retained grant or token for that application; cleanup means it is not an immutable first-ever connection date. The internal Login SDK System App can appear in this list; treat disconnecting it as SDK session revocation rather than an ordinary external integration action.

To disconnect, explain the effect and send DELETE /service_connections/{client_id}. A successful response is 204 with no body. A 404 means the application or connection is no longer available; refresh the list.

Disconnecting destroys that customer's OAuth grants and access tokens for the selected application and emits the service-connection deletion event. When configured, a deletion notice is sent to the application's notification address, not to the customer's email. Unidy cannot promise to terminate independent sessions or delete copies of data held by the external application; that application must implement its own disconnect behavior. Reconnection requires a new authorization flow.

Recover from real_email_required

A KYC account can temporarily hold a synthetic @kyc.invalid address. Until a real address is supplied, customer-scoped SDK operations can return 403 real_email_required. Profile reads and writes remain available, but PATCH /profile cannot set email, so it cannot complete recovery.

  1. Direct the customer to https://YOUR_BRAND_HOST/real_email in the hosted Unidy experience. This page needs the hosted session; an SDK JWT by itself does not establish that session.
  2. Let the customer enter an available, non-synthetic address. The hosted flow sends a confirmation email.
  3. Once a non-synthetic pending address is stored, the SDK gate can lift before confirmation. The primary email may still be synthetic until confirmation completes.
  4. Retry the interrupted operation after the customer returns. Do not repeatedly refresh tokens to address this account-state requirement.

Do not display the placeholder as a usable contact address or interpret the gate lifting as proof that the new address has been confirmed.

Relation previews on /user

preload[]=tickets, preload[]=subscriptions and preload[]=newsletter_subscriptions add relation previews to the customer record. Each is capped at 101 records, without pagination or a total, and omitted keys do not mean empty relations.

Use the dedicated collection routes for full lists. In particular, the current ticket preload uses the owner's association and does not apply the dedicated ticket endpoint's holder-aware redaction. Do not use that preview for transferred-ticket displays or treat it as an equivalent authorization contract; have the server behavior verified before exposing those fields.

Was this page helpful?