API REFERENCE
Authentication
Generate Access Token
1 min
{ "name" "auth", "method" "post", "url" "https //api sandbox klavi ai/monitor/v1/auth", "description" "generate an access token for the application", "tab" "examples", "examples" { "languages" \[ { "id" "5btv9exz jffzp3lr hbs", "language" "curl", "code" "curl location 'https //api sandbox klavi ai/monitor/v1/auth' \\\\\n header 'accept application/json' \\\\\n header 'content type application/json' \\\\\n data '{\\"accesskey\\" \\"string\\",\\"secretkey\\" \\"string\\"}'", "customlabel" "" }, { "id" "fdddxetkhro3efikfnpy0", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //api sandbox klavi ai/monitor/v1/auth',\n 'headers' {\n 'accept' 'application/json',\n 'content type' 'application/json'\n },\n body json stringify({\n \\"accesskey\\" \\"string\\",\n \\"secretkey\\" \\"string\\"\n })\n\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "customlabel" "" }, { "id" "dkofgdccwhdu1rjmuzdd0", "language" "javascript", "code" "var myheaders = new headers();\nmyheaders append(\\"accept\\", \\"application/json\\");\nmyheaders append(\\"content type\\", \\"application/json\\");\n\nvar raw = json stringify({\n \\"accesskey\\" \\"string\\",\n \\"secretkey\\" \\"string\\"\n});\n\nvar requestoptions = {\n method 'post',\n headers myheaders,\n body raw,\n redirect 'follow'\n};\n\nfetch(\\"https //api sandbox klavi ai/monitor/v1/auth\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "v skgyzaidjfprm0jyv7s", "language" "python", "code" "import requests\nimport json\n\nurl = \\"https //api sandbox klavi ai/monitor/v1/auth\\"\n\npayload = json dumps({\n \\"accesskey\\" \\"string\\",\n \\"secretkey\\" \\"string\\"\n})\nheaders = {\n 'accept' 'application/json',\n 'content type' 'application/json'\n}\n\nresponse = requests request(\\"post\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "customlabel" "" }, { "id" "5u y2ezohyc5s3iq1bxpp", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"json\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/monitor/v1/auth\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http post new(url)\nrequest\[\\"accept\\"] = \\"application/json\\"\nrequest\[\\"content type\\"] = \\"application/json\\"\nrequest body = json dump({\n \\"accesskey\\" \\"string\\",\n \\"secretkey\\" \\"string\\"\n})\n\nresponse = https request(request)\nputs response read body\n", "customlabel" "" } ], "selectedlanguageid" "5btv9exz jffzp3lr hbs" }, "results" { "languages" \[ { "id" "ocb1mz3ryr2gmnctdcxkx", "language" "200", "customlabel" "", "code" "{\n \\"accesstoken\\" \\"jhbgcioijfuzi1niis qtyjayoc1hn2zhmwfjzgrjzjkilcj0 nltqpazheq4p2xfd\\",\n \\"expirein\\" 1800\n}" }, { "id" "xatsrvzle4km5kdk7 yql", "language" "401", "customlabel" "", "code" "{\n \\"statuscode\\" 401,\n \\"error\\" \\"unauthorized\\",\n \\"message\\" \\"invalid accesskey or secretkey\\"\n}" } ], "selectedlanguageid" "ocb1mz3ryr2gmnctdcxkx" }, "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "name" "accesskey", "kind" "required", "type" "string", "description" "partner app key", "" "partner app key" }, { "name" "secretkey", "kind" "required", "type" "string", "description" "partner app secret key", "" "required" } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "hastryitout" false, "response" \[ { "name" "accesstoken", "kind" "optional", "type" "string", "description" "jwt token" }, { "name" "expirein", "kind" "optional", "type" "string", "description" "token validity duration, default 1800 seconds", "children" \[] } ] }