Create a Validation Rule

Endpoint URL: {registrationDomain} /entityType.addRule


Creates a data validation rule on specific attributes in your schema. User data can be validated or transformed by the new rule any time the underlying user profile attribute is added or updated.

Example uses for entityType.addRule:

  • Defining a validation rule that rejects strings that don't match a regular expression (for example, rejecting username values that do not use the English alphabet).
  • Truncating input to a certain length (i.e., a specific mumber of characters).

Refer to the Registration Error Codes section for details on error codes.

Respects the API Client Allow List: Yes

API Client Permissions

The following table indicates the API clients that can (and the API clients that can't) be used to call this endpoint:



This endpoint supports both Basic authentication (recommended) and janrain-signed authentication.

How to Create an Authentication String

Base URL

The base URL for this endpoint is your Identity Cloud Capture domain; for example:

Your Capture domains (also known as Registration domains) can be found in the Console on the Manage Application page:


Example Request

This command assigns a rule to the givenName attribute in the user entity type. The rule limits givenName to no more than 25 characters, characters that can only consist of uppercase or lowercase letters.

curl -X POST \
  -H "Authorization: Basic c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg"\
  --data-urlencode type_name=user \
  --data-urlencode attributes=["givenName"] \
  --data-urlencode description="This is a rule to accept only English letters and have a maximum Length of 25" \
  --data-urlencode definition='{"and": [{"match-all":"[a-zA-Z]*"}, {"max-length":25}]}' \

      Running this command in Postman

Example Response

  "result": {
  "attributes": [
  "description": "This is a rule to accept only English letters and have a maximum Length of 25",
  "uuid": "ed23abc2-5023-477d-b728-b4cfdc885f3e",
  "definition": {
      "and": [
            "match-all": "[a-zA-Z]*"
            "max-length": 25
    "stat": "ok"

Query Parameters

attributesstringYesJSON array of the attributes to which the rule will be applied. The default is all attributes.
descriptionstringYesBrief description of the rule and its purpose.
definitionstringYesJSON-formatted object defining the rule.
type_namestringYesName of the entityType.