---
title: "Create a bearer token"
method: POST
path: "/api/vega/token"
tags: ["Tokens"]
---

# Create a bearer token

`POST /api/vega/token`

## Request

- Base URL: `https://getmyluna.app`
- URL: `https://getmyluna.app/api/vega/token`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `luna_session`

Mints a token for agents, scripts or the MCP connector. The plaintext is returned **once**. Re-minting with the same `label` replaces that token; different labels coexist. Optional body, omit it for a full-access token labelled with your username.

## Request body

- TokenRequest
  - `label` string, nullable: Re-minting the same label replaces that token. Defaults to your username.
  - `scopes` string[], nullable: Default: both.

## Response `200`

Success

- TokenResponse
  - `token` string, required: Shown once; store it securely.
  - `luna_url` string, required
  - `mcp_url` string, required
  - `label` string, required
  - `scopes` string[], required

## Other responses

- `401`: Missing or invalid credentials
- `403`: `insufficient_scope`: the bearer token lacks the `write` scope

---

[API](https://skmtc.dev/getmyluna/apis/luna-api.md) · [All operations](https://skmtc.dev/getmyluna/apis/luna-api/llms.txt) · [OpenAPI document](https://skmtc.dev/getmyluna/apis/luna-api/revisions/ef7b359c9648?raw)
