Skip to main content

Create a new session

Create a new session. A token will be returned, which is required for further updates of the session.

Request Body required
  • checks object

    "Check for user and password. Successful checks will be stated as factors on the session."

  • user object

    "checks the user and updates the session on success"

  • userId string

    Possible values: non-empty and <= 200 characters

  • loginName string

    Possible values: non-empty and <= 200 characters

  • password object

    "Checks the password and updates the session on success. Requires that the user is already checked, either in the previous or the same request."

  • password string

    Possible values: non-empty and <= 200 characters

  • metadata object

    "custom key value list to be stored on the session"

  • property name* string
Responses

OK


Schema
  • details object
  • 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
  • sessionId string

    "id of the session"

  • sessionToken string

    "token of the session, which is required for further updates of the session or the request other resources"

POST /v2alpha/sessions

Request

Base URL
https://$ZITADEL_DOMAIN
Content-Type
Body required
{
"checks": {
"user": {
"userId": "d654e6ba-70a3-48ef-a95d-37c8d8a7901a",
"loginName": "mini@mouse.com"
},
"password": {
"password": "V3ryS3cure!"
}
},
"metadata": {}
}
Accept
curl -L -X POST 'https://$ZITADEL_DOMAIN/v2alpha/sessions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"checks": {
"user": {
"userId": "d654e6ba-70a3-48ef-a95d-37c8d8a7901a",
"loginName": "mini@mouse.com"
},
"password": {
"password": "V3ryS3cure!"
}
},
"metadata": {}
}'