{"_id":"551539c3c859ac2f0001b46b","category":{"_id":"54eb63b959b1172100334faf","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","pages":["54eb63b959b1172100334fb4","54eb63b959b1172100334fb5","54eb63b959b1172100334fb6","551539c3c859ac2f0001b46b","55153c3ac28d6125001b886d","55153e1fc859ac2f0001b470","5515424bc28d6125001b887b","55154597f854a3190036872d","551547cdbc466623002afe73","56c06e1ccfc5470d0018915d"],"__v":8,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-23T16:10:14.298Z","from_sync":false,"order":1,"slug":"getting-started","title":"Getting started"},"__v":46,"parentDoc":null,"project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"updates":["5623a25544fee51700b6fcfa","563f2bd6072b130d00472267","5935637c988102000fddf535","59439a7942db0e000f5fac5e"],"next":{"pages":[],"description":""},"createdAt":"2015-03-27T11:06:43.557Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"In a few simple steps, we will explain how to send an SMS using Infobip HTTP API. \n\nFirstly, you'll need a [valid Infobip account](http://www.infobip.com/en/get-started). \n\nNext, your username and password have to be encoded in `base64` like this:\n\n - Combine the username and password into a string `username:password`.\n - Encode the resulting string using Base64 encoder.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Example:\",\n  \"body\": \"Username: `Aladdin`\\nPassword: `openSesame`\\n\\nString: `Aladdin:openSesame`\\nBase64 encoded string: `QWxhZGRpbjpvcGVuU2VzYW1l`\"\n}\n[/block]\nThe message will be sent only to a valid phone number (numbers), written in **international format** e.g. `41793026727`.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"We strongly recommend using the [E.164 number formatting](http://en.wikipedia.org/wiki/E.164). E.164 numbers are internationally standardized to a fifteen digit maximum length. Phone numbers are usually prefixed with *+* (plus sign), followed by a *country code*, *network code* and the *subscriber number*. Phone numbers that are not  E.164 formatted may work, depending on the handset or network.\",\n  \"title\": \"Phone numbers format\"\n}\n[/block]\nNow, you are ready to create an HTTP POST request to `https://api.infobip.com/sms/1/text/single`\n\nYour **Header** should contain *authorization* and *content type*:\n\n- Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\n- Content-Type: application/json\n\n**Request body** contains the message you wish to send with `from`, `to` and `text` parameters.\n\nFull **JSON request** is shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /sms/1/text/single HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\nAccept: application/json\\n\\n{  \\n   \\\"from\\\":\\\"InfoSMS\\\",\\n   \\\"to\\\":\\\"41793026727\\\",\\n   \\\"text\\\":\\\"My first Infobip SMS\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThat's it! You should receive an SMS in a few moments.\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"To protect end-users from receiving duplicated or repeated information over a short period of time, our platform has a flooding filter enabled by default with predefined thresholds counteracting possible programming and service errors. If your application has legitimate reasons, during a testing period for instance, for submitting a substantial amount of messages towards distinct subscribers, please get in touch with our support team at [support:::at:::infobip.com](mailto:support@infobip.com) to discuss a suitable solution.\",\n  \"title\": \"Important:\"\n}\n[/block]\n----------\n\n\n### **Next:** [Handle Send SMS HTTP response](doc:send-sms-response)\n\nFor more information about sending SMS messages using Infobip SMS API, plus a full list of available features, visit the [Documentation page](http://dev.infobip.com/v1/docs/send-single-sms).","excerpt":"Send your first SMS using Infobip API!","slug":"send-sms","type":"basic","title":"Send SMS"}

Send SMS

Send your first SMS using Infobip API!

In a few simple steps, we will explain how to send an SMS using Infobip HTTP API. Firstly, you'll need a [valid Infobip account](http://www.infobip.com/en/get-started). Next, your username and password have to be encoded in `base64` like this: - Combine the username and password into a string `username:password`. - Encode the resulting string using Base64 encoder. [block:callout] { "type": "success", "title": "Example:", "body": "Username: `Aladdin`\nPassword: `openSesame`\n\nString: `Aladdin:openSesame`\nBase64 encoded string: `QWxhZGRpbjpvcGVuU2VzYW1l`" } [/block] The message will be sent only to a valid phone number (numbers), written in **international format** e.g. `41793026727`. [block:callout] { "type": "info", "body": "We strongly recommend using the [E.164 number formatting](http://en.wikipedia.org/wiki/E.164). E.164 numbers are internationally standardized to a fifteen digit maximum length. Phone numbers are usually prefixed with *+* (plus sign), followed by a *country code*, *network code* and the *subscriber number*. Phone numbers that are not E.164 formatted may work, depending on the handset or network.", "title": "Phone numbers format" } [/block] Now, you are ready to create an HTTP POST request to `https://api.infobip.com/sms/1/text/single` Your **Header** should contain *authorization* and *content type*: - Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== - Content-Type: application/json **Request body** contains the message you wish to send with `from`, `to` and `text` parameters. Full **JSON request** is shown below: [block:code] { "codes": [ { "code": "POST /sms/1/text/single HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\nAccept: application/json\n\n{ \n \"from\":\"InfoSMS\",\n \"to\":\"41793026727\",\n \"text\":\"My first Infobip SMS\"\n}", "language": "json" } ] } [/block] That's it! You should receive an SMS in a few moments. [block:callout] { "type": "warning", "body": "To protect end-users from receiving duplicated or repeated information over a short period of time, our platform has a flooding filter enabled by default with predefined thresholds counteracting possible programming and service errors. If your application has legitimate reasons, during a testing period for instance, for submitting a substantial amount of messages towards distinct subscribers, please get in touch with our support team at [support@infobip.com](mailto:support@infobip.com) to discuss a suitable solution.", "title": "Important:" } [/block] ---------- ### **Next:** [Handle Send SMS HTTP response](doc:send-sms-response) For more information about sending SMS messages using Infobip SMS API, plus a full list of available features, visit the [Documentation page](http://dev.infobip.com/v1/docs/send-single-sms).