Create a new platform token for an organization.
Requires: tokens:create permission in the organization.
The full token is returned only once - save it securely.
Security: You can only grant permissions that you have yourself.
Args: org_id: Organization UUID token_data: Token creation data (name, permissions, expiry) db: Database session
Returns: Token details including the full token string (only shown once)
Raises: HTTPException: If attempting to grant permissions you don’t have
Platform token (starts with pat_)
Schema for creating a platform token.
Human-readable token name
1 - 255Permissions granted to this token. Use presets like 'admin', 'editor', 'viewer' or specific permissions.
1Token expiration datetime (null for no expiration)
Successful Response
Schema returned only on token creation, includes the full token once.
Masked preview of the token (e.g., 'pat_abc...xyz')
Full token string - save this, it won't be shown again