openapi-directory
Version:
Building & bundling https://github.com/APIs-guru/openapi-directory for easy use from JS
1 lines • 63.4 kB
JSON
{"openapi":"3.0.0","servers":[{"description":"Sakari Production","url":"https://api.sakari.io"}],"info":{"contact":{"email":"support@sakari.io"},"description":"# Introduction\n\nWelcome to the documentation for the Sakari Messaging REST API. \n\nSakari provides an advanced platform to drive large scale customized SMS communication\n\nREST is a web-service protocol that lends itself to rapid development by using everyday HTTP and JSON technology.\n\nTo find out more about our product offering, please visit [https://sakari.io](https://sakari.io).\n\n# Quickstart\n\nFor your convenience we have created a quickstart guide to get you up and running in 5 minutes. \n\n[https://sakari.io/blog/sakari-api-quickstart](https://sakari.io/blog/sakari-api-quickstart)\n\n# PostMan Collection\n\nWe've created a simple set of examples using [PostMan](https://www.getpostman.com/) Simply click below to import these. You will need to setup three environment variables in PostMan - AccountId, ClientId and ClientSecret. Check out our PostMan blog post for more information\n\n[](https://app.getpostman.com/run-collection/d616e273edc916a7a6eb)\n\n# Finding your client id, client secret and account id\n\nTo authenticate against the API's you will need three key pieces of data\n - client id\n - client secret\n - account id\n\nTo retrieve these, simply login into [https://hub.sakari.io](https://hub.sakari.io) and click on the \"cog\" in the top right corner. In the popup dialog at the bottom you should see your API credentials and account id. If these are not visible you will need to click on \"Request Credentials\"\n\n# Versioning\n\nWith any breaking changes we will introduce a new version of the API. The latest version is v1.\n\nThe API uses an open schema model, which means server may add extra properties to responses. Likewise, the server will ignore any extra query parameters and request body properties. When you write clients, you need to ignore additional properties in responses to ensure they do not break.\n\n# Testing\n\nThere are numerous tools available for testing the API's. We will include examples using curl and the client SDKs that we have created. If you would like to see an SDK in a language not currently available, please let us know.\n\n# Throttling / Limits\n\nOur API's have been specifically designed to support bulk messaging in a single API call. We therefore impose limits on the frequency of calling the APIs to prevent abuse or runaway processes. If you feel you need a higher limit, please contact us. If you hit the limit you will get a 429 error code returned from our servers\n\n# Errors\n\nThe API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:\n\n```\n{\n \"success\": false,\n \"error\": {\n \"code\": \"CONT-001\",\n \"message\": \"Invalid mobile number\"\n }\n}\n```\n\n# Pagination\n\nFor performance, most GET calls return a subset of data. This data is paginated for easy access. Most APIs which return collections of data will return a pagination object as such:\n\n```\n{\n \"pagination\": {\n \"offset\": 0,\n \"limit\": 10\n \"totalCount\": 21\n } \n}\n```\n\nWhen making calls to the API, you can adjust the slice of data returned using query parameters such as:\n\n`` https://api.sakari.io/v1/accounts/123/contacts?offset=20&limit=25 ``\n\nThis will return 25 contacts with an offset of 20.\n","termsOfService":"https://sakari.io/terms-service.html","title":"Sakari","version":"1.0.1","x-apisguru-categories":["messaging"],"x-logo":{"url":"https://sakari.io/wp-content/uploads/cropped-sakari-icon-512x512-180x180.png"},"x-origin":[{"format":"openapi","url":"https://developer.sakari.io/openapi.yaml","version":"3.0"}],"x-providerName":"sakari.io"},"externalDocs":{"description":"Find out more about Sakari","url":"https://sakari.io"},"tags":[{"description":"Sakari uses OAuth2 for authentication. After you have created an account at [https://hub.sakari.io](https://hub.sakari.io), you can retrieve your client id and secret from the 'Account Details' screen (click on the 'cog' icon in the top right corner and scroll down to API Credentials)\n\nUsing your client id and secret, you can exchange these for a JWT ([JSON Web Token](https://en.wikipedia.org/wiki/JSON_Web_Token))\n\nThe JWT should then be used when accessing any of the core API's. It should be passed in the `Authorization` header.\n\nFor example:\n\n``Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImt....``\n","name":"authentication"},{"description":"Create, modify or delete contacts","name":"contacts"},{"description":"Send or track messages to one contact, a group of contacts or your entire address book","name":"messages"},{"description":"Define reusable message or web templates","name":"templates"},{"description":"Define reusable message campaigns with a predefined contact list/filter, template and schedule","name":"campaigns"},{"description":"Conversations group your message history with each contact into one thread","name":"conversations"},{"description":"Tools to assist with sending and receiving messages, such as file sharing, translation, etc.","name":"tools"},{"description":"Webhooks allow your own system to be automatically notified upon certin events, such as a new message received from one of your contacts or a status change notification for your messages","name":"webhooks"}],"paths":{"/oauth2/token":{"post":{"operationId":"auth.token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}},"description":"successful operation"}},"summary":"Get token for accessing APIs","tags":["authentication"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/oauth2/token \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"12345678-1234-1234-1234-123456789012\",\n \"client_secret\": \"87654321-4321-4321-4321-098765432121\"\n}'\n"},{"lang":"JavaScript","source":"var settings = {\n \"async\": true,\n \"crossDomain\": true,\n \"url\": \"https://api.sakari.io/oauth2/token\",\n \"method\": \"POST\",\n \"headers\": {\n \"Content-Type\": \"application/json\"\n },\n \"processData\": false,\n \"data\": \"{\\n\\t\\\"grant_type\\\": \\\"client_credentials\\\",\\n\\t\\\"client_id\\\": \\\"12345678-1234-1234-1234-123456789012\\\",\\n\\t\\\"client_secret\\\": \\\"87654321-4321-4321-4321-098765432121\\\"\\n}\"\n}\n\n$.ajax(settings).done(function (response) {\n console.log(response);\n});\n"},{"lang":"PHP","source":"<?php\n\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/oauth2/token');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"grant_type\": \"client_credentials\",\n \"client_id\": \"12345678-1234-1234-123456789012\",\n \"client_secret\": \"87654321-4321-4321-898765432121\"\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/campaigns":{"get":{"operationId":"campaigns.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/nameFilter"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignsResponse"}}},"description":"successful operation"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"}},"security":[{"sakari_auth":[]}],"summary":"Fetch campaigns","tags":["campaigns"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"post":{"operationId":"campaigns.create","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignRequest"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Create campaign","tags":["campaigns"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"name\": \"Marketing Campaign\",\n \"trigger\": {\n \"code\":\"M\"\n },\n \"template\":\"Hi {{{contact.firstName}}}\",\n \"reporting\":{\"when\":\"NoReport\"}\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns',\n headers: \n { Authorization: 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: \n { name: 'Marketing Campaign',\n trigger: { code: 'M' },\n template: 'Hi {{{contact.firstName}}}',\n reporting: { when: 'NoReport' } },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"name\": \"Marketing Campaign\",\n \"trigger\": {\n \"code\":\"M\"\n },\n \"template\":\"Hi {{{contact.firstName}}}\",\n \"reporting\":{\"when\":\"NoReport\"}\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/campaigns/{campaignId}":{"delete":{"operationId":"campaigns.remove","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"Campaign id to delete","in":"path","name":"campaignId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"success":{"type":"boolean"}},"type":"object"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Deletes a campaign","tags":["campaigns"],"x-code-samples":[{"lang":"CURL","source":"curl -X DELETE \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'DELETE',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}');\n $request->setMethod(HTTP_METH_DELETE);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"get":{"operationId":"campaigns.fetch","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of campaign to return","in":"path","name":"campaignId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch campaign by ID","tags":["campaigns"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"put":{"operationId":"campaigns.update","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of campaign","in":"path","name":"campaignId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Updates a campaign","tags":["campaigns"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"name\": \"Marketing Campaign\",\n \"trigger\": {\n \"code\":\"M\"\n },\n \"template\":\"Hi {{{contact.firstName}}}\",\n \"reporting\":{\"when\":\"NoReport\"}\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: \n { name: 'Marketing Campaign',\n trigger: { code: 'M' },\n template: 'Hi {{{contact.firstName}}}',\n reporting: { when: 'NoReport' } },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/campaigns/{{CAMPAIGN_ID}}');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"name\": \"Marketing Campaign\",\n \"trigger\": {\n \"code\":\"M\"\n },\n \"template\":\"Hi {{{contact.firstName}}}\",\n \"reporting\":{\"when\":\"NoReport\"}\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/contacts":{"get":{"operationId":"contacts.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/firstNameFilter"},{"$ref":"#/components/parameters/lastNameFilter"},{"$ref":"#/components/parameters/mobileFilter"},{"$ref":"#/components/parameters/emailFilter"},{"$ref":"#/components/parameters/tagsFilter"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactsResponse"}}},"description":"successful operation"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"}},"security":[{"sakari_auth":[]}],"summary":"Fetch contacts","tags":["contacts"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"post":{"operationId":"contacts.create","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"Determines how existing contacts with matching mobile numbers are treated","in":"query","name":"mergeStrategy","required":false,"schema":{"enum":["append","core","remove"],"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactRequest"}},"text/csv":{"schema":{"example":"country,firstName,lastName,email,mobile,jobTitle,Address,City,State,ZipCode US,Joe,Bloggs,joebloggs@sakari.co,123-456-7890,mover,123 Text Street,San Francisco,CA,12345\n","type":"string"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ContactsResponse"},{"$ref":"#/components/schemas/ContactUploadResponse"}]}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Create contact","tags":["contacts"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"firstName\": \"Chris\",\n \"lastName\": \"Thomson\",\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts',\n headers: {\n Authorization: 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: \n { firstName: 'Chris',\n lastName: 'Thomson',\n mobile: { number: '+1234567890', country: 'US' } },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"firstName\": \"Chris\",\n \"lastName\": \"Thomson\",\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/contacts/{contactId}":{"delete":{"operationId":"contacts.remove","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"Contact id to delete","in":"path","name":"contactId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"success":{"type":"boolean"}},"type":"object"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Deletes a contact","tags":["contacts"],"x-code-samples":[{"lang":"CURL","source":"curl -X DELETE \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'DELETE',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}',\n headers: \n { 'Authorization': 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}');\n $request->setMethod(HTTP_METH_DELETE);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"firstName\": \"Chris\",\n \"lastName\": \"Thomson\",\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"get":{"operationId":"contacts.fetch","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of contact to return","in":"path","name":"contactId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch contact by ID","tags":["contacts"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"put":{"operationId":"contacts.update","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of contact","in":"path","name":"contactId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Updates a contact","tags":["contacts"],"x-code-samples":[{"lang":"CURL","source":"curl -X PUT \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"firstName\": \"Bob\",\n \"lastName\": \"Thomson\",\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'PUT',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}',\n headers: \n { 'Authorization': 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: \n { firstName: 'Bob',\n lastName: 'Thomson',\n mobile: { number: '+1234567890', country: 'US' } },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/contacts/{{CONTACT_ID}}');\n $request->setMethod(HTTP_METH_PUT);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"firstName\": \"Bob\",\n \"lastName\": \"Thomson\",\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/conversations":{"get":{"operationId":"conversations.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/limit"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationsResponse"}}},"description":"successful operation"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"}},"security":[{"sakari_auth":[]}],"summary":"Fetch conversations","tags":["conversations"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/conversations/{conversationId}":{"get":{"operationId":"conversations.fetch","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of template to return","in":"path","name":"conversationId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch conversation by ID","tags":["conversations"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}}');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/conversations/{conversationId}/close":{"put":{"operationId":"conversations.close","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of conversation","in":"path","name":"conversationId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Closes a conversation","tags":["conversations"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}}/close \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}}/close',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/conversations/{{CONVERSATION_ID}}/close');\n $request->setMethod(HTTP_METH_PUT);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"name\": \"Test Template\",\n \"template\": \"Hi {{ firstName }}, Welcome to Sakari!\",\n \"type\": \"SMS\"\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/messages":{"get":{"operationId":"messages.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/contactIdFilter"},{"$ref":"#/components/parameters/conversationIdFilter"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagesResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch messages","tags":["messages"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var settings = {\n \"async\": true,\n \"crossDomain\": true,\n \"url\": \"https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages\",\n \"method\": \"GET\",\n \"headers\": {\n \"Authorization\": \"Bearer {{TOKEN}}\"\n }\n}\n\n$.ajax(settings).done(function (response) {\n console.log(response);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"post":{"operationId":"messages.send","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagesRequest"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessagesResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Send Messages","tags":["messages"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages \\\n -H 'Accept: application/json' \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"contacts\": [{\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n }],\n \"template\": \"Congratulations! You just sent your first message\"\n} '\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages',\n headers: \n { 'Authorization': 'Bearer {{TOKEN}}',\n Accept: 'application/json',\n 'Content-Type': 'application/json' },\n body: \n { contacts: [ { mobile: { number: '+1234567890', country: 'US' } } ],\n template: 'Congratulations! You just sent your first message' },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"contacts\": [{\n \"mobile\": {\n \"number\": \"+1234567890\",\n \"country\": \"US\"\n }\n }],\n \"template\": \"Congratulations! You just sent your first message\"\n } ');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/messages/{messageId}":{"get":{"description":"Returns a single messag","operationId":"messages.fetch","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of message to return","in":"path","name":"messageId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch message by id","tags":["messages"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages/{{MESSAGE_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages/{{MESSAGE_ID}}',\n headers: \n { 'Authorization': 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/messages/{{MESSAGE_ID}}');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/templates":{"get":{"operationId":"templates.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"},{"$ref":"#/components/parameters/offset"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/nameFilter"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatesResponse"}}},"description":"successful operation"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"invalid request"}},"security":[{"sakari_auth":[]}],"summary":"Fetch templates","tags":["templates"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates',\n headers: \n { 'Authorization': 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"post":{"operationId":"templates.create","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateRequest"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatesResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Create template","tags":["templates"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"name\": \"Test Template\",\n \"template\": \"Hi {{ firstName }}, Welcome to Sakari!\",\n \"type\": \"SMS\"\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates',\n headers: \n { 'Content-Type': 'application/json' },\n body: \n { name: 'Test Template',\n template: 'Hi {{ firstName }}, Welcome to Sakari!',\n type: 'SMS' },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"name\": \"Test Template\",\n \"template\": \"Hi {{ firstName }}, Welcome to Sakari!\",\n \"type\": \"SMS\"\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/templates/{templateId}":{"delete":{"operationId":"templates.remove","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"Template id to delete","in":"path","name":"templateId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"success":{"type":"boolean"}},"type":"object"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Deletes a template","tags":["templates"],"x-code-samples":[{"lang":"CURL","source":"curl -X DELETE \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\n\nvar options = { method: 'DELETE',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}');\n $request->setMethod(HTTP_METH_DELETE);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"get":{"operationId":"templates.fetch","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of template to return","in":"path","name":"templateId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch template by ID","tags":["templates"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'GET',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' } };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"put":{"operationId":"templates.update","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"ID of template","in":"path","name":"templateId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Updates a template","tags":["templates"],"x-code-samples":[{"lang":"CURL","source":"curl -X PUT \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}} \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"name\": \"Test Template\",\n \"template\": \"Hi {{ firstName }}, Welcome to Sakari!\",\n \"type\": \"SMS\"\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\n\nvar options = { method: 'PUT',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: \n { name: 'Test Template',\n template: 'Hi {{ firstName }}, Welcome to Sakari!',\n type: 'SMS' },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/templates/{{TEMPLATE_ID}}');\n $request->setMethod(HTTP_METH_PUT);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"name\": \"Test Template\",\n \"template\": \"Hi {{ firstName }}, Welcome to Sakari!\",\n \"type\": \"SMS\"\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/webhooks":{"get":{"description":"When messages are acknowledge by carriers, a notification is sent to the specified URL","operationId":"webhooks.fetchAll","parameters":[{"$ref":"#/components/parameters/accountId"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhooksResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Fetch active webhooks","tags":["webhooks"],"x-code-samples":[{"lang":"CURL","source":"curl -X GET \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -d '{\n \"url\": \"https://requestbin.io\"\n}'\n"},{"lang":"JavaScript","source":"var settings = {\n \"async\": true,\n \"crossDomain\": true,\n \"url\": \"https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks\",\n \"method\": \"GET\",\n \"headers\": {\n \"Authorization\": \"Bearer {{TOKEN}}\"\n },\n \"data\": \"{\\n\\t\\\"url\\\": \\\"https://requestbin.io\\\"\\n}\"\n}\n\n$.ajax(settings).done(function (response) {\n console.log(response);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks');\n $request->setMethod(HTTP_METH_GET);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n $request->setBody('{\n \"url\": \"https://requestbin.io\"\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]},"post":{"description":"When messages are acknowledge by carriers, a notification is sent to the specified URL","operationId":"webhooks.subscribe","parameters":[{"$ref":"#/components/parameters/accountId"}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"eventTypes":{"items":{"enum":["contact-created","contact-updated","contact-removed","message-received","message-sent","message-status","conversation-started","contact-opt-out","contact-opt-in","list-opt-out","list-opt-in"],"type":"string"},"type":"array"},"url":{"example":"https://myserver.com/send/callback/here","format":"uri","type":"string"}},"required":["callbackUrl"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}},"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Subscribe to message events","tags":["webhooks"],"x-code-samples":[{"lang":"CURL","source":"curl -X POST \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks \\\n -H 'Authorization: Bearer {{TOKEN}}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"url\": \"https://requestbin.io\",\n \"eventTypes\": [\"message-received\"]\n}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'POST',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks',\n headers: \n { Authorization: 'Bearer {{TOKEN}}',\n 'Content-Type': 'application/json' },\n body: { url: 'https://requestbin.io', eventTypes: [ 'message-received' ] },\n json: true };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks');\n $request->setMethod(HTTP_METH_POST);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}',\n 'Content-Type' => 'application/json'\n ));\n \n $request->setBody('{\n \"url\": \"https://requestbin.io\",\n \"eventTypes\": [\"message-received\"]\n }');\n \n try {\n $response = $request->send();\n \n echo $response->getBody();\n } catch (HttpException $ex) {\n echo $ex;\n }\n"}]}},"/v1/accounts/{accountId}/webhooks/{url}":{"delete":{"callbacks":{"event":{"{$request.body#/callbackUrl}":{"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}},"required":true},"responses":{"200":{"description":"Your server returns this code if it accepts the callback"}}}}}},"description":"Delete subscription for receiving notifications","operationId":"webhooks.unsubscribe","parameters":[{"$ref":"#/components/parameters/accountId"},{"description":"Account to apply operations to","in":"path","name":"url","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"successful operation"}},"security":[{"sakari_auth":[]}],"summary":"Unsubscribe to message events","tags":["webhooks"],"x-code-samples":[{"lang":"CURL","source":"curl -X DELETE \\\n https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks/{{URL_ENCODED CALLBACK_URL}} \\\n -H 'Authorization: Bearer {{TOKEN}}'\n"},{"lang":"JavaScript","source":"var request = require(\"request\");\nvar options = { method: 'DELETE',\n url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks/{{URL_ENCODED CALLBACK_URL}}',\n headers: \n { Authorization: 'Bearer {{TOKEN}}' };\n\nrequest(options, function (error, response, body) {\n if (error) throw new Error(error);\n\n console.log(body);\n});\n"},{"lang":"PHP","source":"<?php\n $request = new HttpRequest();\n $request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks/{{URL_ENCODED CALLBACK_URL}}');\n $request->setMethod(HTTP_METH_DELETE);\n \n $request->setHeaders(array(\n 'Authorization' => 'Bearer {{TOKEN}}'\n ));\n \n try {\n $response = $request->send();\n