Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/artemis-development-group/artemis/llms.txt

Use this file to discover all available pages before exploring further.

Artemis implements OAuth 2.0 for delegated API access. This page walks through every step of the OAuth2 lifecycle from a client perspective: registering an application, sending users through the authorization flow, exchanging the authorization code for access and refresh tokens, keeping tokens fresh, and revoking them when they are no longer needed. Script and personal-use app flows using the password grant are also covered. For a high-level comparison of the available flows, see the authentication overview.

Registering your application

All OAuth2 clients must be registered at /prefs/apps before they can request tokens.
FieldDescription
NameDisplay name shown to users during the authorization prompt.
App typeweb app (confidential, server-side), installed app (non-confidential, distributed), or script (personal use / bots).
DescriptionOptional. Displayed to users on the authorization screen.
Redirect URIThe URI Artemis redirects users to after they approve or deny access. Must exactly match the redirect_uri you send in every authorization request.
After saving you receive a client ID and, for confidential clients, a client secret. Keep the secret private and never expose it in client-side code.

OAuth2 scopes

Scopes define what parts of the API an access token is permitted to use. You request scopes as a space-separated string during authorization.
ScopeNameWhat it grants
identityMy IdentityRead the authenticated user’s username and signup date.
accountUpdate account informationUpdate preferences and account information (not email or password).
readRead ContentAccess posts and comments through the user’s account.
submitSubmit ContentSubmit links and comments from the user’s account.
editEdit PostsEdit and delete the user’s comments and submissions.
voteVoteSubmit and change votes on comments and submissions.
saveSave ContentSave and unsave comments and submissions.
historyHistoryAccess voting history, saved, and hidden content.
reportReport contentReport content for rules violations. Hide and show individual submissions.
subscribeEdit My SubscriptionsManage branch subscriptions and the friends list.
mybranchesMy BranchesAccess the list of branches the user moderates, contributes to, and subscribes to.
flairManage My FlairSelect branch flair and change link flair on submissions.
privatemessagesPrivate MessagesAccess the inbox and send private messages.
cbranchesSpend artemis gold cbranchesSpend gold cbranches to give gold to other users.
modconfigModerate Branch ConfigurationManage configuration, sidebar, and CSS of moderated branches.
modcontributorsApprove submitters and ban usersAdd or remove approved submitters; ban, unban, mute, and unmute users.
modflairModerate FlairManage and assign flair in moderated branches.
modlogModeration LogAccess the moderation log in moderated branches.
modothersInvite or remove other moderatorsInvite or remove moderators from moderated branches.
modpostsModerate PostsApprove, remove, mark NSFW, and distinguish content in moderated branches.
modselfModerator and contributor statusAccept moderator invitations; remove self as moderator or contributor.
modtrafficBranch TrafficAccess traffic stats in moderated branches.
modwikiModerate WikiChange wiki page editors and visibility in moderated branches.
wikieditWiki EditingEdit wiki pages on the user’s behalf.
wikireadRead Wiki PagesRead wiki pages through the user’s account.
Script apps (password grant) receive the * full-access scope by default if no explicit scope is requested.
You can query the live scope list at any time:
GET /api/v1/scopes
Pass a comma or space-separated list of scope names in the scopes query parameter to filter the response to specific scopes.

Authorization code flow

Use this flow for web and installed applications that act on behalf of other Artemis users.
1

Redirect the user to /api/v1/authorize

Send the user’s browser to the authorization endpoint with the following query parameters:
query.client_id
string
required
Your application’s client ID from /prefs/apps.
query.response_type
string
required
Must be code for the authorization code flow, or token for the implicit flow (non-confidential installed apps only; does not issue refresh tokens).
query.state
string
required
An opaque value you generate to maintain state between the request and callback. Artemis returns this value unchanged in the redirect. Use it to prevent CSRF attacks.
query.redirect_uri
string
required
Must exactly match the redirect URI registered for your application.
query.scope
string
required
Space-separated list of scopes to request. See the scope table above.
query.duration
string
default:"temporary"
temporary for a short-lived access token only. permanent to also receive a refresh token that can be used to obtain new access tokens without re-authorization.
GET https://<your-artemis-instance>/api/v1/authorize
  ?client_id=YOUR_CLIENT_ID
  &response_type=code
  &state=RANDOM_STATE_VALUE
  &redirect_uri=https://yourapp.example.com/callback
  &scope=identity%20read%20submit
  &duration=permanent
Artemis displays an authorization page where the user can approve or deny your request.
2

Handle the redirect callback

