---
title: "Create access token"
method: POST
path: "/access-tokens"
tags: ["Access Tokens"]
---

# Create access token

`POST /access-tokens`

## Request

- Base URL: `https://api.grapesjs.com/v1`
- URL: `https://api.grapesjs.com/v1/access-tokens`
- Auth: HTTP bearer

Creates a short-lived access token for trusted client-side flows.

To use when your backend needs to hand temporary credentials to trusted client-side code.

This is currently intended for the `/ai/chat` endpoint used by the [AI chat plugin](https://app.grapesjs.com/docs-sdk/plugins/ai/overview).

## Response `200`

Access token created

- AccessToken
  - `accessToken` string, required: Short-lived bearer token starting with `at_`, intended for trusted client-side access to allowed endpoints such as `/ai/chat`.
  - `expiresAt` string, date-time, required

## Other responses

- `401`: Unauthorized
- `500`: Server error

---

[API](https://skmtc.dev/grapesjs/apis/studio-platform-api.md) - [All operations](https://skmtc.dev/grapesjs/apis/studio-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grapesjs/apis/studio-platform-api/revisions/acc4ffe35e2d?raw)
