Skip to main content

mr token create

Create a new API token for the authenticated account and print the secret once. Store it securely; it cannot be retrieved again. An account may hold at most -max-user-tokens tokens (100 by default; 0 disables the cap), and minting past it fails with HTTP 409, so revoke one first.

Usage

mr token create

Examples

Create a token labelled 'ci'

mr token create --name ci

Create a token that expires in 30 days

mr token create --name temp --expires-in 720h

Flags

FlagTypeDefaultDescription
--namestringmr cliLabel for the token
--expires-instring``Optional expiry as a Go duration (e.g. 720h); empty = never

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

ID, Name and Token lines; --json emits {token, id, name, prefix}, where id is lower case while the list array uses ID

Exit Codes

0 success; 1 error (not authenticated, network error, or token not found)