Skip to content

API Endpoints

The mycli API server provides REST endpoints for authentication, command management, library browsing, catalog syncing, profiles, and API tokens.

Most endpoints accept either credential:

  • JWT (Bearer) from my cli login.
  • API token (Bearer, myc_…) created by my cli token create. The token’s profile scope (if set) is honored by GET /v1/catalog.

Token-management routes (/v1/tokens/*) are JWT-only — API tokens cannot manage other tokens.

Request bodies are capped per route:

Route groupLimit
Default (all authenticated routes)256 KiB
POST /v1/libraries/{slug}/releases4 MiB

Oversized requests return 413 PAYLOAD_TOO_LARGE. The CLI pre-validates release payloads against the same limit so users see a clear local error before the wire-level rejection.

MethodPathDescription
POST/v1/auth/device/startStart device auth flow
POST/v1/auth/device/tokenPoll for device token
POST/v1/auth/device/resendResend OTP
POST/v1/auth/verify-codeVerify OTP code
POST/v1/auth/refreshRefresh access token
GET/v1/auth/verifyVerify magic link
POST/v1/auth/web/loginStart web auth flow
POST/v1/auth/web/verifyVerify web auth
GET/v1/usernames/{username}/availableCheck username availability
GET/healthHealth check
MethodPathDescription
GET/v1/librariesSearch libraries
GET/v1/libraries/{owner}/{slug}Library detail
GET/v1/libraries/{owner}/{slug}/releasesList releases
GET/v1/libraries/{owner}/{slug}/releases/{version}Get a release
GET/v1/libraries/{owner}/{slug}/commands/{commandSlug}Get a command
GET/v1/libraries/{owner}/{slug}/commands/{commandSlug}/versionsList command versions

Authenticated endpoints (no username required)

Section titled “Authenticated endpoints (no username required)”
MethodPathDescription
GET/v1/meCurrent user info
PATCH/v1/me/usernameSet username
GET/v1/sessionsList sessions
DELETE/v1/sessions/{id}Revoke a session
DELETE/v1/sessionsRevoke all sessions
POST/v1/auth/logoutLog out (revoke current session)

These routes accept JWT credentials only. An API token cannot manage tokens.

MethodPathDescription
POST/v1/tokensCreate an API token. Body: {name, expires_in?, profile_id?}. Returns the raw myc_… token once. Max 10 per user; 409 TOKEN_LIMIT_REACHED over the cap.
GET/v1/tokensList the user’s tokens (prefix + last-used + expiry; raw secret never returned).
DELETE/v1/tokens/{id}Revoke a token by ID.

Authenticated endpoints (username required)

Section titled “Authenticated endpoints (username required)”
MethodPathDescription
GET/v1/me/sync-summarySync summary (commands + default-profile libraries)
POST/v1/commandsCreate a command
GET/v1/commandsList commands
GET/v1/commands/{id}Get a command
DELETE/v1/commands/{id}Delete a command (soft delete)
POST/v1/commands/{id}/versionsPublish a version
GET/v1/commands/{id}/versions/{version}Get a specific version
GET/v1/catalogSynced catalog (supports ETag / If-None-Match). Scope with ?profile=<slug>; otherwise falls back to the API token’s profile_id and then to the user’s default profile.
POST/v1/libraries/{slug}/releasesCreate a release (body limit: 4 MiB)
MethodPathDescription
POST/v1/profilesCreate a profile (slug must match ^[a-z][a-z0-9-]*$)
GET/v1/profilesList the user’s profiles
GET/v1/profiles/{slug}Get a profile + its libraries (with commands)
PATCH/v1/profiles/{slug}Update name / description. Slug is immutable.
DELETE/v1/profiles/{slug}Delete a profile. Rejects the default profile. If the profile has scoped API tokens, returns 409 HAS_SCOPED_TOKENS unless ?force=true.
POST/v1/profiles/{slug}/librariesAdd a library to a profile. Body: {library: "owner/slug"} or {library: "slug"} for system libraries.
DELETE/v1/profiles/{slug}/libraries/{owner}/{libSlug}Remove a library from a profile
GET/v1/profiles/{slug}/librariesList a profile’s libraries

Common JSON error envelopes returned by the API:

CodeStatusNotes
INVALID_REQUEST400Malformed body or invalid field
INVALID_SPEC400Spec failed JSON Schema validation
UNAUTHORIZED401Missing or invalid credential
JWT_REQUIRED403Endpoint requires JWT (e.g., /v1/tokens/*)
USERNAME_REQUIRED403Endpoint requires a set username
NOT_FOUND404Entity does not exist or is not owned by the caller
PROFILE_EXISTS409Duplicate profile slug
RELEASE_EXISTS409Library release version already published
HAS_SCOPED_TOKENS409Profile delete blocked by scoped tokens; retry with ?force=true
TOKEN_LIMIT_REACHED409User has 10 API tokens; revoke one first
PAYLOAD_TOO_LARGE413Body exceeds the route’s limit (256 KiB / 4 MiB)
RATE_LIMITED429Rate limit exceeded
INTERNAL_ERROR500Server-side failure

All entity IDs use prefixed UUIDs:

PrefixEntity
usr_User
cmd_Command
cv_Command version
ml_Mailing list
lib_Library