Build your own self-service UI
The Self-Service API offers more capabilities than the Self-Service portal currently shows: besides personal information, email addresses, and the password, your application can also change the primary email address, add email addresses, and manage phone numbers, passkeys, and authenticator apps.
If the Self-Service portal does not fit your user experience, you can build your own self-service pages, in a web or mobile application, on top of the Self-Service API. Your application signs the user in, gets an access token, and calls the Self-Service API on the user's behalf. Self-Service takes care of reading and updating the data in the platform services.
This page explains how to authenticate, which calls to make for each capability, and how to handle errors. For the complete list of endpoints, parameters, and schemas, see the Self-Service API reference.
APIs at a glance
| API | Base path | Purpose |
|---|---|---|
| Self-Service API | https://<your-tenant-domain>/self-service/api/v1 |
Read and update the signed-in user's personal information, email addresses, phone numbers, password, passkeys, and authenticator apps. |
| Self-Service display configuration | https://<your-tenant-domain>/self-service/ui-configuration-service/api/v1 |
Read the attribute display configuration that administrators save in the console. Optional. See Use the display configuration. |
All Self-Service API calls act on the signed-in user only. The user is identified by the access token, so there are no user IDs in the paths, and a user cannot read or change another user's account.
The tenant is determined from the domain that you call. You do not need to send a tenant identifier.
Authentication
Every request needs an access token for the signed-in user, sent in the Authorization header:
Authorization: Bearer <access-token>
The access token must meet these requirements:
| Requirement | Value |
|---|---|
| Issuer | Your tenant's OneWelcome Identity Platform authorization server |
| Token type | A user token, obtained with the authorization code flow. For browser and mobile applications, use PKCE. Tokens obtained with the client credentials grant are rejected. |
| Format | JSON Web Token (JWT) |
| Audience | self-service |
| Scope | self-service |
To read the display configuration with the same token, the token also needs the audience helpdesk-management-service and the scope helpdesk-management-service:self-service-configuration:get.
When the token expires, refresh it or sign the user in again. Requests with a missing, expired, or invalid token are rejected with HTTP 401. Requests with a token that does not have the self-service scope are rejected with HTTP 403.
Set up a web client for your application
Your application needs its own web client in your tenant to sign users in and get these tokens. You can set it up in one of two ways:
- Ask Thales Professional Services to set it up for you, for example as part of setting up Self-Service for your tenant.
- Set it up yourself in the OneWelcome Identity Platform console, if you have the
access_writerole. See Create a web client.
Configure the web client as follows:
| Setting | Value |
|---|---|
| Authentication method | PKCE (for public clients) for browser and mobile applications |
| Grant types | Authorization code |
| Access token format | JSON Web Token (JWT) |
| Redirect URL | The sign-in callback URL of your application |
| Additional audiences | self-service. Add helpdesk-management-service to read the display configuration. |
| Scopes | openid and self-service. Add helpdesk-management-service:self-service-configuration:get to read the display configuration. |
| Identity provider | The same identity provider that the Self-Service portal uses for your tenant |
Note
If your application runs on a domain other than your tenant domain, its origin must be allowed for cross-origin (CORS) requests. This is configured when Self-Service is set up for your tenant. Contact Thales Support to add an origin later.
Request conventions
- Request and response bodies are JSON. Send
Content-Type: application/jsonwith every request that has a body. - (Optional) Send an
X-Request-Idheader with a UUID to correlate a request with your own logs. Self-Service returns the same value in theX-Request-Idresponse header, or generates one if you do not send it. Include this value when you contact Thales Support about a failed request. - Successful updates return HTTP
204 No Content, without a body.
Errors
Errors are returned with an HTTP error status and a JSON body:
{
"id": "6f1c2b0e-8e7a-4c55-9f0e-2b1d3c4a5e6f",
"code": "SELF-104",
"message": "New passwords do not match",
"details": [
{
"type": "DetailedErrorMessage"
}
]
}
| Field | Description |
|---|---|
id |
The trace ID of the request. It is the same value as the X-Request-Id response header. |
code |
The Self-Service error code. See the table below. |
message |
A general, English description of the error. Do not show it to users as-is. Map the code to your own texts. |
details |
Additional information. For validation errors, description lists the invalid fields. For errors returned by a platform service, description contains that service's error response. |
| Code | HTTP status | Meaning |
|---|---|---|
SELF-100 |
400 |
The request body is missing, not valid JSON, or a required field is empty or has a value that is not allowed. |
SELF-100 |
404 |
The passkey or authenticator app device does not exist or does not belong to the user. |
SELF-104 |
400 |
newPassword and confirmPassword are different. |
SELF-105 |
400 |
email and confirmEmail are different. |
SELF-109 |
400 |
phoneNumber and confirmPhoneNumber are different. |
SELF-001 |
500 |
Unexpected error. |
SELF-102 |
500 |
A platform service rejected the request or could not be reached. Check details for the reason, for example a wrong current password or a password that does not meet the policy. |
SELF-102 |
Status of the platform service | For passkeys and authenticator apps, the HTTP status of the platform service is returned as-is, for example 501 when renaming passkeys is not available for your tenant. |
SELF-103 |
500 |
Self-Service is not completely set up for your tenant. Contact Thales Support. |
SELF-108 |
500 |
The phone number to delete is the primary phone number. |
SELF-205 |
504 |
A platform service did not respond in time. Try again later. |
Credential store errors
Email address, phone number, and password changes are handled by the credential store of your tenant. When the credential store rejects a request, for example because the current password is wrong or the new password does not meet the password policy, Self-Service returns HTTP 500 with code SELF-102. The details[0].description field contains the credential store's own error response, with its error code in error_code.
To show a meaningful message to the user, read the credential store error code from details[0].description. These are the codes that matter most for Self-Service:
| Operation | Credential store error code | Meaning |
|---|---|---|
| Change the password | CRE000003 |
The current password is wrong. |
CRE000044 to CRE000049 |
The new password does not meet the password policy: it is too short, or it contains forbidden characters, or it misses a digit, a lowercase character, a special character, or an uppercase character. | |
CRE000050, CRE000051 |
The new password contains the user's name or username. | |
CRE000056 |
The new password has already been used. | |
| Email addresses | CRE000001 |
The email address is not valid. |
CRE000005 |
The email address is already used for another account. | |
CRE000007 |
The email domain is not allowed. | |
CRE000010, CRE000011, CRE000012 |
The confirmation token was not found, was already used, or has expired. | |
| Phone numbers | CRE000053 |
The phone number is already used for another account. |
CRE000055 |
The verification code is not valid. | |
| All operations | CRE000008 |
Too many requests. Try again later. |
For the complete list of credential store error codes, see the ErrorResponse model in the Credential API reference.
Personal information
The personal information of a user is an identity in the identity store. To build a profile form, combine the attribute schema with the user's current values:
-
Get the attribute schema with
GET /api/v1/data-model.The response lists the attributes of your tenant's identity store schema, with their display names, sub-attributes, possible values, and metadata such as
type,mutability,isRequired, andisEditableByEndUser. Use the metadata to choose the input type and to validate values. -
Get the user's values with
GET /api/v1/user-details. -
(Optional) Get the display configuration to show the same attributes, in the same order, as the Self-Service portal.
-
When the user saves, send the updated identity with
PUT /api/v1/user-details.Start from the object that you received from
GET /api/v1/user-details, change the values that the user edited, and send the complete object back.
Example: get the user's values
GET /self-service/api/v1/user-details HTTP/1.1
Host: <your-tenant-domain>
Authorization: Bearer <access-token>
{
"id": "8477554e-3e4c-4033-abc4-c11143ed6ca6",
"systemAttributes": {
"id": "8477554e-3e4c-4033-abc4-c11143ed6ca6"
},
"attributes": {
"nickName": "Alex",
"birthDate": "1990-01-15",
"preferredLanguage": "en",
"emails": [
{
"type": "home",
"value": "alex@example.com",
"primary": true,
"internalId": "12de85ada35b451e9dcbafc256da6439"
}
]
},
"avmAttributes": [],
"externalAccounts": []
}
Example: update the user's values
PUT /self-service/api/v1/user-details HTTP/1.1
Host: <your-tenant-domain>
Authorization: Bearer <access-token>
Content-Type: application/json
{
"systemAttributes": {
"id": "8477554e-3e4c-4033-abc4-c11143ed6ca6"
},
"attributes": {
"nickName": "Al",
"birthDate": "1990-01-15",
"preferredLanguage": "nl",
"emails": [
{
"type": "home",
"value": "alex@example.com",
"primary": true,
"internalId": "12de85ada35b451e9dcbafc256da6439"
}
]
},
"avmAttributes": [],
"externalAccounts": []
}
The response is 204 No Content.
Note
- Do not change email addresses through
PUT /api/v1/user-details. Use the primary email address endpoints, which verify the new address. - Your application is responsible for respecting the read-only settings: the
isEditableByEndUserandmutabilitymetadata of the attribute schema, and thereadOnlyflags of the display configuration.
Use the display configuration
Administrators select the attributes to display in the console. See Configure Self-Service. Your application can read the same configuration, so that changes in the console also apply to your UI. The token needs the additional audience and scope listed under Authentication.
GET /self-service/ui-configuration-service/api/v1/configurations/self-service/USERS_UI_CONFIG HTTP/1.1
Host: <your-tenant-domain>
Authorization: Bearer <access-token>
{
"configurationType": "USERS_UI_CONFIG",
"businessType": "SELF_SERVICE",
"data": {
"headerAttributes": [],
"userDetailAttributes": [
{ "userAttribute": "attributes.nickName", "order": 1, "readOnly": false },
{ "userAttribute": "attributes.birthDate", "order": 2, "readOnly": true },
{ "userAttribute": "attributes.preferredLanguage", "order": 3, "readOnly": false }
]
}
}
Apply the configuration as follows:
- Each entry in
userDetailAttributesrefers to an attribute of the attribute schema.userAttributeis the attribute name, prefixed withsystemAttributes.for system attributes orattributes.for custom attributes. - Show only the attributes that are listed, sorted by
order, ascending. - Show attributes with
"readOnly": trueas read-only. - If the response is HTTP
404, no configuration has been saved. Show all attributes of the schema. - Ignore
headerAttributes. It is reserved for a future version of the portal.
Primary email address
Changing the primary email address is a two-step process. The new address only becomes the primary address after the user confirms it.
-
(Optional) Show the user's current addresses with
GET /api/v1/emails.{ "emails": [ { "internalId": "12de85ada35b451e9dcbafc256da6439", "value": "alex@example.com", "type": "home", "primary": true } ] } -
Request the change with
POST /api/v1/emails/primary/add. Send the new address twice, as entered by the user in an address field and a confirmation field:{ "email": "alex.new@example.com", "confirmEmail": "alex.new@example.com" }The response is
204 No Content. A verification email with a confirmation link is sent to the new address. Until the change is confirmed, the new address is stored as an additional email address of typeother, and the user keeps signing in with the current primary address. -
The user follows the link in the email. The link points to the Self-Service portal on your tenant domain:
https://<your-tenant-domain>/self-service/confirm-primary-email?token=<confirmation-token>The portal confirms the change by calling
POST /api/v1/emails/primary/confirmwith the token:{ "token": "<confirmation-token>" }The response is
204 No Content. The new address is now the primary email address. A notification is sent to the previous primary address.
Note
The confirmation link always opens the Self-Service portal on your tenant domain, also when the change was requested from your own application. You cannot set a different landing page for this link.
Additional email addresses
Besides the primary email address, users can have additional email addresses of type home, work, or other.
- Add:
POST /api/v1/emails/secondary/addwithemail,confirmEmail, andemailType. The address is added immediately, and a verification email is sent to it. The response is204 No Content. - Delete:
POST /api/v1/emails/secondary/deletewith the address as returned byGET /api/v1/emails(internalId,value,type, and"primary": false). The response is204 No Content. The primary email address cannot be deleted.
Phone numbers
Users have a primary phone number and can have additional phone numbers of type home, work, or other. Send phone numbers in international format, with a + and the country code, for example +31612345678.
-
Get the user's phone numbers with
GET /api/v1/phone-numbers.{ "phoneNumbers": [ { "internalId": "d11cf2b091014528ba6ab28c55476616", "value": "+31612345678", "type": "work", "primary": true } ] } -
To change the primary phone number, call
POST /api/v1/phone-numbers/primary/addwith the new number twice:{ "phoneNumber": "+31687654321", "confirmPhoneNumber": "+31687654321" }The response is
204 No Content. A text message with a verification code is sent to the new number. -
Ask the user for the code and confirm the change with
POST /api/v1/phone-numbers/primary/confirm:{ "otp": "123456", "phoneNumber": "+31687654321" }The response is
204 No Content. The new number is now the primary phone number.
Additional phone numbers are not verified:
- Add:
POST /api/v1/phone-numbers/secondary/addwithphoneNumber,confirmPhoneNumber, andtype. The response contains the updated list of phone numbers. - Delete:
POST /api/v1/phone-numbers/secondary/deletewith the number as returned byGET /api/v1/phone-numbers(internalId,value,type, and"primary": false). The response is204 No Content. The primary phone number cannot be deleted.
Passkeys
Users can sign in with passkeys (WebAuthn / FIDO2 credentials). With the Self-Service API, your application lists, adds, renames, and deletes the user's passkeys.
- List:
GET /api/v1/passkeysreturns the user's passkeys, with theircredentialId,friendlyName, and registration date. - Rename:
PATCH /api/v1/passkeys/{credentialId}with{"friendlyName": "Work phone"}. Renaming is not available for every tenant configuration. If it is not available, the response is HTTP501. - Delete:
DELETE /api/v1/passkeys/{credentialId}. The response is204 No Content.
To add a passkey, use the WebAuthn API of the browser or platform:
-
Get the credential creation options with
GET /api/v1/passkeys/enrollment/options. Optionally, pass a name for the passkey in thefriendlyNamequery parameter.The response follows the WebAuthn
PublicKeyCredentialCreationOptionsstructure. Binary values, such aschallenge,user.id, and the IDs inexcludeCredentials, are base64url-encoded strings. The response also contains atrxId. -
Decode the binary values and call
navigator.credentials.create({ publicKey: options }). The user creates the passkey with their device, for example with a fingerprint, face recognition, or a security key. -
Send the resulting
PublicKeyCredentialtoPOST /api/v1/passkeys/enrollment/result, with its binary values base64url-encoded and thetrxIdfrom step 1:{ "id": "<credential-id>", "rawId": "<credential-id>", "type": "public-key", "response": { "attestationObject": "<base64url>", "clientDataJSON": "<base64url>", "transports": ["internal"] }, "authenticatorAttachment": "platform", "clientExtensionResults": {}, "trxId": "<trxId-from-step-1>" }The response contains the
credentialIdof the new passkey.
Note
A passkey is bound to a domain (the relying party ID) and only works for sign-in on that domain. If FIDO passkeys are part of your offering, Thales Professional Services sets up the passkey domain for your tenant. Call the passkey enrollment endpoints through that domain from your own UI, so that the new passkeys work at login.
Authenticator app (TOTP)
Users can sign in with one-time codes from an authenticator app, such as Google Authenticator or Microsoft Authenticator.
-
Start the enrollment with
POST /api/v1/totp/enroll, without a request body.{ "enrollmentTransactionId": "550e8400-e29b-41d4-a716-446655440000", "deviceId": "650e8400-e29b-41d4-a716-446655440001", "otpUri": "otpauth://totp/Example%20Corp:alex@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example%20Corp&algorithm=SHA1&digits=6&period=30", "algorithmName": "HmacSHA1", "codeDigits": 6, "timePeriodSeconds": 30 } -
Show
otpUrias a QR code for the user to scan with the authenticator app. For users who cannot scan, also show thesecretvalue from the URI so that they can enter it manually. -
Ask the user for the code that the app shows, and complete the enrollment with
POST /api/v1/totp/enroll/validate:{ "enrollmentTransactionId": "550e8400-e29b-41d4-a716-446655440000", "code": "123456" }The response contains the
deviceIdof the enrolled device.
To manage enrolled devices:
- List:
GET /api/v1/totp/devicesreturns the devices with theirid,name, andissuer. Secrets are never returned. - Delete:
DELETE /api/v1/totp/devices/{deviceId}. The response is204 No Content.
New devices are named TOTP device. The API does not offer renaming devices.
Password
-
Get the password policy with
GET /api/v1/password-policyand show its rules next to the new password field:{ "minimumLength": 8, "minimumLowercaseCharacters": 1, "minimumUppercaseCharacters": 1, "minimumDecimals": 1, "minimumSpecialCharacters": 1, "maximumLength": 64, "forbiddenCharacters": " ", "whitelistedSpecialCharacters": ["!", "@", "#", "$", "%", "^", "&", "*"] }maximumLength,forbiddenCharacters,forbiddenLeadingChars, andforbiddenTrailingCharsare only returned when your password policy defines them. Theforbidden*fields are strings in which each character is one forbidden character. -
Change the password with
PUT /api/v1/change-password:{ "oldPassword": "<current-password>", "newPassword": "<new-password>", "confirmPassword": "<new-password>" }The response is
204 No Content. The password policy is enforced when the password is saved, even if your application already validated it. -
Sign the user out and ask them to sign in again with the new password. The Self-Service portal does this after every successful password change.