Overview
Shortcuts are saved filters that allow users to quickly access commonly used memo views. Each shortcut consists of a title and a CEL filter expression. Shortcuts are user-specific and stored as user settings.List Shortcuts
Retrieves all shortcuts for a specific user. Users can only access their own shortcuts.
GET /api/v1/users/{user_id}/shortcuts
Path Parameters
The ID of the user whose shortcuts to retrieve. Format:
users/{user_id}Response
Array of shortcut objects
Error Responses
Invalid Argument - Invalid user name format
Unauthenticated - User not authenticated
Permission Denied - User cannot access another user’s shortcuts
Example Response
Get Shortcut
Retrieves a single shortcut by its ID.
GET /api/v1/users/{user_id}/shortcuts/{shortcut_id}
Path Parameters
The ID of the user who owns the shortcut
The ID of the shortcut to retrieve
Response
Returns a shortcut object (same structure as in List Shortcuts).Error Responses
Invalid Argument - Invalid shortcut name format
Unauthenticated - User not authenticated
Permission Denied - User cannot access another user’s shortcuts
Not Found - Shortcut does not exist
Create Shortcut
Creates a new shortcut for a user. The filter expression is validated before creation.
POST /api/v1/users/{user_id}/shortcuts
Path Parameters
The ID of the user who will own the shortcut. Format:
users/{user_id}Request Body
The shortcut to create
If true, validates the shortcut without actually creating it. Useful for testing filter syntax. Default:
falseResponse
Returns the created shortcut object with a generatedshortcut_id in the name field.
Error Responses
Invalid Argument
- Missing required
titlefield - Invalid filter expression syntax
- Filter references unsupported fields or operators
Unauthenticated - User not authenticated
Permission Denied - User cannot create shortcuts for another user
Example Response
Update Shortcut
Updates specific fields of a shortcut using field masks. The filter is validated if being updated.
PATCH /api/v1/users/{user_id}/shortcuts/{shortcut_id}
Path Parameters
The ID of the user who owns the shortcut
The ID of the shortcut to update
Request Body
The shortcut object with updated fields. Must include
name field.Specifies which fields to update. If omitted, all fields are updated.
Updatable Fields
title- Display title (cannot be empty)filter- Filter expression (validated before update)
Response
Returns the updated shortcut object.Error Responses
Invalid Argument
- Empty title
- Invalid filter expression
- Missing or empty update_mask
Unauthenticated - User not authenticated
Permission Denied - User cannot update another user’s shortcuts
Not Found - Shortcut does not exist
Delete Shortcut
Deletes a shortcut. This operation is permanent.
DELETE /api/v1/users/{user_id}/shortcuts/{shortcut_id}
Path Parameters
The ID of the user who owns the shortcut
The ID of the shortcut to delete
Response
Returns empty response on success.Error Responses
Invalid Argument - Invalid shortcut name format
Unauthenticated - User not authenticated
Permission Denied - User cannot delete another user’s shortcuts
Not Found - Shortcut does not exist
Filter Expressions
Shortcuts use CEL (Common Expression Language) for defining filter criteria. The filter is compiled and validated against the database schema.
Supported Fields
creator_id- Creator’s user ID (integer)create_time- Creation timestampupdate_time- Last update timestampdisplay_time- Display timestamp for sortingvisibility- Visibility level:"PRIVATE","PROTECTED", or"PUBLIC"pinned- Boolean pinned statuscontent- Full memo content (use with caution, may be slow)name- Memo resource name
Supported Operators
- Comparison:
==,!=,<,<=,>,>= - Logical:
&&(AND),||(OR),!(NOT) - Membership:
in(e.g.,visibility in ["PUBLIC", "PROTECTED"]) - String:
.contains(),.startsWith(),.endsWith()
Built-in Functions
has_tag(tag_name)
Checks if a memo contains a specific tag.
timestamp(iso_string)
Converts an ISO 8601 timestamp string to a timestamp for comparison.
Example Filters
All work-related memos
Pinned public memos
Recent memos (last 7 days)
Memos from specific creator
Multiple tags (AND)
Multiple tags (OR)
Complex combination
Content search
Date range
Database Dialect Support
Filters are compiled to SQL and respect the database dialect:- SQLite: Default dialect
- MySQL: Handles MySQL-specific syntax
- PostgreSQL: Uses PostgreSQL-specific features
Best Practices
Naming Shortcuts
- Use descriptive titles that clearly indicate the filter’s purpose
- Keep titles concise (e.g., “Work”, “This Week”, “Important”)
- Consider using emoji for visual distinction (e.g., ”💼 Work”, ”⭐ Favorites”)
Filter Performance
- Prefer indexed fields like
creator_id,create_time, andvisibility - Avoid complex content searches on large datasets
- Use specific date ranges instead of open-ended queries when possible
- Test filters with
validate_only=truebefore creating
Common Use Cases
- Daily Journal:
has_tag("journal") && create_time > timestamp("TODAY") - Favorites:
pinned == true - Shared Memos:
visibility == "PUBLIC" - Work Tasks:
has_tag("work") && content.contains("TODO") - Recent Activity:
update_time > timestamp("LAST_7_DAYS")
Validation
- Always validate filter syntax before creating shortcuts
- Use the
validate_onlyparameter to test filters - Check error messages for specific syntax issues
- Test shortcuts with sample data to ensure expected results