Skip to content

Markdown ソース

生の markdown をそのまま参照でき、コピー、自動化、AI agent に使えます。

Markdown を表示

OAuth API

App を取得する

prolog
GET API_BASE/apps/:app_id

パラメータ

ParameterTypeDescription
app_idstringapp ID

レスポンス

json
{
  "data": AppObject,
  "ts": 1723923923
}

認可する

prolog
GET API_BASE/oauth/authorize?client_id=:client_id&redirect_uri=:redirect_uri&scope=:scope&state=:state&code_challenge=:code_challenge&code_challenge_method=:method&json=:json

認可要否

OAuthAPIKey
YesYes

クエリパラメータ

ParameterTypeDescription
client_idstringOAuth client ID
redirect_uristringリダイレクト URI(app 設定と一致する必要あり)
scopestringOAuth scope(例: user.public, post.write, credit.read
statestringOAuth state 値
code_challengestringPKCE challenge
code_challenge_methodstringS256 または plain(デフォルト: S256
jsonstringtrue を指定するとリダイレクトではなく JSON を返す

レスポンス

  • デフォルトでは redirect_uricodestate を付けてリダイレクトします
  • json=true の場合は次を返します
json
{
  "data": {
    "client_id": "app_id",
    "redirect_uri": "https://...",
    "url": "https://...",
    "code": "...",
    "state": "..."
  },
  "ts": 1723923923
}

Scopes

ScopeDescription
user.publicユーザーの基本プロフィール情報を読み取る
user.fullユーザーの詳細プロフィール情報を読み取る
post.writePost と関連コンテンツの読み書き・管理
credit.readCredits 残高と台帳を読み取る
credit.full*Credits 残高と台帳を読み取り、Credits を消費する
apikey.readAPI Key の読み取りとハッシュ検証
  • trusted app が必要です。public app ではこの scope を要求できません。

Token

prolog
POST API_BASE/oauth/token

リクエストボディ(Form)

text
grant_type=authorization_code
client_id=...
redirect_uri=...
code=...
code_verifier=...

refresh の場合:

text
grant_type=refresh_token
client_id=...
refresh_token=...

レスポンス

ラッパーなしの生 JSON を返します。

json
{
  "access_token": "...",
  "token_type": "Bearer",
  "refresh_token": "...",
  "expires_in": 2592000,
  "expiry": "2025-04-19T00:00:00Z"
}

UserInfo

prolog
GET API_BASE/oauth/userinfo

認可要否

OAuthAPIKey
YesNo

レスポンス

ラッパーなしの生 JSON を返します。sub は app ごとの pairwise OAuth user ID、uuid はユーザーの global UUID です。Email 関連フィールドは利用可能な場合のみ含まれます。

json
{
  "sub": "...",
  "uuid": "...",
  "name": "User Name",
  "picture": "https://...",
  "email": "user@example.com",
  "email_verified": true
}

App を revoke する

prolog
DELETE API_BASE/oauth/apps/:app_id

認可要否

OAuthAPIKey
YesYes

レスポンス

json
{
  "data": null,
  "ts": 1723923923
}