---
title: Generate Access Token
slug: connect/generate-access-token
docTags: 
createdAt: 2023-11-16T03:11:20.288Z
---

:::ApiMethodV2
```json
{
  "name": "auth",
  "method": "POST",
  "url": "https://api-sandbox.klavi.ai/data/v1/auth",
  "description": "Generate an access token for the application.",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "CDlcZc55CwWfZ67qCrCKQ",
        "language": "curl",
        "code": "curl --location 'https://api-sandbox.klavi.ai/data/v1/auth' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data '{\"accessKey\":\"string\",\"secretKey\":\"string\"}'",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "CDlcZc55CwWfZ67qCrCKQ"
  },
  "results": {
    "languages": [
      {
        "id": "TTBenBsTPQbnEhQrBwIFj",
        "language": "200",
        "code": "{\n      \"accessToken\": \"JhbGciOiJFUzI1NiIs.QtYjAyOC1hN2ZhMWFjZGRjZjkiLCJ0.nlTqpAZHeq4P2xFD\",\n      \"expireIn\": 1800\n}",
        "customLabel": ""
      },
      {
        "id": "dyTh72DX1pXmyRs6z0qHe",
        "language": "401",
        "code": "{\n    \"statusCode\": 401,\n    \"error\": \"Unauthorized\",\n    \"message\": \"Invalid accessKey or secretKey\"\n}",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "TTBenBsTPQbnEhQrBwIFj"
  },
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "name": "accessKey",
        "kind": "required",
        "type": "string",
        "description": "App key"
      },
      {
        "name": "secretKey",
        "kind": "required",
        "type": "string",
        "description": "App secret key",
        "children": []
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "response": [
    {
      "name": "accessToken",
      "kind": "optional",
      "type": "string",
      "description": "JWT token"
    },
    {
      "name": "expireIn",
      "kind": "optional",
      "type": "string",
      "description": "Token validity duration",
      "children": []
    }
  ],
  "hasTryItOut": false,
  "autoGeneratedAnchorSlug": "auth",
  "legacyHash": "gpiyCrScVtRSHxEyXRPVq"
}
```
:::

