{"record":{"id":"3df1cf14e5cd509f","repo":"RocketChat/Rocket.Chat","slug":"error-endpoint-disabled","errorCode":"error-endpoint-disabled","errorMessage":"This endpoint is disabled","messagePattern":"This endpoint is disabled","errorType":"exception","errorClass":"Meteor.Error","httpStatus":400,"severity":"warning","filePath":"apps/meteor/server/api/v1/im.ts","lineNumber":792,"sourceCode":"\trequired: ['ims', 'offset', 'count', 'total', 'success'],\n\tadditionalProperties: false,\n});\n\nconst dmMessagesOthersEndpointsProps = {\n\tauthRequired: true as const,\n\tpermissionsRequired: ['view-room-administration'],\n\tresponse: {\n\t\t200: paginatedMessagesResponseSchema,\n\t\t400: validateBadRequestErrorResponse,\n\t\t401: validateUnauthorizedErrorResponse,\n\t\t403: validateForbiddenErrorResponse,\n\t},\n};\n\nconst dmMessagesOthersAction = <Path extends string>(_name: Path): TypedAction<typeof dmMessagesOthersEndpointsProps, Path> =>\n\tasync function action() {\n\t\tif (settings.get('API_Enable_Direct_Message_History_EndPoint') !== true) {\n\t\t\tthrow new Meteor.Error('error-endpoint-disabled', 'This endpoint is disabled', {\n\t\t\t\troute: '/api/v1/im.messages.others',\n\t\t\t});\n\t\t}\n\n\t\tconst { roomId } = this.queryParams;\n\t\tif (!roomId) {\n\t\t\tthrow new Meteor.Error('error-roomid-param-not-provided', 'The parameter \"roomId\" is required');\n\t\t}\n\n\t\tconst room = await Rooms.findOneById<Pick<IRoom, '_id' | 't'>>(roomId, { projection: { _id: 1, t: 1 } });\n\t\tif (!room || room?.t !== 'd') {\n\t\t\tthrow new Meteor.Error('error-room-not-found', `No direct message room found by the id of: ${roomId}`);\n\t\t}\n\n\t\tconst { offset, count } = await getPaginationItems(this.queryParams);\n\t\tconst { sort, fields, query } = await this.parseJsonQuery();\n\t\tconst ourQuery = Object.assign({}, query, { rid: room._id });\n","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/f9d3ec372bb580fa8d036f94cf03925a478ef768/apps/meteor/server/api/v1/im.ts#L774-L810","documentation":"dmMessagesOthersAction (GET im.messages.others) is gated by the server setting 'API_Enable_Direct_Message_History_EndPoint'. When its value is not strictly true, the endpoint throws error-endpoint-disabled with route '/api/v1/im.messages.others'. This is a deliberate feature flag, not a runtime fault.","triggerScenarios":"Calling GET /api/v1/im.messages.others on a workspace where the admin setting API_Enable_Direct_Message_History_EndPoint is false or unset (the default).","commonSituations":"Privacy-sensitive deployments disable this endpoint by default; the calling integration assumed the feature was on; workspace was hardened by an admin.","solutions":["Ask a workspace admin to enable Settings > General > API_Enable_Direct_Message_History_EndPoint.","If you cannot enable it, use im.history for the calling user's own messages instead.","Check the setting via settings.get or the API before calling the endpoint."],"exampleFix":"// before\nGET /api/v1/im.messages.others?roomId=abc // disabled by default\n\n// after (admin enables the setting)\nGET /api/v1/im.messages.others?roomId=abc","handlingStrategy":"try-catch","validationCode":"// Check the feature flag first (requires admin read on settings)\nconst enabled = (await api.get('/api/v1/settings/API_Enable_Direct_Message_History_EndPoint')).data.value;\nif (enabled !== true) {\n  throw new Error('im.messages.others is disabled on this workspace');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.get('/api/v1/im.messages.others', { params: { roomId } });\n} catch (e) {\n  if (e.response?.data?.error === 'error-endpoint-disabled') {\n    // fall back to im.history for the caller's own messages\n  } else throw e;\n}","preventionTips":["Treat im.messages.others as opt-in; do not depend on it being enabled.","Document the API_Enable_Direct_Message_History_EndPoint requirement for consumers.","Provide an im.history fallback path in client code."],"tags":["feature-flag","config","direct-message","api"],"backgroundTag":null,"analyzedSha":"f9d3ec372bb580fa8d036f94cf03925a478ef768","analyzedAt":"2026-08-12T19:07:17.372Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}