{"_id":"551ba163944d6b2f00479d47","category":{"_id":"55154749c28d6125001b8885","__v":3,"pages":["551abac26491a10d0099943c","551ba163944d6b2f00479d47","551bc170c08a24210029d50e"],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-27T12:04:25.647Z","from_sync":false,"order":10,"slug":"number-context","title":"Number Lookup"},"user":"54eb4fdedf7add210007b29b","project":"54eb50e5615ffc1900305a16","editedParams":true,"editedParams2":true,"parentDoc":null,"version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"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","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"__v":5,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-01T07:42:27.762Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","examples":{"codes":[{"name":"","code":"POST /number/1/notify HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{  \n   \"to\":[  \n      \"41793026727\"\n   ],\n   \"notifyUrl\":\"http://example.com/notifyUrl\",\n   \"notifyContentType\":\"application/json\"\n}","language":"json"}]},"method":"post","results":{"codes":[{"status":200,"language":"json","code":"{  \n   \"results\":[  \n      {  \n         \"to\":\"41793026727\",\n         \"status\":{  \n            \"groupId\":1,\n            \"groupName\":\"PENDING\",\n            \"id\":3,\n            \"name\":\"PENDING_WAITING_DELIVERY\",\n            \"description\":\"Message sent, waiting for delivery report\"\n         },\n         \"messageId\":\"2b691c32-1233-4716-a763-4f70cc929eae\"\n      }\n   ]\n}","name":""}]},"auth":"required","params":[{"_id":"551baacfa669dd37002e7182","ref":"","in":"body","required":true,"desc":"Array of Number Lookup destination addresses. If the Number Lookup is requested for one phone number, a single String is supported instead of an Array. Destination addresses must be in international format (Example: 41793026727).","default":"","type":"array_string","name":"to"},{"_id":"551baacfa669dd37002e7181","ref":"","in":"body","required":false,"desc":"The URL on your call back server on which the Number Lookup response will be sent.","default":"","type":"string","name":"notifyUrl"},{"_id":"551baacfa669dd37002e7180","ref":"","in":"body","required":false,"desc":"Preferred content type of the response. Could be `application/json` or `application/xml`.","default":"","type":"string","name":"notifyContentType"}],"url":"/number/:version/notify"},"isReference":true,"order":2,"body":"# Response format\n\nIf successful, the response header HTTP status code will be `200 OK` and include Number Lookup information in the response body.\n\nIf you try to send a Number Lookup without authorization, you will get a response with the HTTP status code `401 Unauthorized`.\n\n## NCResponseAsync\n\n|Parameter|Type|Description|\n|-|-|-|\n|* bulkId*|String|The ID that uniquely identifies the request. Bulk ID will be received only when you send a [Number Lookup to more than one destination address](#number-context-lookup-multiple-phone-numbers).|\n|*results*|[NCResponseDetails](#section-ncresponsedetails)|Array of Number Lookup results, one per every phone number.|\n\n#### NCResponseDetails\n\n|Parameter|Type|Description|\n|-|-|-|\n|*to*|String|The Number Lookup destination address.|\n|*status*|[Status](#section-status)|Indicates whether the Number Lookup query was successfully executed, not executed or any other possible status.|\n|*messageId*|String|The ID that uniquely identifies the performed lookup on destination address.|\n\n#### Status\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.|\n|*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.|\n\n#### Error\n\n|Parameter|Type|Description|\n|-|-|-|\n|*groupId*|int|Error [group ID](http://dev.infobip.com/v1/docs/response-codes#error-object-example).|\n|*groupName*|String|Error [group name](http://dev.infobip.com/v1/docs/response-codes#error-object-example).|\n|*id*|int|Error [ID](http://dev.infobip.com/v1/docs/response-codes#error-object-example).|\n|*name*|String|Error [name](http://dev.infobip.com/v1/docs/response-codes#error-object-example).|\n|*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#error-object-example) of the error.|\n|*permanent*|boolean|Tells if the error [is permanent](http://dev.infobip.com/v1/docs/response-codes#error-object-example).|\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note:\",\n  \"body\": \"The result you will receive on your notify URL will be the same as the response in [Synchronous Number Lookup](http://dev.infobip.com/v1/docs/sending-synchronous-request#ncresponse), apart for the XML root name.\\n\\n[Various Number Lookup packages](http://dev.infobip.com/v1/docs/number-context) are available. Depending on your package, some information may not be accessible. For a package change, contact your Account Manager.\"\n}\n[/block]\n**The result format you will receive on notify URL:**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{  \\n   \\\"results\\\":[  \\n      {  \\n         \\\"to\\\":\\\"41793026727\\\",\\n         \\\"mccMnc\\\":\\\"22801\\\",\\n         \\\"originalNetwork\\\":{  \\n            \\\"networkPrefix\\\":\\\"79\\\",\\n            \\\"countryPrefix\\\":\\\"41\\\"\\n         },\\n         \\\"ported\\\":false,\\n         \\\"roaming\\\":false,\\n         \\\"status\\\":{  \\n            \\\"groupId\\\":2,\\n            \\\"groupName\\\":\\\"UNDELIVERABLE\\\",\\n            \\\"id\\\":9,\\n            \\\"name\\\":\\\"UNDELIVERABLE_NOT_DELIVERED\\\",\\n            \\\"description\\\":\\\"Message sent not delivered\\\"\\n         },\\n         \\\"error\\\":{  \\n            \\\"groupId\\\":1,\\n            \\\"groupName\\\":\\\"HANDSET_ERRORS\\\",\\n            \\\"id\\\":27,\\n            \\\"name\\\":\\\"EC_ABSENT_SUBSCRIBER\\\",\\n            \\\"description\\\":\\\"Absent Subscriber\\\",\\n            \\\"permanent\\\":false\\n         }\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"<reportResponse>\\n   <results>\\n      <result>\\n         <to>41793026727</to>\\n         <mccMnc>22801</mccMnc>\\n         <originalNetwork>\\n            <networkPrefix>79</networkPrefix>\\n            <countryPrefix>41</countryPrefix>\\n         </originalNetwork>\\n         <ported>false</ported>\\n         <roaming>false</roaming>\\n         <status>\\n            <groupId>2</groupId>\\n            <groupName>UNDELIVERABLE</groupName>\\n            <id>9</id>\\n            <name>UNDELIVERABLE_NOT_DELIVERED</name>\\n            <description>Message sent not delivered</description>\\n         </status>\\n         <error>\\n            <groupId>1</groupId>\\n            <groupName>HANDSET_ERRORS</groupName>\\n            <id>27</id>\\n            <name>EC_ABSENT_SUBSCRIBER</name>\\n            <description>Absent Subscriber</description>\\n            <permanent>false</permanent>\\n         </error>\\n      </result>\\n   </results>\\n</reportResponse>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important:\",\n  \"body\": \"When sending Number Lookup to multiple destinations, we will process your request immediately. In the response you will receive status information for every destination address, whether it is ok or not. Please see [the example](#section-number-context-lookup-multiple-phone-numbers) below.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Additional examples\"\n}\n[/block]\n# Number Lookup - Single phone number\n\n**Request**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /number/1/notify HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n   \\\"to\\\":[  \\n      \\\"41793026727\\\"\\n   ],\\n   \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\n   \\\"notifyContentType\\\":\\\"application/json\\\"\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"POST /number/1/notify HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/xml\\nAccept: application/xml\\n\\n<request>\\n   <to>41793026727</to>\\n   <notifyUrl>http://example.com/notifyUrl</notifyUrl>\\n   <notifyContentType>application/xml</notifyContentType>\\n</request> \",\n      \"language\": \"xml\"\n    },\n    {\n      \"code\": \"curl -X POST \\\\\\n-H \\\"Content-Type: application/json\\\" \\\\\\n-H 'Accept: application/json' \\\\\\n-H \\\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=\\\" \\\\\\n-d '{  \\n   \\\"to\\\":[  \\n      \\\"41793026727\\\"\\n   ],\\n   \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\n   \\\"notifyContentType\\\":\\\"application/json\\\"\\n}' https://api.infobip.com/number/1/notify\",\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/number/1/notify\\\",\\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 => \\\"POST\\\",\\n  CURLOPT_POSTFIELDS => \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\"],\\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\",\\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\",\\n  CURLOPT_HTTPHEADER => array(\\n    \\\"accept: application/json\\\",\\n    \\\"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    \\\"content-type: application/json\\\"\\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/number/1/notify\\\")\\n\\nhttp = Net::HTTP.new(url.host, url.port)\\nhttp.use_ssl = true\\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\\n\\nrequest = Net::HTTP::Post.new(url)\\nrequest[\\\"authorization\\\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\\nrequest[\\\"accept\\\"] = 'application/json'\\nrequest[\\\"content-type\\\"] = 'application/json'\\n\\nrequest.body = \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"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\\npayload = \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\"\\n\\nheaders = {\\n    'authorization': \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    'accept': \\\"application/json\\\",\\n    'content-type': \\\"application/json\\\"\\n    }\\n\\nconn.request(\\\"POST\\\", \\\"/number/1/notify\\\", payload, 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.post(\\\"https://api.infobip.com/number/1/notify\\\")\\n  .header(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\")\\n  .header(\\\"accept\\\", \\\"application/json\\\")\\n  .header(\\\"content-type\\\", \\\"application/json\\\")\\n  .body(\\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\")\\n  .asString();\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"var client = new RestClient(\\\"https://api.infobip.com/number/1/notify\\\");\\n\\nvar request = new RestRequest(Method.POST);\\nrequest.AddHeader(\\\"content-type\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"accept\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nrequest.AddParameter(\\\"application/json\\\", \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\", ParameterType.RequestBody);\\n\\nIRestResponse response = client.Execute(request);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"var data = JSON.stringify({\\n  \\\"to\\\": [\\n    \\\"41793026727\\\"\\n  ],\\n  \\\"notifyUrl\\\": \\\"http://example.com/notifyUrl\\\",\\n  \\\"notifyContentType\\\": \\\"application/json\\\"\\n});\\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(\\\"POST\\\", \\\"https://api.infobip.com/number/1/notify\\\");\\nxhr.setRequestHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nxhr.setRequestHeader(\\\"accept\\\", \\\"application/json\\\");\\nxhr.setRequestHeader(\\\"content-type\\\", \\\"application/json\\\");\\n\\nxhr.send(data);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**Response**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/json\\n\\n{  \\n   \\\"results\\\":[  \\n      {  \\n         \\\"to\\\":\\\"41793026727\\\",\\n         \\\"status\\\":{  \\n            \\\"groupId\\\":1,\\n            \\\"groupName\\\":\\\"PENDING\\\",\\n            \\\"id\\\":3,\\n            \\\"name\\\":\\\"PENDING_WAITING_DELIVERY\\\",\\n            \\\"description\\\":\\\"Message sent, waiting for delivery report\\\"\\n         },\\n         \\\"messageId\\\":\\\"2b691c32-1233-4716-a763-4f70cc929eae\\\"\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/xml\\n\\n<ncResponseAsync>\\n   <results>\\n      <result>\\n         <to>41793026727</to>\\n         <status>\\n            <groupId>1</groupId>\\n            <groupName>PENDING</groupName>\\n            <id>3</id>\\n            <name>PENDING_WAITING_DELIVERY</name>\\n            <description>Message sent, waiting for delivery report</description>\\n         </status>\\n         <messageId>2b691c32-1233-4716-a763-4f70cc929eae</messageId>\\n      </result>\\n   </results>\\n</ncResponseAsync>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n# Number Lookup - Multiple phone numbers\n\n**Request**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /number/1/notify HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n   \\\"to\\\":[  \\n      \\\"41793026727\\\",\\n      \\\"12345678\\\",\\n      \\\"Alphanumeric\\\"\\n   ],\\n   \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\n   \\\"notifyContentType\\\":\\\"application/json\\\"\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"POST /number/1/notify HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/xml\\nAccept: application/xml\\n\\n<request>\\n   <to>\\n      <to>41793026727</to>\\n      <to>12345678</to>\\n      <to>Alphanumeric</to>\\n   </to>\\n   <notifyUrl>http://example.com/notifyUrl</notifyUrl>\\n   <notifyContentType>application/xml</notifyContentType>\\n</request>\",\n      \"language\": \"xml\"\n    },\n    {\n      \"code\": \"curl -X POST \\n-H \\\"Content-Type: application/json\\\" \\n-H 'Accept: application/json' \\n-H \\\"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=\\\" \\n-d '{  \\n   \\\"to\\\":[  \\n      \\\"41793026727\\\",\\n      \\\"12345678\\\",\\n      \\\"Alphanumeric\\\"\\n   ],\\n   \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\n   \\\"notifyContentType\\\":\\\"application/json\\\"\\n}' https://api.infobip.com/number/1/notify\",\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/number/1/notify\\\",\\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 => \\\"POST\\\",\\n  CURLOPT_POSTFIELDS => \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\",\\\\\\\"12345678\\\\\\\",\\\\\\\"Alphanumeric\\\\\\\"],\\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\",\\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\",\\n  CURLOPT_HTTPHEADER => array(\\n    \\\"accept: application/json\\\",\\n    \\\"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    \\\"content-type: application/json\\\"\\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/number/1/notify\\\")\\n\\nhttp = Net::HTTP.new(url.host, url.port)\\nhttp.use_ssl = true\\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\\n\\nrequest = Net::HTTP::Post.new(url)\\nrequest[\\\"authorization\\\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\\nrequest[\\\"accept\\\"] = 'application/json'\\nrequest[\\\"content-type\\\"] = 'application/json'\\n\\nrequest.body = \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\", \\\\\\\"12345678\\\\\\\", \\\\\\\"Alphanumeric\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"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\\npayload = \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\", \\\\\\\"12345678\\\\\\\", \\\\\\\"Alphanumeric\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\"\\n\\nheaders = {\\n    'authorization': \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\",\\n    'accept': \\\"application/json\\\",\\n    'content-type': \\\"application/json\\\"\\n    }\\n\\nconn.request(\\\"POST\\\", \\\"/number/1/notify\\\", payload, 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.post(\\\"https://api.infobip.com/number/1/notify\\\")\\n  .header(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\")\\n  .header(\\\"accept\\\", \\\"application/json\\\")\\n  .header(\\\"content-type\\\", \\\"application/json\\\")\\n  .body(\\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\", \\\\\\\"12345678\\\\\\\", \\\\\\\"Alphanumeric\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\")\\n  .asString();\",\n      \"language\": \"java\"\n    },\n    {\n      \"code\": \"var client = new RestClient(\\\"https://api.infobip.com/number/1/notify\\\");\\n\\nvar request = new RestRequest(Method.POST);\\nrequest.AddHeader(\\\"content-type\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"accept\\\", \\\"application/json\\\");\\nrequest.AddHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nrequest.AddParameter(\\\"application/json\\\", \\\"{\\\\\\\"to\\\\\\\":[\\\\\\\"41793026727\\\\\\\", \\\\\\\"12345678\\\\\\\", \\\\\\\"Alphanumeric\\\\\\\"], \\\\\\\"notifyUrl\\\\\\\":\\\\\\\"http://example.com/notifyUrl\\\\\\\", \\\\\\\"notifyContentType\\\\\\\":\\\\\\\"application/json\\\\\\\"}\\\", ParameterType.RequestBody);\\n\\nIRestResponse response = client.Execute(request);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"var data = JSON.stringify({\\n  \\\"to\\\": [\\n    \\\"41793026727\\\",\\n    \\\"12345678\\\",\\n    \\\"Alphanumeric\\\"\\n  ],\\n  \\\"notifyUrl\\\": \\\"http://example.com/notifyUrl\\\",\\n  \\\"notifyContentType\\\": \\\"application/json\\\"\\n});\\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(\\\"POST\\\", \\\"https://api.infobip.com/number/1/notify\\\");\\nxhr.setRequestHeader(\\\"authorization\\\", \\\"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\\");\\nxhr.setRequestHeader(\\\"accept\\\", \\\"application/json\\\");\\nxhr.setRequestHeader(\\\"content-type\\\", \\\"application/json\\\");\\n\\nxhr.send(data);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**Response**\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/json\\n\\n{  \\n   \\\"bulkId\\\":\\\"f5c4322c-10e7-a41e-5528-34fa0b032134\\\",\\n   \\\"results\\\":[  \\n      {  \\n         \\\"to\\\":\\\"41793026727\\\",\\n         \\\"status\\\":{  \\n            \\\"groupId\\\":1,\\n            \\\"groupName\\\":\\\"PENDING\\\",\\n            \\\"id\\\":7,\\n            \\\"name\\\":\\\"PENDING_ENROUTE\\\",\\n            \\\"description\\\":\\\"Message sent to next instance\\\"\\n         },\\n         \\\"messageId\\\":\\\"c2598a78-ba88-423f-8ac3-5dac4af816cf\\\"\\n      },\\n      {  \\n         \\\"to\\\":\\\"12345678\\\",\\n         \\\"status\\\":{  \\n            \\\"groupId\\\":5,\\n            \\\"groupName\\\":\\\"REJECTED\\\",\\n            \\\"id\\\":14,\\n            \\\"name\\\":\\\"REJECTED_DESTINATION\\\",\\n            \\\"description\\\":\\\"By Destination\\\",\\n            \\\"action\\\":\\\"Remove destination from blacklist\\\"\\n         },\\n         \\\"messageId\\\":\\\"a70437bc-872c-5462-837a-4ede899af3bf\\\"\\n      },\\n      {  \\n         \\\"to\\\":\\\"Alphanumeric\\\",\\n         \\\"status\\\":{  \\n            \\\"groupId\\\":5,\\n            \\\"groupName\\\":\\\"REJECTED\\\",\\n            \\\"id\\\":52,\\n            \\\"name\\\":\\\"REJECTED_DESTINATION\\\",\\n            \\\"description\\\":\\\"Invalid destination address.\\\",\\n            \\\"action\\\":\\\"Check to parameter.\\\"\\n         }\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    },\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/xml\\n\\n<ncResponseAsync>\\n   <bulkId>f5c4322c-10e7-a41e-5528-34fat43er4134</bulkId>\\n   <results>\\n      <result>\\n         <to>41793026727</to>\\n         <status>\\n            <groupId>1</groupId>\\n            <groupName>Pending</groupName>\\n            <id>3</id>\\n            <name>PENDING_WAITING_DELIVERY</name>\\n            <description>Message sent, waiting for delivery report</description>\\n         </status>\\n         <messageId>c2598a78-ba88-423f-8ac3-5dac4af816cf</messageId>\\n      </result>\\n      <result>\\n         <to>12345678</to>\\n         <status>\\n            <groupId>5</groupId>\\n            <groupName>REJECTED</groupName>\\n            <id>14</id>\\n            <name>REJECTED_DESTINATION</name>\\n            <description>By Destination</description>\\n            <action>Remove destination from blacklist</action>\\n         </status>\\n         <messageId>a70437bc-872c-5462-837a-4ede899af3bf</messageId>\\n      </result>\\n      <result>\\n         <to>Alphanumeric</to>\\n         <status>\\n            <groupId>5</groupId>\\n            <groupName>REJECTED</groupName>\\n            <id>52</id>\\n            <name>REJECTED_DESTINATION</name>\\n            <description>Invalid destination address.</description>\\n            <action>Check to parameter.</action>\\n         </status>\\n      </result>\\n   </results>\\n</ncResponseAsync>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n# Async NC results push retry cycle\n\nIf your Notify URL is unavailable for any reason, forward attempts will be made according to formula: `1min + (1min * <retryNumber/> * <retryNumber/>)`. Examples for first few retry attempts are shown in the table below. Maximum number of retries is 20, i.e. the last retry will be done 41:30h after the initial one. If your URL is not available for the entire time, NC results will not be available to you.\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"**0**\",\n    \"0-1\": \"1min\",\n    \"0-2\": \"00:01h\",\n    \"1-0\": \"**1**\",\n    \"1-1\": \"2min\",\n    \"1-2\": \"00:03h\",\n    \"2-0\": \"**2**\",\n    \"2-1\": \"5min\",\n    \"2-2\": \"00:08h\",\n    \"3-0\": \"**3**\",\n    \"3-1\": \"10min\",\n    \"3-2\": \"00:18h\",\n    \"4-0\": \"**4**\",\n    \"4-1\": \"17min\",\n    \"4-2\": \"00:35h\",\n    \"5-0\": \"**5**\",\n    \"5-1\": \"26min\",\n    \"5-2\": \"01:01h\"\n  },\n  \"cols\": 3,\n  \"rows\": 6\n}\n[/block]","excerpt":"This method gives you the ability to make an asynchronous Number Lookup request over HTTP. Number Lookup response is sent to a notify URL at your call back server.\n\nThis API method is designed for batch numbers processing, to validate large amounts of phone numbers. One example use-case would be validating previously collected numbers from a database.","slug":"send-asynchronous-request","type":"endpoint","title":"Asynchronous request"}

postAsynchronous request

This method gives you the ability to make an asynchronous Number Lookup request over HTTP. Number Lookup response is sent to a notify URL at your call back server. This API method is designed for batch numbers processing, to validate large amounts of phone numbers. One example use-case would be validating previously collected numbers from a database.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

to:
required
array of strings
Array of Number Lookup destination addresses. If the Number Lookup is requested for one phone number, a single String is supported instead of an Array. Destination addresses must be in international format (Example: 41793026727).
notifyUrl:
string
The URL on your call back server on which the Number Lookup response will be sent.
notifyContentType:
string
Preferred content type of the response. Could be `application/json` or `application/xml`.

Examples


Result Format


Documentation

# Response format If successful, the response header HTTP status code will be `200 OK` and include Number Lookup information in the response body. If you try to send a Number Lookup without authorization, you will get a response with the HTTP status code `401 Unauthorized`. ## NCResponseAsync |Parameter|Type|Description| |-|-|-| |* bulkId*|String|The ID that uniquely identifies the request. Bulk ID will be received only when you send a [Number Lookup to more than one destination address](#number-context-lookup-multiple-phone-numbers).| |*results*|[NCResponseDetails](#section-ncresponsedetails)|Array of Number Lookup results, one per every phone number.| #### NCResponseDetails |Parameter|Type|Description| |-|-|-| |*to*|String|The Number Lookup destination address.| |*status*|[Status](#section-status)|Indicates whether the Number Lookup query was successfully executed, not executed or any other possible status.| |*messageId*|String|The ID that uniquely identifies the performed lookup on destination address.| #### Status |Parameter|Type|Description| |-|-|-| |*groupId*|int|Status [group ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*groupName*|String|Status [group name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*id*|int|Status [ID](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*name*|String|Status [name](http://dev.infobip.com/v1/docs/response-codes#status-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#status-object-example) of the status.| |*action*|String|[Action](http://dev.infobip.com/v1/docs/response-codes#status-object-example) that should be taken to eliminate the error.| #### Error |Parameter|Type|Description| |-|-|-| |*groupId*|int|Error [group ID](http://dev.infobip.com/v1/docs/response-codes#error-object-example).| |*groupName*|String|Error [group name](http://dev.infobip.com/v1/docs/response-codes#error-object-example).| |*id*|int|Error [ID](http://dev.infobip.com/v1/docs/response-codes#error-object-example).| |*name*|String|Error [name](http://dev.infobip.com/v1/docs/response-codes#error-object-example).| |*description*|String|Human readable [description](http://dev.infobip.com/v1/docs/response-codes#error-object-example) of the error.| |*permanent*|boolean|Tells if the error [is permanent](http://dev.infobip.com/v1/docs/response-codes#error-object-example).| [block:callout] { "type": "info", "title": "Note:", "body": "The result you will receive on your notify URL will be the same as the response in [Synchronous Number Lookup](http://dev.infobip.com/v1/docs/sending-synchronous-request#ncresponse), apart for the XML root name.\n\n[Various Number Lookup packages](http://dev.infobip.com/v1/docs/number-context) are available. Depending on your package, some information may not be accessible. For a package change, contact your Account Manager." } [/block] **The result format you will receive on notify URL:** [block:code] { "codes": [ { "code": "{ \n \"results\":[ \n { \n \"to\":\"41793026727\",\n \"mccMnc\":\"22801\",\n \"originalNetwork\":{ \n \"networkPrefix\":\"79\",\n \"countryPrefix\":\"41\"\n },\n \"ported\":false,\n \"roaming\":false,\n \"status\":{ \n \"groupId\":2,\n \"groupName\":\"UNDELIVERABLE\",\n \"id\":9,\n \"name\":\"UNDELIVERABLE_NOT_DELIVERED\",\n \"description\":\"Message sent not delivered\"\n },\n \"error\":{ \n \"groupId\":1,\n \"groupName\":\"HANDSET_ERRORS\",\n \"id\":27,\n \"name\":\"EC_ABSENT_SUBSCRIBER\",\n \"description\":\"Absent Subscriber\",\n \"permanent\":false\n }\n }\n ]\n}", "language": "json" }, { "code": "<reportResponse>\n <results>\n <result>\n <to>41793026727</to>\n <mccMnc>22801</mccMnc>\n <originalNetwork>\n <networkPrefix>79</networkPrefix>\n <countryPrefix>41</countryPrefix>\n </originalNetwork>\n <ported>false</ported>\n <roaming>false</roaming>\n <status>\n <groupId>2</groupId>\n <groupName>UNDELIVERABLE</groupName>\n <id>9</id>\n <name>UNDELIVERABLE_NOT_DELIVERED</name>\n <description>Message sent not delivered</description>\n </status>\n <error>\n <groupId>1</groupId>\n <groupName>HANDSET_ERRORS</groupName>\n <id>27</id>\n <name>EC_ABSENT_SUBSCRIBER</name>\n <description>Absent Subscriber</description>\n <permanent>false</permanent>\n </error>\n </result>\n </results>\n</reportResponse>", "language": "xml" } ] } [/block] [block:callout] { "type": "warning", "title": "Important:", "body": "When sending Number Lookup to multiple destinations, we will process your request immediately. In the response you will receive status information for every destination address, whether it is ok or not. Please see [the example](#section-number-context-lookup-multiple-phone-numbers) below." } [/block] [block:api-header] { "type": "basic", "title": "Additional examples" } [/block] # Number Lookup - Single phone number **Request** [block:code] { "codes": [ { "code": "POST /number/1/notify HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"to\":[ \n \"41793026727\"\n ],\n \"notifyUrl\":\"http://example.com/notifyUrl\",\n \"notifyContentType\":\"application/json\"\n}", "language": "json" }, { "code": "POST /number/1/notify HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/xml\nAccept: application/xml\n\n<request>\n <to>41793026727</to>\n <notifyUrl>http://example.com/notifyUrl</notifyUrl>\n <notifyContentType>application/xml</notifyContentType>\n</request> ", "language": "xml" }, { "code": "curl -X POST \\\n-H \"Content-Type: application/json\" \\\n-H 'Accept: application/json' \\\n-H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=\" \\\n-d '{ \n \"to\":[ \n \"41793026727\"\n ],\n \"notifyUrl\":\"http://example.com/notifyUrl\",\n \"notifyContentType\":\"application/json\"\n}' https://api.infobip.com/number/1/notify", "language": "curl" }, { "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"http://api.infobip.com/number/1/notify\",\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 => \"POST\",\n CURLOPT_POSTFIELDS => \"{\\\"to\\\":[\\\"41793026727\\\"],\\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\\"notifyContentType\\\":\\\"application/json\\\"}\",\n CURLOPT_HTTPHEADER => array(\n \"accept: application/json\",\n \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n \"content-type: application/json\"\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/number/1/notify\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"accept\"] = 'application/json'\nrequest[\"content-type\"] = 'application/json'\n\nrequest.body = \"{\\\"to\\\":[\\\"41793026727\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"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\npayload = \"{\\\"to\\\":[\\\"41793026727\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\"\n\nheaders = {\n 'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n 'accept': \"application/json\",\n 'content-type': \"application/json\"\n }\n\nconn.request(\"POST\", \"/number/1/notify\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))", "language": "python" }, { "code": "HttpResponse<String> response = Unirest.post(\"https://api.infobip.com/number/1/notify\")\n .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n .header(\"accept\", \"application/json\")\n .header(\"content-type\", \"application/json\")\n .body(\"{\\\"to\\\":[\\\"41793026727\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\")\n .asString();", "language": "java" }, { "code": "var client = new RestClient(\"https://api.infobip.com/number/1/notify\");\n\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nrequest.AddParameter(\"application/json\", \"{\\\"to\\\":[\\\"41793026727\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\", ParameterType.RequestBody);\n\nIRestResponse response = client.Execute(request);", "language": "csharp" }, { "code": "var data = JSON.stringify({\n \"to\": [\n \"41793026727\"\n ],\n \"notifyUrl\": \"http://example.com/notifyUrl\",\n \"notifyContentType\": \"application/json\"\n});\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(\"POST\", \"https://api.infobip.com/number/1/notify\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);", "language": "javascript" } ] } [/block] **Response** [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{ \n \"results\":[ \n { \n \"to\":\"41793026727\",\n \"status\":{ \n \"groupId\":1,\n \"groupName\":\"PENDING\",\n \"id\":3,\n \"name\":\"PENDING_WAITING_DELIVERY\",\n \"description\":\"Message sent, waiting for delivery report\"\n },\n \"messageId\":\"2b691c32-1233-4716-a763-4f70cc929eae\"\n }\n ]\n}", "language": "json" }, { "code": "HTTP/1.1 200 OK\nContent-Type: application/xml\n\n<ncResponseAsync>\n <results>\n <result>\n <to>41793026727</to>\n <status>\n <groupId>1</groupId>\n <groupName>PENDING</groupName>\n <id>3</id>\n <name>PENDING_WAITING_DELIVERY</name>\n <description>Message sent, waiting for delivery report</description>\n </status>\n <messageId>2b691c32-1233-4716-a763-4f70cc929eae</messageId>\n </result>\n </results>\n</ncResponseAsync>", "language": "xml" } ] } [/block] # Number Lookup - Multiple phone numbers **Request** [block:code] { "codes": [ { "code": "POST /number/1/notify HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"to\":[ \n \"41793026727\",\n \"12345678\",\n \"Alphanumeric\"\n ],\n \"notifyUrl\":\"http://example.com/notifyUrl\",\n \"notifyContentType\":\"application/json\"\n}", "language": "json" }, { "code": "POST /number/1/notify HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/xml\nAccept: application/xml\n\n<request>\n <to>\n <to>41793026727</to>\n <to>12345678</to>\n <to>Alphanumeric</to>\n </to>\n <notifyUrl>http://example.com/notifyUrl</notifyUrl>\n <notifyContentType>application/xml</notifyContentType>\n</request>", "language": "xml" }, { "code": "curl -X POST \n-H \"Content-Type: application/json\" \n-H 'Accept: application/json' \n-H \"Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=\" \n-d '{ \n \"to\":[ \n \"41793026727\",\n \"12345678\",\n \"Alphanumeric\"\n ],\n \"notifyUrl\":\"http://example.com/notifyUrl\",\n \"notifyContentType\":\"application/json\"\n}' https://api.infobip.com/number/1/notify", "language": "curl" }, { "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"http://api.infobip.com/number/1/notify\",\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 => \"POST\",\n CURLOPT_POSTFIELDS => \"{\\\"to\\\":[\\\"41793026727\\\",\\\"12345678\\\",\\\"Alphanumeric\\\"],\\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\",\\\"notifyContentType\\\":\\\"application/json\\\"}\",\n CURLOPT_HTTPHEADER => array(\n \"accept: application/json\",\n \"authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n \"content-type: application/json\"\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/number/1/notify\")\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\nhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"authorization\"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='\nrequest[\"accept\"] = 'application/json'\nrequest[\"content-type\"] = 'application/json'\n\nrequest.body = \"{\\\"to\\\":[\\\"41793026727\\\", \\\"12345678\\\", \\\"Alphanumeric\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"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\npayload = \"{\\\"to\\\":[\\\"41793026727\\\", \\\"12345678\\\", \\\"Alphanumeric\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\"\n\nheaders = {\n 'authorization': \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n 'accept': \"application/json\",\n 'content-type': \"application/json\"\n }\n\nconn.request(\"POST\", \"/number/1/notify\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))", "language": "python" }, { "code": "HttpResponse<String> response = Unirest.post(\"https://api.infobip.com/number/1/notify\")\n .header(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\")\n .header(\"accept\", \"application/json\")\n .header(\"content-type\", \"application/json\")\n .body(\"{\\\"to\\\":[\\\"41793026727\\\", \\\"12345678\\\", \\\"Alphanumeric\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\")\n .asString();", "language": "java" }, { "code": "var client = new RestClient(\"https://api.infobip.com/number/1/notify\");\n\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddHeader(\"accept\", \"application/json\");\nrequest.AddHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nrequest.AddParameter(\"application/json\", \"{\\\"to\\\":[\\\"41793026727\\\", \\\"12345678\\\", \\\"Alphanumeric\\\"], \\\"notifyUrl\\\":\\\"http://example.com/notifyUrl\\\", \\\"notifyContentType\\\":\\\"application/json\\\"}\", ParameterType.RequestBody);\n\nIRestResponse response = client.Execute(request);", "language": "csharp" }, { "code": "var data = JSON.stringify({\n \"to\": [\n \"41793026727\",\n \"12345678\",\n \"Alphanumeric\"\n ],\n \"notifyUrl\": \"http://example.com/notifyUrl\",\n \"notifyContentType\": \"application/json\"\n});\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(\"POST\", \"https://api.infobip.com/number/1/notify\");\nxhr.setRequestHeader(\"authorization\", \"Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\");\nxhr.setRequestHeader(\"accept\", \"application/json\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);", "language": "javascript" } ] } [/block] **Response** [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{ \n \"bulkId\":\"f5c4322c-10e7-a41e-5528-34fa0b032134\",\n \"results\":[ \n { \n \"to\":\"41793026727\",\n \"status\":{ \n \"groupId\":1,\n \"groupName\":\"PENDING\",\n \"id\":7,\n \"name\":\"PENDING_ENROUTE\",\n \"description\":\"Message sent to next instance\"\n },\n \"messageId\":\"c2598a78-ba88-423f-8ac3-5dac4af816cf\"\n },\n { \n \"to\":\"12345678\",\n \"status\":{ \n \"groupId\":5,\n \"groupName\":\"REJECTED\",\n \"id\":14,\n \"name\":\"REJECTED_DESTINATION\",\n \"description\":\"By Destination\",\n \"action\":\"Remove destination from blacklist\"\n },\n \"messageId\":\"a70437bc-872c-5462-837a-4ede899af3bf\"\n },\n { \n \"to\":\"Alphanumeric\",\n \"status\":{ \n \"groupId\":5,\n \"groupName\":\"REJECTED\",\n \"id\":52,\n \"name\":\"REJECTED_DESTINATION\",\n \"description\":\"Invalid destination address.\",\n \"action\":\"Check to parameter.\"\n }\n }\n ]\n}", "language": "json" }, { "code": "HTTP/1.1 200 OK\nContent-Type: application/xml\n\n<ncResponseAsync>\n <bulkId>f5c4322c-10e7-a41e-5528-34fat43er4134</bulkId>\n <results>\n <result>\n <to>41793026727</to>\n <status>\n <groupId>1</groupId>\n <groupName>Pending</groupName>\n <id>3</id>\n <name>PENDING_WAITING_DELIVERY</name>\n <description>Message sent, waiting for delivery report</description>\n </status>\n <messageId>c2598a78-ba88-423f-8ac3-5dac4af816cf</messageId>\n </result>\n <result>\n <to>12345678</to>\n <status>\n <groupId>5</groupId>\n <groupName>REJECTED</groupName>\n <id>14</id>\n <name>REJECTED_DESTINATION</name>\n <description>By Destination</description>\n <action>Remove destination from blacklist</action>\n </status>\n <messageId>a70437bc-872c-5462-837a-4ede899af3bf</messageId>\n </result>\n <result>\n <to>Alphanumeric</to>\n <status>\n <groupId>5</groupId>\n <groupName>REJECTED</groupName>\n <id>52</id>\n <name>REJECTED_DESTINATION</name>\n <description>Invalid destination address.</description>\n <action>Check to parameter.</action>\n </status>\n </result>\n </results>\n</ncResponseAsync>", "language": "xml" } ] } [/block] # Async NC results push retry cycle If your Notify URL is unavailable for any reason, forward attempts will be made according to formula: `1min + (1min * <retryNumber/> * <retryNumber/>)`. Examples for first few retry attempts are shown in the table below. Maximum number of retries is 20, i.e. the last retry will be done 41:30h after the initial one. If your URL is not available for the entire time, NC results will not be available to you. [block:parameters] { "data": { "0-0": "**0**", "0-1": "1min", "0-2": "00:01h", "1-0": "**1**", "1-1": "2min", "1-2": "00:03h", "2-0": "**2**", "2-1": "5min", "2-2": "00:08h", "3-0": "**3**", "3-1": "10min", "3-2": "00:18h", "4-0": "**4**", "4-1": "17min", "4-2": "00:35h", "5-0": "**5**", "5-1": "26min", "5-2": "01:01h" }, "cols": 3, "rows": 6 } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}