{"_id":"5a0c6bc52124c200288ad4d9","project":"55c8cff571d7580d0063a5e5","version":{"_id":"57624356653c2d2200fec79c","__v":20,"project":"55c8cff571d7580d0063a5e5","createdAt":"2016-06-16T06:12:38.244Z","releaseDate":"2016-06-16T06:12:38.244Z","categories":["57624356653c2d2200fec79d","57624356653c2d2200fec79e","57624356653c2d2200fec79f","57624356653c2d2200fec7a0","57624356653c2d2200fec7a1","57624356653c2d2200fec7a2","57624356653c2d2200fec7a3","57624356653c2d2200fec7a4","57624356653c2d2200fec7a5","57624356653c2d2200fec7a6","57624356653c2d2200fec7a7","57624356653c2d2200fec7a8","57624356653c2d2200fec7a9","57624356653c2d2200fec7aa","5779ca1b99b40b0e005abb3a","5779d198aea88b0e00f63277","5797d3ab17ced017003c4be4","57ac170ef1cdae0e0053cdfc","57dbfc723ed3450e00dc9e6d","5804d12d16161c0f0077df9b","5841064b652e5b0f0015a7c8","588b5e5f2966b2230009cbf9","58a68ebf3239fa0f00857619","58c23c8b4922930f0050ac91","58fd1460809fc30f00f2ee07","5934eaf5328680002d77de6a","594bf91601cfe6000f40f4c5","595c4ed696b447001ba0cf6d","596524495cee50001575f5be","5970d4f1313162004dd303b5","59780fac24dbd1001a1fa057","59a8cfd3ead78a002d63cafe","59e0323d93da1f001c9ec170"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"4.0.0","version":"4"},"category":{"_id":"57624356653c2d2200fec79d","project":"55c8cff571d7580d0063a5e5","__v":0,"version":"57624356653c2d2200fec79c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-08-10T16:23:18.580Z","from_sync":false,"order":0,"slug":"documentation","title":"Getting Started"},"user":"56f99ab84d2b4f3400edb636","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-11-15T16:31:01.937Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"All Phone.com API requires an access token.  Need a token? Send an email to [apisupport:::at:::phone.com](mailto:apisupport@phone.com).\n\nIf you are a Phone.com customer, please include the Express Service Code, it may be retrieved via the Control Panel Support tab. Sign in to Phone.com [here](https://www.phone.com/login)\n\nIf you are new to Phone.com, please [sign up](https://www.phone.com/pricing/)\n\nPlease also include a brief description of your API application in your email.  We'd like to understand more about customer needs and provide better services.\n[block:api-header]\n{\n  \"title\": \"Authentication\"\n}\n[/block]\nPhone.com API authentication follows the [OAuth 2.0](https://tools.ietf.org/html/rfc6749) specification. You will have a Bearer token which represents a session owned by your custom application. To authenticate, include the `Authorization` header in your API requests, and prefix the token with the key word \"Bearer\".\n\nFor example, say you have been given the following token: `x470ZCoXywhKla4GtSwSin4zgN94PbtDi1rjNeBa89`, you would formulate the List Account API request as below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\n$token = 'x470ZCoXywhKla4GtSwSin4zgN94PbtDi1rjNeBa89';\\n\\n$curl = curl_init();\\ncurl_setopt_array($curl, array(\\n    CURLOPT_URL => \\\"https://api.phone.com/v4/accounts\\\",\\n    CURLOPT_RETURNTRANSFER => true,\\n    CURLOPT_ENCODING => \\\"\\\",\\n    CURLOPT_MAXREDIRS => 10,\\n    CURLOPT_TIMEOUT => 30,\\n    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\\n    CURLOPT_CUSTOMREQUEST => \\\"GET\\\",\\n    CURLOPT_HTTPHEADER => array(\\n        \\\"Content-type: application/json\\\",\\n        \\\"Authorization: Bearer $token\\\"\\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}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Scope of Token\"\n}\n[/block]\nAn access token may contain Account Owner scope, Extension User scope, or both scopes.  Token with Account Owner scope may execute any API while token with Extension scope may execute only API's at the Extension Level.  \n\nThe format of an API in Account level and Extension level is differed only by the request URL, where extension information is required for an Extension level API.  For example, the 'sms' API is available in both Account level and Extension level, and the URLs for each level are as follow, where :acct_id is the Account ID and :extn_id is the Extension ID.\n\nhttps://api.phone.com/v4/accounts/:acct_id/sms\nhttps://api.phone.com/v4/accounts/:acct_id/extensions/:extn_id/sms\n\nThe request bodies for the above API's are identical.","excerpt":"","slug":"access-token","type":"basic","title":"API Access Token"}
All Phone.com API requires an access token. Need a token? Send an email to [apisupport@phone.com](mailto:apisupport@phone.com). If you are a Phone.com customer, please include the Express Service Code, it may be retrieved via the Control Panel Support tab. Sign in to Phone.com [here](https://www.phone.com/login) If you are new to Phone.com, please [sign up](https://www.phone.com/pricing/) Please also include a brief description of your API application in your email. We'd like to understand more about customer needs and provide better services. [block:api-header] { "title": "Authentication" } [/block] Phone.com API authentication follows the [OAuth 2.0](https://tools.ietf.org/html/rfc6749) specification. You will have a Bearer token which represents a session owned by your custom application. To authenticate, include the `Authorization` header in your API requests, and prefix the token with the key word "Bearer". For example, say you have been given the following token: `x470ZCoXywhKla4GtSwSin4zgN94PbtDi1rjNeBa89`, you would formulate the List Account API request as below: [block:code] { "codes": [ { "code": "<?php\n\n$token = 'x470ZCoXywhKla4GtSwSin4zgN94PbtDi1rjNeBa89';\n\n$curl = curl_init();\ncurl_setopt_array($curl, array(\n CURLOPT_URL => \"https://api.phone.com/v4/accounts\",\n CURLOPT_RETURNTRANSFER => true,\n CURLOPT_ENCODING => \"\",\n CURLOPT_MAXREDIRS => 10,\n CURLOPT_TIMEOUT => 30,\n CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n CURLOPT_CUSTOMREQUEST => \"GET\",\n CURLOPT_HTTPHEADER => array(\n \"Content-type: application/json\",\n \"Authorization: Bearer $token\"\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" } ] } [/block] [block:api-header] { "title": "Scope of Token" } [/block] An access token may contain Account Owner scope, Extension User scope, or both scopes. Token with Account Owner scope may execute any API while token with Extension scope may execute only API's at the Extension Level. The format of an API in Account level and Extension level is differed only by the request URL, where extension information is required for an Extension level API. For example, the 'sms' API is available in both Account level and Extension level, and the URLs for each level are as follow, where :acct_id is the Account ID and :extn_id is the Extension ID. https://api.phone.com/v4/accounts/:acct_id/sms https://api.phone.com/v4/accounts/:acct_id/extensions/:extn_id/sms The request bodies for the above API's are identical.