Skip to main content

Create a user schema​

Create the first revision of a new user schema. The schema can then be used on users to store and validate their data.

Request Body required
    type string required

    Possible values: non-empty and <= 200 characters

    Type is a human readable word describing the schema.

    schema object required

    JSON schema representation defining the user.

    possibleAuthenticators string[]

    Possible values: [AUTHENTICATOR_TYPE_UNSPECIFIED, AUTHENTICATOR_TYPE_USERNAME, AUTHENTICATOR_TYPE_PASSWORD, AUTHENTICATOR_TYPE_WEBAUTHN, AUTHENTICATOR_TYPE_TOTP, AUTHENTICATOR_TYPE_OTP_EMAIL, AUTHENTICATOR_TYPE_OTP_SMS, AUTHENTICATOR_TYPE_AUTHENTICATION_KEY, AUTHENTICATOR_TYPE_IDENTITY_PROVIDER]

    Defines the possible types of authenticators.

Responses

A successful response.


Schema
    id string

    ID is the read-only unique identifier of the schema.

    details object

    Details provide some base information (such as the last change date) of the schema.

    sequence uint64

    on read: the sequence of the last event reduced by the projection

    on manipulation: the timestamp of the event(s) added by the manipulation

    changeDate date-time

    on read: the timestamp of the last event reduced by the projection

    on manipulation: the timestamp of the event(s) added by the manipulation

    resourceOwner resource_owner is the organization or instance_id an object belongs to
POST /v3alpha/user_schemas

Authorization

name: OAuth2type: oauth2scopes: openid,urn:zitadel:iam:org:project:id:zitadel:audflows: {
  "authorizationCode": {
    "authorizationUrl": "$CUSTOM-DOMAIN/oauth/v2/authorize",
    "tokenUrl": "$CUSTOM-DOMAIN/oauth/v2/token",
    "scopes": {
      "openid": "openid",
      "urn:zitadel:iam:org:project:id:zitadel:aud": "urn:zitadel:iam:org:project:id:zitadel:aud"
    }
  }
}

Request

Base URL
https://$CUSTOM-DOMAIN
Bearer Token
Content-Type
Body required
{
"type": "employees",
"schema": {
"$schema": "https://example.com/user/employees",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"description": {
"type": "string"
}
}
},
"possibleAuthenticators": [
"AUTHENTICATOR_TYPE_USERNAME",
"AUTHENTICATOR_TYPE_PASSWORD",
"AUTHENTICATOR_TYPE_WEBAUTHN"
]
}
Accept
curl / cURL
curl -L -X POST 'https://$CUSTOM-DOMAIN/v3alpha/user_schemas' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"type": "employees",
"schema": {
"$schema": "https://example.com/user/employees",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"description": {
"type": "string"
}
}
},
"possibleAuthenticators": [
"AUTHENTICATOR_TYPE_USERNAME",
"AUTHENTICATOR_TYPE_PASSWORD",
"AUTHENTICATOR_TYPE_WEBAUTHN"
]
}'