Test LDAP Connection

Prev Next
Post
/api/v1/ldap.testConnection
Premium tag

Test if Rocket.Chat can connect to the specified LDAP server using the port and host provided in the Rocket.Chat settings. Make sure LDAP is enabled before using this endpoint.

Permission required: test-admin-options.

Changelog

Version Description
9.0.0 Moved to premium plans.
9.0.0 Added the LDAP_Bind_failed and LDAP_Connection_failed_reason errors. Removed the Connection_failed error.
Header parameters
X-Auth-Token
stringRequired

The authenticated user token.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The authenticated user ID.

ExamplerbAXPnMktTFbNpwtJ
Responses
200

OK

Success Example
{
  "message": "LDAP_Connection_successful",
  "success": true
}
object
message
string
success
boolean
400

Bad Request

Bind Failed

LDAP bind failed

Rocket.Chat reached the LDAP server, but the server rejected the bind with the configured LDAP_Authentication_UserDN and LDAP_Authentication_Password. details.error contains the LDAP server's error, for example Invalid Credentials.

{
  "success": false,
  "error": "LDAP_Bind_failed",
  "details": {
    "error": "Invalid Credentials"
  }
}
Connection Failed

Can't connect to the LDAP server

Rocket.Chat couldn't reach the LDAP server at the configured LDAP_Host and LDAP_Port. details.reason contains the connection error, for example Timeout, connectRefused, or getaddrinfo ENOTFOUND.

{
  "success": false,
  "error": "LDAP_Connection_failed_reason",
  "errorType": "error-ldap-connection-failed",
  "details": {
    "reason": "Timeout"
  }
}
License Required

Premium license required

The workspace doesn't have a premium license with the ldap-enterprise module.

{
  "success": false,
  "error": "This is an enterprise feature [error-action-not-allowed]",
  "errorType": "error-action-not-allowed"
}
LDAP Disabled

LDAP is disabled

LDAP is not enabled in the workspace (LDAP_Enable is off).

{
  "success": false,
  "error": "LDAP_disabled"
}
Expand All
object
success
boolean
error
string
errorType
string
details
object
error
string

The LDAP server's error. Returned with LDAP_Bind_failed.

reason
string

The connection error. Returned with LDAP_Connection_failed_reason.

401

Unauthorized

Authorization Error
{
  "success": false,
  "error": "You must be logged in to do this."
}
object
success
boolean
error
string
403

Forbidden

Permission Error

Missing permission

The user doesn't have the test-admin-options permission.

{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
object
success
boolean
error
string