---
updatedAt: 2026-04-20T19:24:53.000Z
---

# Assign constraints to an attribute

Sets the list of constraints for an attribute. Constraints place restrictions on the type of data that can be stored in an attribute.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Entity and Entity Types",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://{hostname}"
    }
  ],
  "paths": {
    "/entityType.setAttributeConstraints": {
      "post": {
        "operationId": "post-entitytype-setattributeconstraints",
        "summary": "Assign constraints to an attribute",
        "description": "Sets the list of constraints for an attribute. Constraints place restrictions on the type of data that can be stored in an attribute.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "example": {
                  "schema": {
                    "attr_defs": [
                      {
                        "length": null,
                        "name": "aboutMe",
                        "type": "string",
                        "case-sensitive": false
                      }
                    ]
                  },
                  "stat": "ok"
                },
                "schema": {
                  "type": "object",
                  "description": "Sets the list of constraints for an attribute.\n",
                  "properties": {
                    "attr_defs": {
                      "type": "array",
                      "description": "Constraints being assigned to an attribute.\n",
                      "items": {
                        "type": "string",
                        "enum": [
                          "required",
                          "unique",
                          "locally-unique",
                          "alphabetic",
                          "alphanumeric",
                          "unicode-letters",
                          "unicode-printable",
                          "email-address"
                        ],
                        "description": "Constraint assigned to an attribute. Constraints limit the type of data that can be written to the attribute. For example, the `alphabetic` constraint limits your character set to the letters A-Z. Writing an integer value such as `1234` to the attribute causes the operation to fail.\n"
                      }
                    },
                    "stat": {
                      "type": "string",
                      "enum": [
                        "OK",
                        "ERROR",
                        "FAIL"
                      ],
                      "description": "Status of the operation.\n"
                    }
                  }
                }
              }
            },
            "description": "Successful response\n"
          }
        },
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "properties": {
                  "constraints": {
                    "type": "array",
                    "description": "Constraints assigned to an attribute. Constraints place restrictions on the data.\n",
                    "items": {
                      "type": "string",
                      "description": "Constraint assigned to the attribute.\n",
                      "enum": [
                        "required",
                        "unique",
                        "locally-unique",
                        "alphabetic",
                        "alphanumeric",
                        "unicode-letters",
                        "unicode-printable"
                      ]
                    },
                    "example": "[\"required\", \"unique\"]\n"
                  },
                  "attribute_name": {
                    "type": "string",
                    "description": "Attribute to be returned. This member returns values only for the specified attribute.\n",
                    "example": "displayName"
                  },
                  "type_name": {
                    "type": "string",
                    "description": "Name of the entity type (user profile database) where the user profile is stored.\n",
                    "example": "user"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "externalDocs": {
    "url": "https://techdocs.akamai.com/identity-cloud-entity/reference",
    "description": "See documention for Akamai's Identity Cloud: Entity and EntityType API\n"
  }
}
```