{"_id":"55e59c1ff11ba80d003238f1","category":{"_id":"55e58d1bd101191900f30b1d","version":"55e58b63d101191900f30b16","__v":13,"pages":["55e58d27191aa90d0052b52f","55e58d56191aa90d0052b531","55e58d6ff493c11700584315","55e58d81f493c11700584318","55e59b9bd101191900f30b75","55e59c1ff11ba80d003238f1","55e7325f2d0d3021000db050","55e732ca58e25f35001437a6","55e7339e2d0d3021000db052","55e734aa7991b92100b209ed","55f7028ba7ceef0d00251c19","56669144ce8caf0d006018b6","56d04587376b040b005b2f7d"],"project":"55e58b63d101191900f30b13","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-01T11:33:47.501Z","from_sync":false,"order":2,"slug":"rest-api","title":"REST API"},"project":"55e58b63d101191900f30b13","version":{"_id":"55e58b63d101191900f30b16","__v":3,"project":"55e58b63d101191900f30b13","createdAt":"2015-09-01T11:26:27.668Z","releaseDate":"2015-09-01T11:26:27.668Z","categories":["55e58b65d101191900f30b17","55e58d16f493c11700584314","55e58d1bd101191900f30b1d"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"githubsync":"","user":"5554788cb450630d00041dbc","__v":30,"parentDoc":null,"updates":["56795e0f092f210d00e306a4","56fc06b50023171700b9618b","584fa1e35f70af2d00855014","585d278ca20a602300d7c768","585d279c5a9f511b00de9170","587dc95f38c9651900a21032","5a8552ed2acc9c0012e37e83","5c0acf196bc497001d3b454e"],"next":{"pages":[],"description":""},"createdAt":"2015-09-01T12:37:51.125Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Each API request is authenticated by an authentication token in the request header. To get your authentication token, please email us at info:::at:::pushcrew.com\n\nThe token needs to be sent in the 'Authorization' HTTP header. The value of the header should be the authentication token.\n\nRefer to examples below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -H \\\"Authorization: <insert token value here>\\\" https://pushcrew.com/api/v1/send/all\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"$curlUrl = '';\\n\\n$fields = Array();\\n\\n$apiToken = 'token value here';\\n\\n$httpHeadersArray = Array();\\n$httpHeadersArray[] = 'Authorization: key='.$apiToken;\\n\\n//open connection\\n$ch = curl_init();\\n\\n//set the url, number of POST vars, POST data\\ncurl_setopt($ch, CURLOPT_URL, $curlUrl);\\ncurl_setopt($ch, CURLOPT_POST, true);\\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));\\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeadersArray);\\n\\ncurl_exec($ch);\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\n If you provide a wrong token, or include a token in the request body rather than the header, the response will have status code of 401 with message body as:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"message\\\": \\\"You are not authorized\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n**Please Note:**\nA user authentication token authorized to your application is not time-bound and is valid indefinitely without requiring you to re-authorize.","excerpt":"","slug":"authentication-and-authorization","type":"basic","title":"Authentication and Authorization"}

Authentication and Authorization


Each API request is authenticated by an authentication token in the request header. To get your authentication token, please email us at [email protected] The token needs to be sent in the 'Authorization' HTTP header. The value of the header should be the authentication token. Refer to examples below: [block:code] { "codes": [ { "code": "curl -H \"Authorization: <insert token value here>\" https://pushcrew.com/api/v1/send/all", "language": "curl" }, { "code": "$curlUrl = '';\n\n$fields = Array();\n\n$apiToken = 'token value here';\n\n$httpHeadersArray = Array();\n$httpHeadersArray[] = 'Authorization: key='.$apiToken;\n\n//open connection\n$ch = curl_init();\n\n//set the url, number of POST vars, POST data\ncurl_setopt($ch, CURLOPT_URL, $curlUrl);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeadersArray);\n\ncurl_exec($ch);", "language": "php" } ] } [/block] If you provide a wrong token, or include a token in the request body rather than the header, the response will have status code of 401 with message body as: [block:code] { "codes": [ { "code": "{\n \"message\": \"You are not authorized\"\n}", "language": "json" } ] } [/block] **Please Note:** A user authentication token authorized to your application is not time-bound and is valid indefinitely without requiring you to re-authorize.