{"__v":2,"_id":"57f776e67d11f30e00311586","category":{"__v":3,"_id":"5515472ac28d6125001b8884","pages":["551924db45b0d80d00152254","55194fec71a8cc210031db15","551e55590a72c50d0085b911"],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-27T12:03:54.990Z","from_sync":false,"order":2,"slug":"receive-sms","title":"Receive SMS"},"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","version":{"__v":21,"_id":"54eb63b859b1172100334fae","forked_from":"54eb63a1867e1917009b711d","project":"54eb50e5615ffc1900305a16","createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":["58b0377bf634c73700915654"],"next":{"pages":[],"description":""},"createdAt":"2016-10-07T10:20:22.609Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[{"name":"","code":"{  \n   \"results\":[  \n      {  \n         \"messageId\":\"ff4804ef-6ab6-4abd-984d-ab3b1387e823\",\n         \"from\":\"38598111\",\n         \"to\":\"41793026727\",\n         \"text\":\"KEY Test message\",\n         \"cleanText\":\"Test message\",\n         \"keyword\":\"KEY\",\n         \"receivedAt\":\"2015-02-15T11:43:20.254+0100\",\n         \"smsCount\":1\n      }\n   ]\n}","language":"json","status":200}]},"examples":{"codes":[{"name":"","code":"GET /sms/1/inbox/reports HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json","language":"json"}]},"auth":"required","params":[{"_id":"55196774eaa2ed2f002134cb","ref":"","in":"query","required":false,"desc":"Maximum number of received messages that will be returned.. Default value is **50**. Maximum value for this parameter is **10000**.","default":"","type":"int","name":"limit"}],"url":"/sms/:version/inbox/reports"},"isReference":true,"order":3,"body":"This tutorial will show you how to access messages sent by your customers. Before you proceed to implement this method, [**please read introduction**](/docs/receive-sms-introduction) on how to receive inbound messages where you can learn about numbers and initial setup.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"\",\n  \"body\": \"This tutorial covers accessing messages via Pull method. Besides Pull method, received messages can be forwarded to your application URL in real time. [Learn more about Forward method](/docs/forward-received-messages).\"\n}\n[/block]\nAccessing your received messages in our system is pretty much straight forward. All you need to do is make simple API call which will return received messages.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important!\",\n  \"body\": \"All received messages can be pulled **only once**! Once a certain message has been pulled by this method, it will not be available for the next API call. This means that every time you make an API call, you will receive **only new messages** that arrived since the last API call.\"\n}\n[/block]\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /sms/1/inbox/reports HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"GET /sms/1/inbox/reports HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/xml\",\n      \"language\": \"xml\"\n    },\n    {\n      \"code\": \"curl -X GET \\\\\\n-H 'Accept: application/json' \\\\\\n-H \\\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\" \\\\\\nhttps://api.infobip.com/sms/1/inbox/reports\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\n$curl = curl_init();\\n\\ncurl_setopt_array($curl, array(\\n  CURLOPT_URL => \\\"http://api.infobip.com/sms/1/inbox/reports\\\",\\n  CURLOPT_RETURNTRANSFER => true,\\n  CURLOPT_ENCODING => \\\"\\\",\\n  CURLOPT_MAXREDIRS => 10,\\n  CURLOPT_TIMEOUT => 30,\\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\\n  CURLOPT_CUSTOMREQUEST => \\\"GET\\\",\\n  CURLOPT_POSTFIELDS => \\\"\\\",\\n  CURLOPT_HTTPHEADER => array(\\n    \\\"accept: application/json\\\",\\n    \\\"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\"\\n  ),\\n));\\n\\n$response = curl_exec($curl);\\n$err = curl_error($curl);\\n\\ncurl_close($curl);\\n\\nif ($err) {\\n  echo \\\"cURL Error #:\\\" . $err;\\n} else {\\n  echo $response;\\n}\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"require 'uri'\\nrequire 'net/http'\\n\\nurl = URI(\\\"https://api.infobip.com/sms/1/inbox/reports\\\")\\n\\nhttp = Net::HTTP.new(url.host, url.port)\\nhttp.use_ssl = true\\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\\n\\nrequest = Net::HTTP::Get.new(url)\\nrequest[\\\"authorization\\\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\\nrequest[\\\"accept\\\"] = 'application/json'\\n\\nresponse = http.request(request)\\nputs response.read_body\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"import http.client\\n\\nconn = http.client.HTTPSConnection(\\\"api.infobip.com\\\")\\n\\nheaders = {\\n    'authorization': \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    'accept': \\\"application/json\\\"\\n    }\\n\\nconn.request(\\\"GET\\\", \\\"/sms/1/inbox/reports\\\", headers=headers)\\n\\nres = conn.getresponse()\\ndata = res.read()\\n\\nprint(data.decode(\\\"utf-8\\\"))\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"HttpResponse<String> response = Unirest.get(\\\"https://api.infobip.com/sms/1/inbox/reports\\\")\\n  .header(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\")\\n  .header(\\\"accept\\\", \\\"application/json\\\")\\n  .asString();\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"var client = new RestClient(\\\"https://api.infobip.com/sms/1/inbox/reports\\\");\\n\\nvar request = new RestRequest(Method.GET);\\nrequest.AddHeader(\\\"accept\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\n\\nIRestResponse response = client.Execute(request);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"var data = null;\\n\\nvar xhr = new XMLHttpRequest();\\nxhr.withCredentials = true;\\n\\nxhr.addEventListener(\\\"readystatechange\\\", function () {\\n  if (this.readyState === this.DONE) {\\n    console.log(this.responseText);\\n  }\\n});\\n\\nxhr.open(\\\"GET\\\", \\\"https://api.infobip.com/sms/1/inbox/reports\\\");\\nxhr.setRequestHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nxhr.setRequestHeader(\\\"accept\\\", \\\"application/json\\\");\\n\\nxhr.send(data);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"results\\\": [\\n    {\\n      \\\"messageId\\\": \\\"817790313235066447\\\",\\n      \\\"from\\\": \\\"385916242493\\\",\\n      \\\"to\\\": \\\"385921004026\\\",\\n      \\\"text\\\": \\\"QUIZ Correct answer is Paris\\\",\\n      \\\"cleanText\\\": \\\"Correct answer is Paris\\\",\\n      \\\"keyword\\\": \\\"QUIZ\\\",\\n      \\\"receivedAt\\\": \\\"2016-10-06T09:28:39.220+0000\\\",\\n      \\\"smsCount\\\": 1,\\n      \\\"price\\\": {\\n        \\\"pricePerMessage\\\": 0,\\n        \\\"currency\\\": \\\"EUR\\\"\\n      },\\n      \\\"callbackData\\\": \\\"callbackData\\\"\\n    }\\n  ],\\n  \\\"messageCount\\\": 1,\\n  \\\"pendingMessageCount\\\": 0\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n# Response body parameters\n\nIf successful, the response header HTTP status code will be `200 OK` and messages will be returned in the response body.\n\nIf you try to get received messages without authorization, you will get a response with HTTP status code `401 Unauthorized`.\n\n## SMSResponse\n\n|Parameter|Type|Description|\n|-|-|-|\n|*results*|[Messages[]](#messages)|Collection of reports, one per every received message.|\n|*messageCount*|Int|Number of returned messages in this request.|\n|*pendingMessageCount*|Int|Number of remaining new messages on our server ready to be returned in the next API call.|\n\n### Messages\n\n|Parameter|Type|Description|\n|-|-|-|\n|*messageId*|String|The ID that uniquely identifies the received message.|\n|*from*|String|Sender ID that can be alphanumeric or numeric.|\n|*to*|String|The message destination address.|\n|*text*|String|Full text of the received message.|\n|*cleanText*|String|Text of received message without a keyword (if a keyword was sent).|\n|*keyword*|String|Keyword extracted from the message text.|\n|*receivedAt*|Date|Tells when Infobip platform received the message. It has the following format: `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`.|\n|*smsCount*|Int|The number of sent message segments.|\n|*pricePerMessage*|Decimal|Cost of receiving a message.|\n|*currency*|String|Currency of the message price.|\n|*callbackData*|int|Custom callback data can be inserted during setup phase.|\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Keywords\",\n  \"body\": \"Learn more about keywords and how to use them in [introduction](/docs/receive-sms-introduction).\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Get limited number of messages\"\n}\n[/block]\nYou can limit the number of messages in one request by introducing `limit` parameter like this:\n```\n/sms/1/inbox/reports?limit=2\n```\n**Request example:**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /sms/1/inbox/reports?limit=2 HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"GET /sms/1/inbox/reports?limit=2 HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/xml\",\n      \"language\": \"xml\"\n    },\n    {\n      \"code\": \"curl -X GET \\n-H 'Accept: application/json' \\n-H \\\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\" \\nhttps://api.infobip.com/sms/1/inbox/reports?limit=2\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\n$curl = curl_init();\\n\\ncurl_setopt_array($curl, array(\\n  CURLOPT_URL => \\\"http://api.infobip.com/sms/1/inbox/reports?limit=2\\\",\\n  CURLOPT_RETURNTRANSFER => true,\\n  CURLOPT_ENCODING => \\\"\\\",\\n  CURLOPT_MAXREDIRS => 10,\\n  CURLOPT_TIMEOUT => 30,\\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\\n  CURLOPT_CUSTOMREQUEST => \\\"GET\\\",\\n  CURLOPT_POSTFIELDS => \\\"\\\",\\n  CURLOPT_HTTPHEADER => array(\\n    \\\"accept: application/json\\\",\\n    \\\"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\"\\n  ),\\n));\\n\\n$response = curl_exec($curl);\\n$err = curl_error($curl);\\n\\ncurl_close($curl);\\n\\nif ($err) {\\n  echo \\\"cURL Error #:\\\" . $err;\\n} else {\\n  echo $response;\\n}\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"require 'uri'\\nrequire 'net/http'\\n\\nurl = URI(\\\"https://api.infobip.com/sms/1/inbox/reports?limit=2\\\")\\n\\nhttp = Net::HTTP.new(url.host, url.port)\\nhttp.use_ssl = true\\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\\n\\nrequest = Net::HTTP::Get.new(url)\\nrequest[\\\"authorization\\\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\\nrequest[\\\"accept\\\"] = 'application/json'\\n\\nresponse = http.request(request)\\nputs response.read_body\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"import http.client\\n\\nconn = http.client.HTTPSConnection(\\\"api.infobip.com\\\")\\n\\nheaders = {\\n    'authorization': \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    'accept': \\\"application/json\\\"\\n    }\\n\\nconn.request(\\\"GET\\\", \\\"/sms/1/inbox/reports?limit=2\\\", headers=headers)\\n\\nres = conn.getresponse()\\ndata = res.read()\\n\\nprint(data.decode(\\\"utf-8\\\"))\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"HttpResponse<String> response = Unirest.get(\\\"https://api.infobip.com/sms/1/inbox/reports?limit=2\\\")\\n  .header(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\")\\n  .header(\\\"accept\\\", \\\"application/json\\\")\\n  .asString();\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"var client = new RestClient(\\\"https://api.infobip.com/sms/1/inbox/reports?limit=2\\\");\\n\\nvar request = new RestRequest(Method.GET);\\nrequest.AddHeader(\\\"accept\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\n\\nIRestResponse response = client.Execute(request);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"var data = null;\\n\\nvar xhr = new XMLHttpRequest();\\nxhr.withCredentials = true;\\n\\nxhr.addEventListener(\\\"readystatechange\\\", function () {\\n  if (this.readyState === this.DONE) {\\n    console.log(this.responseText);\\n  }\\n});\\n\\nxhr.open(\\\"GET\\\", \\\"https://api.infobip.com/sms/1/inbox/reports?limit=2\\\");\\nxhr.setRequestHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nxhr.setRequestHeader(\\\"accept\\\", \\\"application/json\\\");\\n\\nxhr.send(data);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe response will return a collection with only selected number of messages. The rest of the messages will be included in the next call you make.","excerpt":"This method allows you to pull received messages over API call.","slug":"pull-received-messages","type":"basic","title":"Receive SMS by Pull method"}

Receive SMS by Pull method

This method allows you to pull received messages over API call.

This tutorial will show you how to access messages sent by your customers. Before you proceed to implement this method, [**please read introduction**](/docs/receive-sms-introduction) on how to receive inbound messages where you can learn about numbers and initial setup. [block:callout] { "type": "info", "title": "", "body": "This tutorial covers accessing messages via Pull method. Besides Pull method, received messages can be forwarded to your application URL in real time. [Learn more about Forward method](/docs/forward-received-messages)." } [/block] Accessing your received messages in our system is pretty much straight forward. All you need to do is make simple API call which will return received messages. [block:callout] { "type": "warning", "title": "Important!", "body": "All received messages can be pulled **only once**! Once a certain message has been pulled by this method, it will not be available for the next API call. This means that every time you make an API call, you will receive **only new messages** that arrived since the last API call." } [/block] Request example [block:code] { "codes": [ { "code": "GET /sms/1/inbox/reports HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" }, { "code": "GET /sms/1/inbox/reports HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/xml", "language": "xml" }, { "code": "curl -X GET \\\n-H 'Accept: application/json' \\\n-H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\" \\\nhttps://api.infobip.com/sms/1/inbox/reports", "language": "curl" }, { "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"http://api.infobip.com/sms/1/inbox/reports\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_POSTFIELDS => \"\",\n CURLOPT_HTTPHEADER => array(\n \"accept: application/json\",\n \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}", "language": "php" }, { "code": "require 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.infobip.com/sms/1/inbox/reports\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"accept\"] = 'application/json'\n\nresponse = http.request(request)\nputs response.read_body", "language": "ruby" }, { "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"api.infobip.com\")\n\nheaders = {\n 'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n 'accept': \"application/json\"\n }\n\nconn.request(\"GET\", \"/sms/1/inbox/reports\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))", "language": "python" }, { "code": "HttpResponse<String> response = Unirest.get(\"https://api.infobip.com/sms/1/inbox/reports\")\n .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n .header(\"accept\", \"application/json\")\n .asString();", "language": "java" }, { "code": "var client = new RestClient(\"https://api.infobip.com/sms/1/inbox/reports\");\n\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\n\nIRestResponse response = client.Execute(request);", "language": "csharp" }, { "code": "var data = null;\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n if (this.readyState === this.DONE) {\n console.log(this.responseText);\n }\n});\n\nxhr.open(\"GET\", \"https://api.infobip.com/sms/1/inbox/reports\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\n\nxhr.send(data);", "language": "javascript" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"messageId\": \"817790313235066447\",\n \"from\": \"385916242493\",\n \"to\": \"385921004026\",\n \"text\": \"QUIZ Correct answer is Paris\",\n \"cleanText\": \"Correct answer is Paris\",\n \"keyword\": \"QUIZ\",\n \"receivedAt\": \"2016-10-06T09:28:39.220+0000\",\n \"smsCount\": 1,\n \"price\": {\n \"pricePerMessage\": 0,\n \"currency\": \"EUR\"\n },\n \"callbackData\": \"callbackData\"\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] # Response body parameters If successful, the response header HTTP status code will be `200 OK` and messages will be returned in the response body. If you try to get received messages without authorization, you will get a response with HTTP status code `401 Unauthorized`. ## SMSResponse |Parameter|Type|Description| |-|-|-| |*results*|[Messages[]](#messages)|Collection of reports, one per every received message.| |*messageCount*|Int|Number of returned messages in this request.| |*pendingMessageCount*|Int|Number of remaining new messages on our server ready to be returned in the next API call.| ### Messages |Parameter|Type|Description| |-|-|-| |*messageId*|String|The ID that uniquely identifies the received message.| |*from*|String|Sender ID that can be alphanumeric or numeric.| |*to*|String|The message destination address.| |*text*|String|Full text of the received message.| |*cleanText*|String|Text of received message without a keyword (if a keyword was sent).| |*keyword*|String|Keyword extracted from the message text.| |*receivedAt*|Date|Tells when Infobip platform received the message. It has the following format: `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`.| |*smsCount*|Int|The number of sent message segments.| |*pricePerMessage*|Decimal|Cost of receiving a message.| |*currency*|String|Currency of the message price.| |*callbackData*|int|Custom callback data can be inserted during setup phase.| [block:callout] { "type": "info", "title": "Keywords", "body": "Learn more about keywords and how to use them in [introduction](/docs/receive-sms-introduction)." } [/block] [block:api-header] { "type": "basic", "title": "Get limited number of messages" } [/block] You can limit the number of messages in one request by introducing `limit` parameter like this: ``` /sms/1/inbox/reports?limit=2 ``` **Request example:** [block:code] { "codes": [ { "code": "GET /sms/1/inbox/reports?limit=2 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" }, { "code": "GET /sms/1/inbox/reports?limit=2 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/xml", "language": "xml" }, { "code": "curl -X GET \n-H 'Accept: application/json' \n-H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\" \nhttps://api.infobip.com/sms/1/inbox/reports?limit=2", "language": "curl" }, { "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"http://api.infobip.com/sms/1/inbox/reports?limit=2\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_POSTFIELDS => \"\",\n CURLOPT_HTTPHEADER => array(\n \"accept: application/json\",\n \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\"\n ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n echo \"cURL Error #:\" . $err;\n} else {\n echo $response;\n}", "language": "php" }, { "code": "require 'uri'\nrequire 'net/http'\n\nurl = URI(\"https://api.infobip.com/sms/1/inbox/reports?limit=2\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"accept\"] = 'application/json'\n\nresponse = http.request(request)\nputs response.read_body", "language": "ruby" }, { "code": "import http.client\n\nconn = http.client.HTTPSConnection(\"api.infobip.com\")\n\nheaders = {\n 'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n 'accept': \"application/json\"\n }\n\nconn.request(\"GET\", \"/sms/1/inbox/reports?limit=2\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))", "language": "python" }, { "code": "HttpResponse<String> response = Unirest.get(\"https://api.infobip.com/sms/1/inbox/reports?limit=2\")\n .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n .header(\"accept\", \"application/json\")\n .asString();", "language": "java" }, { "code": "var client = new RestClient(\"https://api.infobip.com/sms/1/inbox/reports?limit=2\");\n\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\n\nIRestResponse response = client.Execute(request);", "language": "csharp" }, { "code": "var data = null;\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n if (this.readyState === this.DONE) {\n console.log(this.responseText);\n }\n});\n\nxhr.open(\"GET\", \"https://api.infobip.com/sms/1/inbox/reports?limit=2\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\n\nxhr.send(data);", "language": "javascript" } ] } [/block] The response will return a collection with only selected number of messages. The rest of the messages will be included in the next call you make.