Skip to main content

Search sessions

POST 

https://$CUSTOM-DOMAIN/v2/sessions/search

Search for sessions

Request​

Bodyrequired

    query object

    Object unspecific list filters like offset, limit and asc/desc.

    offsetuint64
    Example: 0
    limitint64

    Maximum amount of events returned. The default is set to 1000 in https://github.com/zitadel/zitadel/blob/new-eventstore/cmd/zitadel/startup.yaml. If the limit exceeds the maximum configured ZITADEL will throw an error. If no limit is present the default is taken.

    Example: 100
    ascboolean

    default is descending

    queries object[]
  • Array [
  • idsQuery object
    idsstring[]
    userIdQuery object
    idstring
    creationDateQuery object
    creationDatedate-time
    methodstring

    defines which timestamp comparison method is used

    Possible values: [TIMESTAMP_QUERY_METHOD_EQUALS, TIMESTAMP_QUERY_METHOD_GREATER, TIMESTAMP_QUERY_METHOD_GREATER_OR_EQUALS, TIMESTAMP_QUERY_METHOD_LESS, TIMESTAMP_QUERY_METHOD_LESS_OR_EQUALS]

    Default value: TIMESTAMP_QUERY_METHOD_EQUALS
    creatorQuery object
    idstring

    ID of the user who created the session. If empty, the calling user's ID is used.

    Possible values: <= 200 characters

    Example: 69629023906488334
    userAgentQuery object
    fingerprintIdstring

    Finger print id of the user agent used for the session. Set an empty fingerprint_id to use the user agent from the call. If the user agent is not available from the current token, an error will be returned.

    Possible values: <= 200 characters

    Example: 69629023906488334
    expirationDateQuery object
    expirationDatedate-time
    methodstring

    defines which timestamp comparison method is used

    Possible values: [TIMESTAMP_QUERY_METHOD_EQUALS, TIMESTAMP_QUERY_METHOD_GREATER, TIMESTAMP_QUERY_METHOD_GREATER_OR_EQUALS, TIMESTAMP_QUERY_METHOD_LESS, TIMESTAMP_QUERY_METHOD_LESS_OR_EQUALS]

    Default value: TIMESTAMP_QUERY_METHOD_EQUALS
  • ]
  • sortingColumnstring

    Possible values: [SESSION_FIELD_NAME_UNSPECIFIED, SESSION_FIELD_NAME_CREATION_DATE]

    Default value: SESSION_FIELD_NAME_UNSPECIFIED

Responses​

OK

Schema
    details object
    totalResultuint64
    Example: 2
    processedSequenceuint64
    Example: 267831
    timestampdate-time

    the last time the projection got updated

    sessions object[]
  • Array [
  • idstring

    "id of the session"

    creationDatedate-time

    "time when the session was created"

    changeDatedate-time

    "time when the session was last updated"

    sequenceuint64

    "sequence of the session"

    factors object

    "checked factors of the session, e.g. the user, password and more"

    user object
    verifiedAtdate-time

    "time when the user was last checked"

    idstring

    "id of the checked user"

    loginNamestring

    "login name of the checked user"

    displayNamestring

    "display name of the checked user"

    organizationIdstring

    "organization id of the checked user"

    password object
    verifiedAtdate-time

    "time when the password was last checked"

    webAuthN object
    verifiedAtdate-time

    "time when the passkey challenge was last checked"

    userVerifiedboolean
    intent object
    verifiedAtdate-time

    "time when an intent was last checked"

    totp object
    verifiedAtdate-time

    "time when the Time-based One-Time Password was last checked"

    otpSms object
    verifiedAtdate-time

    "time when the One-Time Password was last checked"

    otpEmail object
    verifiedAtdate-time

    "time when the One-Time Password was last checked"

    metadata object

    "custom key value list"

    property name*byte
    userAgent object
    fingerprintIdstring
    ipstring
    descriptionstring
    header object
    property name* object

    A header may have multiple values. In Go, headers are defined as map[string][]string, but protobuf doesn't allow this scheme.

    valuesstring[]
    expirationDatedate-time

    "time the session will be automatically invalidated"

  • ]

Authorization: oauth2

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"
    }
  }
}
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://$CUSTOM-DOMAIN/v2/sessions/search");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"query\": {\n \"offset\": \"0\",\n \"limit\": 100,\n \"asc\": true\n },\n \"queries\": [\n {\n \"idsQuery\": {\n \"ids\": [\n \"string\"\n ]\n },\n \"userIdQuery\": {\n \"id\": \"string\"\n },\n \"creationDateQuery\": {\n \"creationDate\": \"2024-07-29T15:51:28.071Z\",\n \"method\": \"TIMESTAMP_QUERY_METHOD_EQUALS\"\n },\n \"creatorQuery\": {\n \"id\": \"69629023906488334\"\n },\n \"userAgentQuery\": {\n \"fingerprintId\": \"69629023906488334\"\n },\n \"expirationDateQuery\": {\n \"expirationDate\": \"2024-07-29T15:51:28.071Z\",\n \"method\": \"TIMESTAMP_QUERY_METHOD_EQUALS\"\n }\n }\n ],\n \"sortingColumn\": \"SESSION_FIELD_NAME_UNSPECIFIED\"\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://$CUSTOM-DOMAIN
Auth
Body required
{
  "query": {
    "offset": "0",
    "limit": 100,
    "asc": true
  },
  "queries": [
    {
      "idsQuery": {
        "ids": [
          "string"
        ]
      },
      "userIdQuery": {
        "id": "string"
      },
      "creationDateQuery": {
        "creationDate": "2024-07-29T15:51:28.071Z",
        "method": "TIMESTAMP_QUERY_METHOD_EQUALS"
      },
      "creatorQuery": {
        "id": "69629023906488334"
      },
      "userAgentQuery": {
        "fingerprintId": "69629023906488334"
      },
      "expirationDateQuery": {
        "expirationDate": "2024-07-29T15:51:28.071Z",
        "method": "TIMESTAMP_QUERY_METHOD_EQUALS"
      }
    }
  ],
  "sortingColumn": "SESSION_FIELD_NAME_UNSPECIFIED"
}
ResponseClear

Click the Send API Request button above and see the response here!