/session/me

Inspect the current authenticated consumer user or organization member. This is the first call to make after obtaining an access token when your application needs the principal, session lifetime, or organization context.

Endpoint

Method URL Body Authentication
POST https://api.user.m7.org/api/v2/session/me {} Consumer-user or organization-member bearer token

Application tokens are not supported by this endpoint. For a DPoP- or fingerprint-bound human session, include the companion headers from the authorization guide.

Request

No request body fields are required.

curl -sS https://api.user.m7.org/api/v2/session/me \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'

Consumer-user response

For a consumer-user token, data.user identifies the signed-in account and data.idp describes the sign-in provider.

{
  "status": 1,
  "comment": "OK",
  "data": {
    "iat": 1780000000,
    "expires_in": 900,
    "expires": 1780000900,
    "user": {
      "id": "USER_UUID",
      "rid": "IDENTITY_RID",
      "name": "alice",
      "avatar": "https://files.m7.org/avatar.jpg",
      "role": "member",
      "status": "active"
    },
    "idp": {
      "type": "delegated",
      "vendor": "m7",
      "verified": true
    }
  }
}
Field Meaning
iat Token issue time as a Unix timestamp.
expires_in Remaining token lifetime in seconds.
expires Token expiration as a Unix timestamp.
user Consumer-account identity and status.
idp Sign-in provider metadata.

Organization-member response

For an organization-member token, data contains the same lifetime and idp fields plus the organization and member context. data.client is an organization member record, not an OAuth application.

{
  "status": 1,
  "comment": "OK",
  "data": {
    "iat": 1780000000,
    "expires_in": 900,
    "expires": 1780000900,
    "org": {
      "id": "ORG_UUID",
      "name": "Example Org",
      "slug": "example-org",
      "status": "active",
      "expires": null
    },
    "client": {
      "id": "MEMBER_UUID",
      "name": "alice",
      "type": "member",
      "status": "active",
      "expires": null,
      "tags": []
    },
    "groups": {
      "GROUP_UUID": {
        "id": "GROUP_UUID",
        "name": "Operators"
      }
    },
    "idp": {
      "type": "delegated",
      "vendor": "m7",
      "verified": true
    }
  }
}

groups is a map keyed by group ID. An empty map means the member has no group memberships in the current organization.

Errors

Condition Response comment
Invalid or expired token Invalid token or a token-validation error
Application token application tokens are not supported here
Unsupported principal or token type unsupported <type> token for <principal> principal