Settings
These are the docs for the settings endpoints. Used for getting and changing the settings of your user, as well as local browser (cookie-based) settings.
Errors are returned in the usual v3 error format described in getting started.
Get the settings
Returns the settings. If requesting as the logged in user, it will return settings saved on the user. If not logged in it will return the settings for the browser session, identified by the pastemyst_session_settings cookie.
GET /api/v3/settings
If not logged in, and the request doesn't have a valid pastemyst_session_settings cookie, a new session is created with the default settings (the ones shown below), and the response sets the pastemyst_session_settings cookie. Session settings that haven't been accessed in 30 days get deleted.
Required scope
user or user:read (if logged in)
Response
{
"copyLinkOnCreate": false,
"darkTheme": "myst",
"defaultIndentationUnit": "spaces",
"defaultIndentationWidth": 4,
"defaultLanguage": "Autodetect",
"followSystemTheme": false,
"pasteView": "tabbed",
"textWrap": true,
"theme": "myst"
}
Errors
403 Forbiddenif logged in and missing theuseroruser:readscope.
Update the settings
Updates the settings. If requesting as the logged in user, it will update the settings saved on the user. If not logged in it will update the settings of the browser session from the pastemyst_session_settings cookie.
PATCH /api/v3/settings
The whole settings object gets replaced, any field you leave out is reset to its default value. Always send all of the fields.
This endpoint doesn't create the session cookie. If not logged in, call GET /api/v3/settings first to get one.
Required scope
user (if logged in)
Request
{
"copyLinkOnCreate": false,
"darkTheme": "myst",
"defaultIndentationUnit": "spaces",
"defaultIndentationWidth": 4,
"defaultLanguage": "Autodetect",
"followSystemTheme": false,
"pasteView": "tabbed",
"textWrap": true,
"theme": "myst"
}
Errors
403 Forbiddenif logged in and missing theuserscope.400 Bad Request(Can't update the settings since the user is not logged in and the session settings cookie is missing.) if not logged in and there's nopastemyst_session_settingscookie.400 Bad Request(The session settings cookie has probably expired.) if not logged in and the session from the cookie doesn't exist anymore.
Get the user settings
Returns the user settings of the currently logged in user.
GET /api/v3/settings/user
Update the user settings
Updates the user settings of the currently logged in user.
PATCH /api/v3/settings/user
Update the username
Updates the currently logged in user's username (if available).
PATCH /api/v3/settings/username
The new username must contain only letters, digits and the ., -, _ symbols.
The maximum length is 20 characters.
Usernames are compared ignoring case, so you can't take a username that differs from an existing one only in case, and you can't change only the case of your own username.
Required scope
user
Request
{
"username": "NewUsername"
}
Errors
400 Bad Requestif the username is missing, too long, or contains characters that aren't allowed.400 Bad Request(Same username.) if the new username is the same as your current one.400 Bad Request(Username already taken.) if another user already has that username.401 Unauthorized(You need to be authorized to change settings.) if not logged in.403 Forbiddenif missing theuserscope.
Update the avatar
Updates the currently logged in user's avatar.
PATCH /api/v3/settings/avatar
You should make the request as a multipart/form-data request, with the image attached in a field named file.
Required scope
user
Errors
400 Bad Requestif thefilefield is missing.401 Unauthorized(You need to be authorized to change settings.) if not logged in.403 Forbiddenif missing theuserscope.