---
title: "Generate Access Token"
method: POST
path: "/v1/token"
tags: ["Portfolio Connect"]
---

# Generate Access Token

`POST /v1/token`

## Request

- Base URL: `https://api.casparser.in`
- URL: `https://api.casparser.in/v1/token`
- Auth: API key in header `x-api-key`

Generate a short-lived access token from your API key.

**Use this endpoint from your backend** to create tokens that can be safely passed to frontend/SDK.

**Legacy path:** `/v1/access-token` (still supported)

Access tokens:
- Are prefixed with `at_` for easy identification
- Valid for up to 60 minutes
- Can be used in place of API keys on all v4 endpoints
- Cannot be used to generate other access tokens

## Request body

- object
  - `expiry_minutes` integer: Token validity in minutes (max 60)

## Response `200`

Access token generated successfully

- object
  - `access_token` string: The at_ prefixed access token
  - `token_type` string: Always "api_key" - token is a drop-in replacement for x-api-key header
  - `expires_in` integer: Token validity in seconds

## Other responses

- `400`: Bad request (e.g., trying to create token from access token)
- `401`: Unauthorized. This can happen if the `x-api-key` header is missing.

## Changes

- **2026-09-13** `cf1b57c0f2f7`: 1 warning
  - the optional response header `X-Request-ID` removed for the status `401`
- **2026-07-12** `c74b9ecd5b53`: 1 warning
  - added the new `failed` enum value to the `status` response property for the response status `401`
- **2026-02-22** `be3ca0403f2f`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/casparser/apis/cas-parser-track-portfolios-from-cdsl-nsdl-cams-kfintech-2/changes/v1/token/post.md)

---

[API](https://skmtc.dev/casparser/apis/cas-parser-track-portfolios-from-cdsl-nsdl-cams-kfintech-2.md) - [All operations](https://skmtc.dev/casparser/apis/cas-parser-track-portfolios-from-cdsl-nsdl-cams-kfintech-2/llms.txt) - [OpenAPI document](https://skmtc.dev/casparser/apis/cas-parser-track-portfolios-from-cdsl-nsdl-cams-kfintech-2/revisions/9d8f1445bad3?raw)
