---
title: JWT Login
slug: kron-pam-api-collection-381-patch3
docTags: 
createdAt: 2026-10-21T06:07:16.182Z
---

{
  "id": "iYjZyUUzsnUjFdeoJOfE2",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "{{url}}/aioc-rest-web/rest/jwt/login",
    "name": "",
    "description": "<p>Token-based login for scripts, integrations, and third-party connectors (e.g. SIEM/SOAR/discovery tools) that need to call the KRON PAM REST API without a browser-style session/cookie flow. Prefer this endpoint over the legacy <code>POST /rest/login</code> for any non-interactive/automated client.</p>\n<p><strong>Request Headers:</strong></p>\n<ul>\n<li><code>Content-Type: application/json</code></li>\n</ul>\n<p><strong>Successful Response (200):</strong></p>\n<pre><code class=\"language-json\">{\n    \"token_type\": \"bearer\",\n    \"access_token\": \"&#x3C;jwt-access-token>\",\n    \"refresh_token\": \"&#x3C;jwt-refresh-token>\"\n}\n</code></pre>\n<p><strong>Usage:</strong><br>\nSend the returned <code>access_token</code> as a Bearer token on every subsequent request:</p>\n<pre><code>Authorization: Bearer &#x3C;access_token>\n</code></pre>\n<p>No session cookie or <code>X-XSRF-TOKEN</code> header is required for JWT-authenticated calls.</p>\n<p><strong>Invalid credentials / brute-force protection:</strong><br>\nAfter repeated invalid attempts from the same client IP, the endpoint returns <code>429 Too Many Requests</code> with <code>{\"error\":\"too_many_requests\"}</code> for a short cooldown window, then automatically allows login attempts again once the window expires. This differs from the CAPTCHA-based lockout on the legacy login flow, which a non-interactive client cannot solve — this is why scripted/automated clients should authenticate via this JWT endpoint instead of <code>POST /rest/login</code>.</p>",
    "contentType": "application/json",
    "request": {
      "headerParameters": [
        {
          "name": "Content-Type",
          "description": "",
          "default": "application/json",
          "value": "application/json",
          "type": "string"
        }
      ],
      "queryParameters": [],
      "pathParameters": [
        {
          "name": "url",
          "description": "",
          "default": "url",
          "value": "url",
          "type": "string"
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "description": "",
          "default": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "value": "{\"username\":\"{{TestUserName}}\",\"password\":\"{{TestUserPassword}}\"}",
          "type": "object"
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>JWT Login - Success</p>",
        "jsonExample": "{\n    \"token_type\": \"bearer\",\n    \"access_token\": \"<jwt-access-token>\",\n    \"refresh_token\": \"<jwt-refresh-token>\"\n}"
      },
      {
        "statusCode": "429",
        "description": "<p>JWT Login - Too Many Requests</p>",
        "jsonExample": "{\n    \"error\": \"too_many_requests\",\n    \"error_description\": \"Too many requests from the same client IP\"\n}"
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "DEPIjWatQPrETo0A2r752",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/jwt/login \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\"'"
        },
        {
          "id": "Xi31B-dN9wI_KPt0ia0Ax",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/jwt/login\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ZAczyR-H2tjr4sum7ruIy",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/jwt/login\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "DJfjqciHLitRPJCb7JHFR",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"{{url}}/aioc-rest-web/rest/jwt/login\"\n\npayload = json.dumps(\"{\\\"username\\\":\\\"{{TestUserName}}\\\",\\\"password\\\":\\\"{{TestUserPassword}}\\\"}\")\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"
        }
      ],
      "selectedLanguageId": "DEPIjWatQPrETo0A2r752"
    },
    "results": {
      "languages": [
        {
          "id": "QnwCfHX0fRV4QTXbbtWYm",
          "language": "200",
          "code": "{\n    \"token_type\": \"bearer\",\n    \"access_token\": \"<jwt-access-token>\",\n    \"refresh_token\": \"<jwt-refresh-token>\"\n}"
        },
        {
          "id": "Ptq3FAkiavNx8jQuDtbCg",
          "language": "429",
          "code": "{\n    \"error\": \"too_many_requests\",\n    \"error_description\": \"Too many requests from the same client IP\"\n}"
        }
      ],
      "selectedLanguageId": "QnwCfHX0fRV4QTXbbtWYm"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}