{"_id":"58b53d85f429b31900eb5910","user":"54eb4fdedf7add210007b29b","__v":0,"category":{"_id":"551546edbc466623002afe72","pages":["551549c0bc466623002afe76","55154afbc859ac2f0001b486","55154daec859ac2f0001b48b","55154f36bc466623002afe7c","551550c5e68daa2f00cff84c","551551d4f854a31900368737","551552e7c859ac2f0001b494","551be4e3a0ee622b0087f69e","5527acc447b71d0d0044e6cd","552f84ad633a5b0d00e99daf","5537533df162750d00bbf7d0","554b3ffd6b448d0d00646d79","55506416fa289c0d0075e4f0","5550aaea00420e0d00d13113","55545865b450630d00041d80","55546906f9a7871700ef8e3c","555c4bf87e271d0d00f3c8c4","5564318c1fa8002300ea4bb0","556ffbd5910c090d00c432b6","557019f4cc189a21001ab258","55703aefcc189a21001ab2a3","5575a3c60b81dc230069c910","558ab69575eaf50d004e4cf3","55b0b41fb3171b3700b1539a","55ba2e48d72d1e1900276ac1","55ba45c804775a2f00628101","55c0b789344dc40d00f55933","55c0b8c837298d0d00088d88","55c0c095344dc40d00f55960","55d43e05b49ab11900328e2e","55d72c8c60fc730d00fc2738","55e6c564d678ad17001589ac","55e9b7780c9b420d0042b275","55f7cf2de32e9b0d00a2d4b6","56094efea7b2590d0089eb95","5613cdbeecbebc21003fa179","5613d8de6a092921004c30b8","5613de7c443514170060dbb6","5613e02823ecf6350009eefc","5613e4271db46e2100e142ad","5614d73c8113d20d00082e3e","561e11ae50e0a62100955946","561e2008efcf8217003adf77","5620f184b244890d001868e0","5620feb740e2c30d0002a899","562105ce40e2c30d0002a8a3","56210b3340e2c30d0002a8b3","56210c74b244890d0018690e","56249a0372ac510d00e49149","56249df185a31117001c53de","56249f0c85a31117001c53e1","5624a9e7c4bf501700bc5ec8","5624b29806e8040d005ed6a0","562507435a86b42300946324","563877854bfb360d00a463c1","5639e0f91846790d0089529a","565327d17d29410d004a0835","565457df04feff210074b17d","56545821ec189235002967af","565485099c4c6d0d00aeda02","5666f1f1f672550d000851ad","566abc7b74d574170070b700","566ad3c7c7c3cd1700265d14","566aede7b5ccc20d00817f71","566aef3147ebaf1900fe65d6"],"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":65,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-27T12:02:53.314Z","from_sync":false,"order":11,"slug":"advanced-tutorials","title":"Advanced tutorials"},"project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":26,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-02-28T09:06:13.378Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":15,"body":"Besides sending messages in real time, our API enables you to take control over **message delivery schedule**, **message status** and **message expiration time window**.\n\nMessage scheduling:\n* [Schedule SMS message](#schedule-sms-message)\n* [Get message schedule info](#get-message-schedule-info)\n* [Reschedule SMS message](#reschedule-sms-message)\n\nMessage status:\n* [Get message status info](#get-message-status-info)\n* [Update message status](#update-message-status)\n\nValidity period:\n* [Set validity period](#set-validity-period)\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Schedule SMS message\"\n}\n[/block]\n```\nhttps://api.infobip.com/sms/1/text/advanced\n```\n\nIf you want to **schedule your SMS** to be sent later you can use **`sendAt`** parameter in the [Fully featured textual message](doc:fully-featured-textual-message) API method. This will set a specific date and time when the message will be sent.\n\nDate and time format for SMS scheduling: `2015-07-07T17:00:00.000+01:00`.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Rescheduling requirements\",\n  \"body\": \"Please note that in order to take advantage of message rescheduling certain requirements must be met. See [**Message rescheduling**](#section-reschedule-sms-message) section for details.\"\n}\n[/block]\nExample bellow shows how to schedule your message:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /sms/1/text/advanced HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n   \\\"messages\\\":[\\n      {\\n         \\\"from\\\":\\\"41793026700\\\",\\n         \\\"destinations\\\":[\\n            {\\n               \\\"to\\\":\\\"41793026785\\\"\\n            }\\n         ],\\n         \\\"text\\\":\\\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\\\",\\n         \\\"sendAt\\\":\\\"2015-07-07T17:00:00.000+01:00\\\"\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nAnd here is the response you will receive:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/json\\n\\n{\\n  \\\"bulkId\\\": \\\"b86c5f0f-40ed-47b7-9b7f-57eb9707b104\\\",\\n  \\\"messages\\\": [\\n    {\\n      \\\"to\\\": \\\"41793026785\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 26,\\n        \\\"name\\\": \\\"PENDING_ACCEPTED\\\",\\n        \\\"description\\\": \\\"Pending Accepted\\\"\\n      },\\n      \\\"messageId\\\": \\\"36397015-149a-41de-bccc-f7e365a7f89a\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get message schedule info\"\n}\n[/block]\n```\nhttp://api.infobip.com/sms/1/bulks?bulkId={bulkId}\n```\n\nThis method will return information for scheduled time for unique bulk message. Canceling and rescheduling is supported only when advanced SMS request contains only one message and message bulkId is unique.\n\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /sms/1/bulks?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulkId\\\": \\\"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\\\",\\n  \\\"sendAt\\\": \\\"2021-08-25T16:00:00.000+0000\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"put\",\n  \"title\": \"Reschedule SMS message\"\n}\n[/block]\n```\nhttp://api.infobip.com/sms/1/bulks?bulkId={bulkId}\n```\nMessages scheduled with `sendAt` parameter can be paused, resumed or canceled by changing message status, or rescheduled using `bulkId` parameter as identifier.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Please note that canceling and rescheduling is supported only when advanced SMS request contains only **one message** per bulk and message **bulkId** is unique.\\n\\nIf you don't provide **bulkId** through initial SMS send request, system will create unique id for you and include it as **bulkId** in response. This id can be used later to retrieve delivery information, change status and date/time of message delivery.\\n\\nMultiple messages in one bulk send request **CAN NOT BE UPDATED** since each message may contain different delivery date and time and have different status.\",\n  \"title\": \"Rescheduling and status update requirements\"\n}\n[/block]\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PUT /sms/1/bulks?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n    \\\"sendAt\\\": \\\"2021-08-25T16:00:00.000+0000\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulkId\\\": \\\"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\\\",\\n  \\\"sendAt\\\": \\\"2021-08-26T16:00:00.000+0000\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get message status info\"\n}\n[/block]\n```\nhttp://api.infobip.com/sms/1/bulks/status?bulkId={bulkId}\n```\n\nThis method will return current status of the bulk message.\n\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /sms/1/bulks/status?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\",\n      \"language\": \"text\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulkId\\\": \\\"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\\\",\\n  \\\"status\\\": \\\"CANCELED\\\"\\n}\",\n      \"language\": \"text\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]\nBelow is a list of possible message statuses. Only PENDING and PAUSED status can be updated.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Status\",\n    \"0-0\": \"PENDING\",\n    \"1-0\": \"PAUSED\",\n    \"2-0\": \"CANCELED\",\n    \"3-0\": \"PROCESSING\",\n    \"4-0\": \"FINISHED\",\n    \"5-0\": \"FAILED\",\n    \"h-1\": \"Can be updated to\",\n    \"0-1\": \"PAUSED,  CANCELED\",\n    \"h-2\": \"Else\",\n    \"2-1\": \"n/a\",\n    \"1-1\": \"PENDING, CANCELED\",\n    \"3-1\": \"n/a\",\n    \"4-1\": \"n/a\",\n    \"5-1\": \"n/a\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"put\",\n  \"title\": \"Update message status\"\n}\n[/block]\n\n```\nhttp://api.infobip.com/sms/1/bulks/status?bulkId={bulkId}\n```\nMessages scheduled with `sendAt` parameter can be paused, resumed or canceled by changing message status, or rescheduled using `bulkId` parameter as identifier. Following statuses can be updated:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Status\",\n    \"h-1\": \"Can be updated to\",\n    \"0-0\": \"PENDING\",\n    \"1-0\": \"PAUSED\",\n    \"0-1\": \"PAUSED,  CANCELED\",\n    \"1-1\": \"PENDING, CANCELED\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Rescheduling and status update requirements\",\n  \"body\": \"Please note that canceling and rescheduling is supported only when advanced SMS request contains only **one message** per bulk and message **bulkId** is unique.\\n\\nIf you don't provide **bulkId** through initial SMS send request, system will create unique id for you and include it as **bulkId** in response. This id can be used later to retrieve delivery information, change status and date/time of message delivery.\\n\\nMultiple messages in one bulk send request **CAN NOT BE UPDATED** since each message may contain different delivery date and time and have different status.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Status update\",\n  \"body\": \"PENDING and PAUSED statuses can be changed back and forth until message starts to process (scheduled time is up and message is sent).\\n\\nOnce message is CANCELED it can not be rescheduled or updated with new status! Message will remain undelivered regardless of the scheduled date and time.\"\n}\n[/block]\nRequest example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PUT /sms/1/bulks/status?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic b25lYXBpOnRoZUJveA==\\nContent-Type: application/json\\n\\n{\\n    \\\"status\\\": \\\"PAUSED\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"bulkId\\\": \\\"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\\\",\\n  \\\"status\\\": \\\"PAUSED\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Set validity period\"\n}\n[/block]\n\n\n```\nhttps://api.infobip.com/sms/1/text/advanced\n```\n\nBesides scheduling messages, you can also set **validity period** for every SMS sent over [Fully featured textual message](doc:fully-featured-textual-message) API method. \n\nThe message **`validityPeriod`** parameter should be set in **minutes**. The message sending will not be allowed after the set period expires. The maximum validity period is 48 hours and if you put a longer period, we will automatically set it to 48h.\n\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /sms/1/text/advanced HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n   \\\"messages\\\":[\\n      {\\n         \\\"from\\\":\\\"InfoSMS\\\",\\n         \\\"destinations\\\":[\\n            {\\n               \\\"to\\\":\\\"41793026727\\\"\\n            },\\n            {\\n               \\\"to\\\":\\\"41793026731\\\"\\n            }\\n         ],\\n         \\\"text\\\":\\\"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\\\",\\n         \\\"validityPeriod\\\": 1440\\n      }\\n   ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/1.1 200 OK\\nContent-Type: application/json\\n\\n{\\n  \\\"bulkId\\\": \\\"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\\\",\\n  \\\"messages\\\": [\\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      \\\"smsCount\\\": 1,\\n      \\\"messageId\\\": \\\"239a1bed-91d0-4454-a437-6663938465aa\\\"\\n    },\\n    {\\n      \\\"to\\\": \\\"41793026731\\\",\\n      \\\"status\\\": {\\n        \\\"groupId\\\": 1,\\n        \\\"groupName\\\": \\\"PENDING\\\",\\n        \\\"id\\\": 7,\\n        \\\"name\\\": \\\"PENDING_ENROUTE\\\",\\n        \\\"description\\\": \\\"Message sent to next instance\\\"\\n      },\\n      \\\"smsCount\\\": 1,\\n      \\\"messageId\\\": \\\"77a6e601-c12d-4a66-8e16-d8ec8c5fbc03\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Schedule SMS sending and set a validity period for your messages.","slug":"schedule-sms","type":"basic","title":"Schedule SMS and Validity period"}

Schedule SMS and Validity period

Schedule SMS sending and set a validity period for your messages.

Besides sending messages in real time, our API enables you to take control over **message delivery schedule**, **message status** and **message expiration time window**. Message scheduling: * [Schedule SMS message](#schedule-sms-message) * [Get message schedule info](#get-message-schedule-info) * [Reschedule SMS message](#reschedule-sms-message) Message status: * [Get message status info](#get-message-status-info) * [Update message status](#update-message-status) Validity period: * [Set validity period](#set-validity-period) [block:api-header] { "type": "post", "title": "Schedule SMS message" } [/block] ``` https://api.infobip.com/sms/1/text/advanced ``` If you want to **schedule your SMS** to be sent later you can use **`sendAt`** parameter in the [Fully featured textual message](doc:fully-featured-textual-message) API method. This will set a specific date and time when the message will be sent. Date and time format for SMS scheduling: `2015-07-07T17:00:00.000+01:00`. [block:callout] { "type": "warning", "title": "Rescheduling requirements", "body": "Please note that in order to take advantage of message rescheduling certain requirements must be met. See [**Message rescheduling**](#section-reschedule-sms-message) section for details." } [/block] Example bellow shows how to schedule your message: [block:code] { "codes": [ { "code": "POST /sms/1/text/advanced HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"messages\":[\n {\n \"from\":\"41793026700\",\n \"destinations\":[\n {\n \"to\":\"41793026785\"\n }\n ],\n \"text\":\"A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.\",\n \"sendAt\":\"2015-07-07T17:00:00.000+01:00\"\n }\n ]\n}", "language": "json" } ] } [/block] And here is the response you will receive: [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"bulkId\": \"b86c5f0f-40ed-47b7-9b7f-57eb9707b104\",\n \"messages\": [\n {\n \"to\": \"41793026785\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 26,\n \"name\": \"PENDING_ACCEPTED\",\n \"description\": \"Pending Accepted\"\n },\n \"messageId\": \"36397015-149a-41de-bccc-f7e365a7f89a\"\n }\n ]\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "get", "title": "Get message schedule info" } [/block] ``` http://api.infobip.com/sms/1/bulks?bulkId={bulkId} ``` This method will return information for scheduled time for unique bulk message. Canceling and rescheduling is supported only when advanced SMS request contains only one message and message bulkId is unique. Request example: [block:code] { "codes": [ { "code": "GET /sms/1/bulks?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json", "language": "json", "name": "JSON" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulkId\": \"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\",\n \"sendAt\": \"2021-08-25T16:00:00.000+0000\"\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "type": "put", "title": "Reschedule SMS message" } [/block] ``` http://api.infobip.com/sms/1/bulks?bulkId={bulkId} ``` Messages scheduled with `sendAt` parameter can be paused, resumed or canceled by changing message status, or rescheduled using `bulkId` parameter as identifier. [block:callout] { "type": "warning", "body": "Please note that canceling and rescheduling is supported only when advanced SMS request contains only **one message** per bulk and message **bulkId** is unique.\n\nIf you don't provide **bulkId** through initial SMS send request, system will create unique id for you and include it as **bulkId** in response. This id can be used later to retrieve delivery information, change status and date/time of message delivery.\n\nMultiple messages in one bulk send request **CAN NOT BE UPDATED** since each message may contain different delivery date and time and have different status.", "title": "Rescheduling and status update requirements" } [/block] Request example: [block:code] { "codes": [ { "code": "PUT /sms/1/bulks?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"sendAt\": \"2021-08-25T16:00:00.000+0000\"\n}", "language": "json", "name": "JSON" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulkId\": \"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\",\n \"sendAt\": \"2021-08-26T16:00:00.000+0000\"\n}", "language": "json", "name": "JSON" } ] } [/block] [block:api-header] { "type": "get", "title": "Get message status info" } [/block] ``` http://api.infobip.com/sms/1/bulks/status?bulkId={bulkId} ``` This method will return current status of the bulk message. Request example: [block:code] { "codes": [ { "code": "GET /sms/1/bulks/status?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json", "language": "text", "name": "JSON" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulkId\": \"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\",\n \"status\": \"CANCELED\"\n}", "language": "text", "name": "JSON" } ] } [/block] Below is a list of possible message statuses. Only PENDING and PAUSED status can be updated. [block:parameters] { "data": { "h-0": "Status", "0-0": "PENDING", "1-0": "PAUSED", "2-0": "CANCELED", "3-0": "PROCESSING", "4-0": "FINISHED", "5-0": "FAILED", "h-1": "Can be updated to", "0-1": "PAUSED, CANCELED", "h-2": "Else", "2-1": "n/a", "1-1": "PENDING, CANCELED", "3-1": "n/a", "4-1": "n/a", "5-1": "n/a" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "put", "title": "Update message status" } [/block] ``` http://api.infobip.com/sms/1/bulks/status?bulkId={bulkId} ``` Messages scheduled with `sendAt` parameter can be paused, resumed or canceled by changing message status, or rescheduled using `bulkId` parameter as identifier. Following statuses can be updated: [block:parameters] { "data": { "h-0": "Status", "h-1": "Can be updated to", "0-0": "PENDING", "1-0": "PAUSED", "0-1": "PAUSED, CANCELED", "1-1": "PENDING, CANCELED" }, "cols": 2, "rows": 2 } [/block] [block:callout] { "type": "warning", "title": "Rescheduling and status update requirements", "body": "Please note that canceling and rescheduling is supported only when advanced SMS request contains only **one message** per bulk and message **bulkId** is unique.\n\nIf you don't provide **bulkId** through initial SMS send request, system will create unique id for you and include it as **bulkId** in response. This id can be used later to retrieve delivery information, change status and date/time of message delivery.\n\nMultiple messages in one bulk send request **CAN NOT BE UPDATED** since each message may contain different delivery date and time and have different status." } [/block] [block:callout] { "type": "info", "title": "Status update", "body": "PENDING and PAUSED statuses can be changed back and forth until message starts to process (scheduled time is up and message is sent).\n\nOnce message is CANCELED it can not be rescheduled or updated with new status! Message will remain undelivered regardless of the scheduled date and time." } [/block] Request example: [block:code] { "codes": [ { "code": "PUT /sms/1/bulks/status?bulkId=a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic b25lYXBpOnRoZUJveA==\nContent-Type: application/json\n\n{\n \"status\": \"PAUSED\"\n}", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"bulkId\": \"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\",\n \"status\": \"PAUSED\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "post", "title": "Set validity period" } [/block] ``` https://api.infobip.com/sms/1/text/advanced ``` Besides scheduling messages, you can also set **validity period** for every SMS sent over [Fully featured textual message](doc:fully-featured-textual-message) API method. The message **`validityPeriod`** parameter should be set in **minutes**. The message sending will not be allowed after the set period expires. The maximum validity period is 48 hours and if you put a longer period, we will automatically set it to 48h. Request example [block:code] { "codes": [ { "code": "POST /sms/1/text/advanced HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"messages\":[\n {\n \"from\":\"InfoSMS\",\n \"destinations\":[\n {\n \"to\":\"41793026727\"\n },\n {\n \"to\":\"41793026731\"\n }\n ],\n \"text\":\"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\",\n \"validityPeriod\": 1440\n }\n ]\n}", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n \"bulkId\": \"a6e6bf50-ade1-4dd5-8900-d5b3bb18c0cc\",\n \"messages\": [\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 \"smsCount\": 1,\n \"messageId\": \"239a1bed-91d0-4454-a437-6663938465aa\"\n },\n {\n \"to\": \"41793026731\",\n \"status\": {\n \"groupId\": 1,\n \"groupName\": \"PENDING\",\n \"id\": 7,\n \"name\": \"PENDING_ENROUTE\",\n \"description\": \"Message sent to next instance\"\n },\n \"smsCount\": 1,\n \"messageId\": \"77a6e601-c12d-4a66-8e16-d8ec8c5fbc03\"\n }\n ]\n}", "language": "json" } ] } [/block]