Overview
The Instance API provides endpoints to retrieve instance profile information and manage instance-wide settings. These settings control core behaviors like user registration, storage backends, and memo-related policies.
See: server/router/api/v1/instance_service.go
Get Instance Profile
Returns basic information about the Memos instance. This is a public endpoint (no authentication required) used to check instance status and determine if initial setup is needed.
GET /api/v1/instance/profile
curl https://your-memos-instance.com/api/v1/instance/profile
Request
No authentication or parameters required. This endpoint is publicly accessible.
Response
The current version of the Memos instance (e.g., "0.28.0")
Whether the instance is running in demo mode with sample data
The base URL of the instance (e.g., "https://memos.example.com")
The first administrator who set up this instance. When null, the instance requires initial setup (creating the first admin account). Resource name of the admin user. Format: users/{user_id}
Example Response
Configured Instance:
{
"version" : "0.28.0" ,
"demo" : false ,
"instanceUrl" : "https://memos.example.com" ,
"admin" : {
"name" : "users/101" ,
"username" : "admin" ,
"role" : "ADMIN" ,
"email" : "[email protected] "
}
}
Unconfigured Instance (needs setup):
{
"version" : "0.28.0" ,
"demo" : false ,
"instanceUrl" : "" ,
"admin" : null
}
Usage
Check if instance needs setup:
#!/bin/bash
RESPONSE = $( curl -s https://your-memos-instance.com/api/v1/instance/profile )
HAS_ADMIN = $( echo $RESPONSE | jq -r '.admin != null' )
if [ " $HAS_ADMIN " = "false" ]; then
echo "Instance requires setup - create first admin account"
else
echo "Instance already configured"
fi
Get Instance Setting
Retrieves a specific instance setting configuration. Requires admin authentication.
GET /api/v1/instance/settings/{setting}
curl https://your-memos-instance.com/api/v1/instance/settings/GENERAL \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Path Parameters
The setting type to retrieve. One of:
GENERAL - General instance settings (registration, authentication, branding)
STORAGE - Storage backend configuration (local, S3, database)
MEMO_RELATED - Memo-related settings (visibility, reactions, content limits)
Response
The resource name of the setting. Format: instance/settings/{setting}
General instance settings. Only present when requesting GENERAL setting. disallow_user_registration
When true, new user registration is disabled. Only admins can create accounts.
When true, password-based authentication is disabled. Users must use SSO.
Custom JavaScript code injected into the web UI (e.g., analytics scripts)
Custom CSS styles injected into the web UI (e.g., theme overrides)
Custom branding for the instance Custom instance title (shown in browser tab and header)
Instance description (shown on login page)
Week start day offset from Sunday. Default: 0 (Sunday)
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
When true, users cannot change their username after creation
When true, users cannot change their display name
Storage configuration. Only present when requesting STORAGE setting. Storage backend type:
DATABASE - Store files in the database (default, not recommended for large files)
LOCAL - Store files on local filesystem
S3 - Store files in S3-compatible object storage (AWS S3, MinIO, Cloudflare R2)
Template for file paths. Supports variables:
{timestamp} - Unix timestamp
{filename} - Original filename
{uuid} - Random UUID
Example: "assets/{timestamp}_{filename}" Maximum upload size in megabytes. Default: 32 MB
S3 configuration (only used when storage_type is S3) AWS access key ID or equivalent for S3-compatible storage
AWS secret access key (returned as empty string for security)
S3 endpoint URL (e.g., "s3.amazonaws.com", "https://r2.cloudflarestorage.com")
AWS region (e.g., "us-east-1")
Use path-style URLs (true) instead of virtual-hosted-style (false). Required for MinIO and some S3-compatible services.
Memo-related policies. Only present when requesting MEMO_RELATED setting. disallow_public_visibility
When true, users cannot create public memos. All memos must be private or protected.
When true, memos are ordered and displayed by update time instead of creation time
Maximum memo content length in bytes. Default: 8192 (8 KB)
When true, double-clicking a memo opens the editor
Array of allowed reaction emojis (e.g., ["👍", "❤️", "😄"]). Empty array means all emojis allowed.
Example Responses
General Settings:
{
"name" : "instance/settings/GENERAL" ,
"generalSetting" : {
"disallowUserRegistration" : false ,
"disallowPasswordAuth" : false ,
"additionalScript" : "" ,
"additionalStyle" : "" ,
"customProfile" : {
"title" : "My Memos Instance" ,
"description" : "A personal knowledge base" ,
"logoUrl" : "https://example.com/logo.png"
},
"weekStartDayOffset" : 1 ,
"disallowChangeUsername" : false ,
"disallowChangeNickname" : false
}
}
Storage Settings:
{
"name" : "instance/settings/STORAGE" ,
"storageSetting" : {
"storageType" : "S3" ,
"filepathTemplate" : "assets/{timestamp}_{filename}" ,
"uploadSizeLimitMb" : 100 ,
"s3Config" : {
"accessKeyId" : "AKIAIOSFODNN7EXAMPLE" ,
"accessKeySecret" : "" ,
"endpoint" : "s3.us-east-1.amazonaws.com" ,
"region" : "us-east-1" ,
"bucket" : "memos-uploads" ,
"usePathStyle" : false
}
}
}
Memo Related Settings:
{
"name" : "instance/settings/MEMO_RELATED" ,
"memoRelatedSetting" : {
"disallowPublicVisibility" : false ,
"displayWithUpdateTime" : false ,
"contentLengthLimit" : 8192 ,
"enableDoubleClickEdit" : true ,
"reactions" : [ "👍" , "👎" , "❤️" , "😄" , "🎉" , "🚀" ]
}
}
Error Responses
Invalid Argument - Invalid setting name
Unauthenticated - User not authenticated
Permission Denied - User is not an admin
Not Found - Setting not found or not configured
Update Instance Setting
Updates an instance setting. Supports partial updates via field masks. Requires admin authentication.
PATCH /api/v1/instance/settings/{setting}
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/GENERAL \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/GENERAL",
"generalSetting": {
"disallowUserRegistration": true,
"customProfile": {
"title": "Team Memos"
}
}
},
"updateMask": {
"paths": ["general_setting.disallow_user_registration", "general_setting.custom_profile.title"]
}
}'
Path Parameters
The setting type to update: GENERAL, STORAGE, or MEMO_RELATED
Request Body
The setting object with updated fields. Must include name field matching the path parameter.
Optional field mask specifying which fields to update. If omitted, all fields are updated. Array of field paths to update (e.g., ["general_setting.disallow_user_registration"])
Updatable Fields
General Settings:
general_setting.disallow_user_registration
general_setting.disallow_password_auth
general_setting.additional_script
general_setting.additional_style
general_setting.custom_profile.title
general_setting.custom_profile.description
general_setting.custom_profile.logo_url
general_setting.week_start_day_offset
general_setting.disallow_change_username
general_setting.disallow_change_nickname
Storage Settings:
storage_setting.storage_type
storage_setting.filepath_template
storage_setting.upload_size_limit_mb
storage_setting.s3_config.access_key_id
storage_setting.s3_config.access_key_secret
storage_setting.s3_config.endpoint
storage_setting.s3_config.region
storage_setting.s3_config.bucket
storage_setting.s3_config.use_path_style
Memo Related Settings:
memo_related_setting.disallow_public_visibility
memo_related_setting.display_with_update_time
memo_related_setting.content_length_limit
memo_related_setting.enable_double_click_edit
memo_related_setting.reactions
Response
Returns the updated setting object (same structure as Get Instance Setting).
Examples
Disable User Registration:
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/GENERAL \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/GENERAL",
"generalSetting": {
"disallowUserRegistration": true
}
},
"updateMask": {
"paths": ["general_setting.disallow_user_registration"]
}
}'
Configure S3 Storage:
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/STORAGE \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/STORAGE",
"storageSetting": {
"storageType": "S3",
"uploadSizeLimitMb": 100,
"s3Config": {
"accessKeyId": "YOUR_KEY_ID",
"accessKeySecret": "YOUR_SECRET",
"endpoint": "s3.amazonaws.com",
"region": "us-east-1",
"bucket": "memos-uploads",
"usePathStyle": false
}
}
},
"updateMask": {
"paths": [
"storage_setting.storage_type",
"storage_setting.upload_size_limit_mb",
"storage_setting.s3_config"
]
}
}'
Set Custom Branding:
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/GENERAL \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/GENERAL",
"generalSetting": {
"customProfile": {
"title": "Acme Corp Memos",
"description": "Internal knowledge sharing platform",
"logoUrl": "https://acme.com/logo.png"
}
}
},
"updateMask": {
"paths": ["general_setting.custom_profile"]
}
}'
Limit Memo Content Length:
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/MEMO_RELATED \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/MEMO_RELATED",
"memoRelatedSetting": {
"contentLengthLimit": 16384
}
},
"updateMask": {
"paths": ["memo_related_setting.content_length_limit"]
}
}'
Configure Allowed Reactions:
curl -X PATCH https://your-memos-instance.com/api/v1/instance/settings/MEMO_RELATED \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/MEMO_RELATED",
"memoRelatedSetting": {
"reactions": ["👍", "👎", "❤️", "🎉"]
}
},
"updateMask": {
"paths": ["memo_related_setting.reactions"]
}
}'
Error Responses
Invalid Argument - Invalid setting name, invalid field values, or invalid update mask
Unauthenticated - User not authenticated
Permission Denied - User is not an admin
Not Found - Setting not found
Common Use Cases
Check Instance Setup Status
#!/bin/bash
# Determine if instance needs initial setup
PROFILE = $( curl -s https://your-memos-instance.com/api/v1/instance/profile )
NEEDS_SETUP = $( echo $PROFILE | jq -r '.admin == null' )
if [ " $NEEDS_SETUP " = "true" ]; then
echo "Instance needs setup - creating first admin account"
# Create first admin user
curl -X POST https://your-memos-instance.com/api/v1/users \
-H "Content-Type: application/json" \
-d '{
"user": {
"username": "admin",
"password": "secure_password",
"role": "ADMIN"
}
}'
else
echo "Instance already configured"
echo "Admin: $( echo $PROFILE | jq -r '.admin.username')"
echo "Version: $( echo $PROFILE | jq -r '.version')"
fi
#!/bin/bash
# Lock down instance for private use
BASE_URL = "https://your-memos-instance.com"
TOKEN = "YOUR_ADMIN_TOKEN"
# Disable user registration
curl -X PATCH " $BASE_URL /api/v1/instance/settings/GENERAL" \
-H "Authorization: Bearer $TOKEN " \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/GENERAL",
"generalSetting": {
"disallowUserRegistration": true
}
},
"updateMask": {"paths": ["general_setting.disallow_user_registration"]}
}'
# Disable public memos
curl -X PATCH " $BASE_URL /api/v1/instance/settings/MEMO_RELATED" \
-H "Authorization: Bearer $TOKEN " \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/MEMO_RELATED",
"memoRelatedSetting": {
"disallowPublicVisibility": true
}
},
"updateMask": {"paths": ["memo_related_setting.disallow_public_visibility"]}
}'
echo "Instance configured for private use"
Migrate to S3 Storage
#!/bin/bash
# Switch from database/local storage to S3
BASE_URL = "https://your-memos-instance.com"
TOKEN = "YOUR_ADMIN_TOKEN"
curl -X PATCH " $BASE_URL /api/v1/instance/settings/STORAGE" \
-H "Authorization: Bearer $TOKEN " \
-H "Content-Type: application/json" \
-d '{
"setting": {
"name": "instance/settings/STORAGE",
"storageSetting": {
"storageType": "S3",
"filepathTemplate": "memos/{timestamp}_{filename}",
"uploadSizeLimitMb": 100,
"s3Config": {
"accessKeyId": "' $S3_ACCESS_KEY '",
"accessKeySecret": "' $S3_SECRET_KEY '",
"endpoint": "s3.amazonaws.com",
"region": "us-east-1",
"bucket": "my-memos-bucket",
"usePathStyle": false
}
}
}
}'
echo "Storage migrated to S3"
Changing storage settings does not migrate existing files. You must manually migrate attachments from the old storage backend to the new one.
Next Steps
Authentication Learn about authentication methods and admin privileges
Users Manage user accounts and permissions
Configuration Guide Configure instance settings via environment variables
Storage Configuration Set up S3, local, or database storage