API REFERENCE
...
Authentication
Generate access token
1 min
{ "name" "auth", "method" "post", "url" "https //api sandbox klavi ai/payment/customer/v1/auth", "description" "use /auth endpoint by credentials to return a token and continue your process to initiate a payment ", "tab" "examples", "examples" { "languages" \[ { "id" "y2z3hboczeboqb1yaxsl5", "language" "curl", "code" "curl location 'https //api sandbox klavi ai/payment/customer/v1/auth' \\\\\n header 'accept application/json' \\\\\n header 'content type application/json' \\\\\n data '{\\"accesskey\\" \\"string\\",\\"secretkey\\" \\"string\\"}'", "customlabel" "" }, { "id" "hvjvbaw8aunbeglit0ryf", "language" "nodejs", "code" "var request = require('request');\nvar options = {\n 'method' 'post',\n 'url' 'https //api sandbox klavi ai/payment/customer/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" "sgpzmn2d9bschggytpx7f", "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/payment/customer/v1/auth\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "customlabel" "" }, { "id" "gru7voinei2qd1ucs9vep", "language" "python", "code" "import requests\nimport json\n\nurl = \\"https //api sandbox klavi ai/payment/customer/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" "swgby1wm1u4qi2oxr15t6", "language" "ruby", "code" "require \\"uri\\"\nrequire \\"json\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //api sandbox klavi ai/payment/customer/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" "y2z3hboczeboqb1yaxsl5" }, "results" { "languages" \[ { "id" "gbnsrq md6biiryurwo 9", "language" "200", "customlabel" "", "code" "{\n \\"accesstoken\\" \\"1niisinr5cci6ikpxvcj9 tluixx1fq i7xiknqxvdchh8mkr6lv\\",\n \\"expireat\\" 1752053847\n}" } ], "selectedlanguageid" "gbnsrq md6biiryurwo 9" }, "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[ { "name" "accesskey", "kind" "required", "type" "string", "description" "pre generated by klavi for partner" }, { "name" "secretkey", "kind" "required", "type" "string", "description" "pre generated by klavi for partner", "children" \[] } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "response" \[ { "name" "accesstoken", "kind" "optional", "type" "string", "description" "access token" }, { "name" "expireat", "kind" "optional", "type" "number", "description" "expire time stamp(utc)", "children" \[] } ] } https //docs klavipay ai/docs/api reference/customer/auth/authentication#code 200