 		status: 'success'   # need to handle error
 
 
-# get messages in a room
+###
+@api {get} /rooms/:id/messages?skip=:skip&limit=:limit Get messages in a room.
+@apiParam {Number} id         Room ID
+@apiParam {Number} [skip=0]   Number of results to skip at the beginning
+@apiParam {Number} [limit=50] Maximum number of results to return
+###
 Api.addRoute 'rooms/:id/messages', authRequired: true,
 	get: ->
 		try
-			if Meteor.call('canAccessRoom', @urlParams.id, this.userId)
-				msgs = RocketChat.models.Messages.findVisibleByRoomId(@urlParams.id, {sort: {ts: -1}, limit: 50}).fetch()
+			rid = @urlParams.id
+			# `variable | 0` means converting to int
+			skip = @queryParams.skip | 0 or 0
+			limit = @queryParams.limit | 0 or 50
+			limit = 50 if limit > 50
+			if Meteor.call('canAccessRoom', rid, this.userId)
+				msgs = RocketChat.models.Messages.findVisibleByRoomId(rid,
+					sort:
+						ts: -1
+					skip: skip
+					limit: limit
+				).fetch()
 				status: 'success', messages: msgs
 			else
 				statusCode: 403   # forbidden

					ids = []
					endCount = @bodyParams.users.length - 1
					for incoming, i in @bodyParams.users
					 	ids[i] = {uid: Meteor.call 'registerUser', incoming}
					 	Meteor.runAsUser ids[i].uid, () =>
					 		Meteor.call 'setUsername', incoming.name
					 		Meteor.call 'joinDefaultChannels'

					status: 'success', ids: ids
				catch e

				console.log '[restapi] bulk/createRoom -> '.red, "User does not have 'bulk-create-c' permission"
				statusCode: 403
				body: status: 'error', message: 'You do not have permission to do this'
