---
title: "Generate Access Tokens"
method: POST
path: "/api/v2/access/tokens"
tags: ["ACCESS_TOKENS"]
---

# Generate Access Tokens

`POST /api/v2/access/tokens`

Get access tokens for the API requests by invoking the following endpoint:

  > `POST https://YourAccount.lacework.net/api/v2/access/tokens`

  After creating a secret key, administrators can generate Temporary API access (bearer) tokens that clients and client applications use to access the FortiCNAPP API. Create temporary API access (bearer) tokens by invoking the `POST https://YourAccount.lacework.net/api/v2/access/tokens` endpoint.

## Headers

- `X-LW-UAKS` string, required
- `Content-Type` string, required

## Request body

- ApiV2AccessTokens
  - `keyId` string, required — YourAccessKeyID
  - `expiryTime` integer, required — The access token's expiration (in seconds) that you want to set. Maximum value: 86400 (24 hours).

## Response `201`

A temporary access (bearer) token is returned.

- ResponseApiV2AccessTokens
  - `expiresAt` string — The timestamp for when the access token expires in RFC3339 date time format (yyyy-MM-ddTHH:mm:ss.SSSZ)
  - `token` string — The access token.

## Other responses

- `4XX` — Client Error
- `5XX` — Internal Server Error

---

[API](https://skmtc.net/lacework/apis/forticnapp-api-2-0-documentation.md) · [All operations](https://skmtc.net/lacework/apis/forticnapp-api-2-0-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lacework/forticnapp-api-2-0-documentation/revisions/7015f76895f2/schema)