If the user approves, Artemis redirects to your redirect_uri with the following query parameters appended:
  • code — a short-lived, single-use authorization code.
  • state — the exact value you passed in step 1.
Verify that state matches the value you originally sent, then proceed to exchange the code.If the user denies the request, the redirect instead contains error=access_denied and the state value.
3

Exchange the code for tokens

Make a server-side POST request to /api/v1/access_token. The request must use HTTP Basic authentication with your client ID as the username and client secret as the password.
body.grant_type
string
required
Must be authorization_code.
body.code
string
required
The authorization code received in the redirect callback.
body.redirect_uri
string
required
Must exactly match the redirect_uri used in the authorization request.
curl -X POST https://<your-artemis-instance>/api/v1/access_token \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d "grant_type=authorization_code" \
  -d "code=AUTHORIZATION_CODE" \
  -d "redirect_uri=https://yourapp.example.com/callback"
A successful response:
{
  "access_token": "eyJhbGciOiJSUzI1NiJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "scope": "identity read submit",
  "refresh_token": "eyJhbGciOiJSUzI1NiJ9..."
}
refresh_token is only present when duration=permanent was requested.

Token response fields

access_token
string
required
The bearer token to include in API requests.
token_type
string
required
Always bearer.
expires_in
number
required
Seconds until the access token expires. Typically 3600 (one hour).
scope
string
required
Space-separated list of scopes granted to this token.
refresh_token
string
Present only on permanent grants. Use this to obtain new access tokens without re-authorization.

Refreshing an access token

When an access token expires, use the refresh token to obtain a new one without sending the user through the authorization flow again.
body.grant_type
string
required
Must be refresh_token.
body.refresh_token
string
required
The refresh token returned during the initial token exchange.
curl -X POST https://<your-artemis-instance>/api/v1/access_token \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d "grant_type=refresh_token" \
  -d "refresh_token=YOUR_REFRESH_TOKEN"
A successful response returns a new access_token and expires_in. The refresh token itself remains valid and can be reused for subsequent refreshes.
{
  "access_token": "eyJhbGciOiJSUzI1NiJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "scope": "identity read submit"
}
If the refresh token is invalid, expired, or was issued to a different client, the response is 400 Bad Request with "error": "invalid_grant". In this case the user must re-authorize your application.

Revoking tokens

Revoke an access or refresh token when the user disconnects your application or when you no longer need the token. Revoking a refresh token does not automatically revoke existing access tokens derived from it.
body.token
string
required
The token string to revoke (access token or refresh token).
body.token_type_hint
string
Optional hint to help the server locate the token faster. One of access_token or refresh_token.
curl -X POST https://<your-artemis-instance>/api/v1/revoke_token \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d "token=TOKEN_TO_REVOKE" \
  -d "token_type_hint=access_token"
A successful revocation returns 204 No Content with an empty body. The endpoint also returns 204 if the token does not exist or has already been revoked — the outcome (the token is no longer valid) is the same either way.

Script / personal-use apps (password grant)

If your app type is script and you are authenticating as one of the app’s registered developers, you can exchange credentials directly for a token without any browser redirect.
body.grant_type
string
required
Must be password.
body.username
string
required
Your Artemis username.
body.password
string
required
Your Artemis password.
body.scope
string
Space-separated list of scopes. If omitted, the token receives full access (*).
curl -X POST https://<your-artemis-instance>/api/v1/access_token \
  -u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
  -d "grant_type=password" \
  -d "username=YOUR_USERNAME" \
  -d "password=YOUR_PASSWORD"
{
  "access_token": "eyJhbGciOiJSUzI1NiJ9...",
  "token_type": "bearer",
  "expires_in": 3600,
  "scope": "*"
}
The password grant is restricted to script app types only. The authenticated user must be a registered developer of the application. Any other configuration returns "error": "unauthorized_client".

Using bearer tokens in API requests

Include the access token in the Authorization header on every authenticated API call:
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     https://<your-artemis-instance>/api/v1/me
curl https://<your-artemis-instance>/api/v1/me \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
A 403 Forbidden response means the token is valid but lacks the scope required by the endpoint. Request a new token with the necessary scopes.

Endpoint reference

EndpointMethodDescription
/api/v1/authorizeGETDisplay the authorization consent page to the user.
/api/v1/access_tokenPOSTExchange an authorization code, refresh token, or credentials for an access token.
/api/v1/revoke_tokenPOSTRevoke an access or refresh token.
/api/v1/scopesGETList available OAuth2 scopes and their descriptions.

Build docs developers (and LLMs) love