v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
Session
Webmail Sessions

Create Webmail session for current user

Create a temporary session to connect to Webmail for the authenticated cPanel user.

How to use this API

After you successfully call this API, you will need to log in to Webmail. To do this, send an HTTP POST to https://$URL_AUTHTY:2096$token/login with a message body of session=$session where:

  • $URL_AUTHTY represents the value from the hostname return.
    • If the hostname return value is null, enter the hostname of the server that answered the API function.
    • $token represents the value from the token return.
  • $session represents the value of the session return.

For example, an HTTP POST may resemble the following:

https://hostname.example.com:2096/cpsess2462418786/login

With a message body of:

session=username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_MAIL_USER,728fb86a7df1cf20690c65f349ac3137

get/Session/create_webmail_session_for_self

Query parameters

localestring
Example:en

The locale that the new session will use.

Use UAPI Locale::list_locales to see a list of valid locales.

Note:

  • You must only enter lowercase characters.
  • This parameter defaults to the cPanel user's locale.
remote_addressstring ipv4
Example:192.168.0.1

The session's client IP address.

Note:

  • If you run this function from the command line, this parameter is required.
  • This parameter defaults to the API caller's IP address.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "create_webmail_session_for_self",
  "module": "Session",
  "result": {
    "data": {
      "hostname": "hostname.example.com",
      "session": "username:D7NiAZv1nf4bXeg9:CREATE_WEBMAIL_SESSION_FOR_SELF,728fb86a7df1cf20690c65f349ac3137",
      "token": "/cpsess2462418786"
    },
    "metadata": {
      "transformed": 1
    },
    "status": 1
  }
}