API Guide
Rin exposes an API-key based interface that lets scripts or AI agents manage site content and settings without a login session. Every endpoint lives under /api/key/.
Creating an API key
Only administrators can create API keys. Sign in as an administrator, open the admin Settings page, and scroll to the API keys section at the bottom to create, edit, rotate, and delete keys.
Each key belongs to the administrator who created it, and other accounts never see those keys.
When creating a key you choose:
- Name: a label you can edit at any time.
- Scopes: the capabilities this key may use. Each feature area is a separate scope.
- Storage mode:
- Encrypted (default): the key is shown once at creation, then only rotation is available.
- Revealable: the key is stored encrypted and can be revealed and copied at any time.
Storage mode is fixed at creation. An encrypted key can never become revealable; a revealable key can have that capability turned off at any time, and the key keeps working, it just stops showing the plaintext. Create a new key if you need one you can reveal later.
Making requests
Send the key in a request header. Both forms are equivalent:
Keys are 32 characters. A missing or invalid key returns 401; a valid key without the required scope returns 403.
Inspecting the current key
The response lists the key's scopes and the endpoints available for each one:
Scopes and endpoints
Articles
Create an article
Edit an article
Only send the fields you want to change; omitted fields keep their current values.
Delete an article
Friend links
Create a friend link
Edit a friend link
Delete a friend link
Moments
Create a moment
Edit a moment
Delete a moment
Settings
Settings endpoints follow GET /api/key/config/{section} to read and POST /api/key/config/{section} to write. A write may only contain keys allowed for that section; out-of-range keys make the request fail with 400 and the rejected key names.
Writable keys by section
The favicon is not writable through any section.
Testing the webhook
Values such as webhook_url in the body override the saved configuration for this single test only.
Clearing the cache
Content ownership
Articles and moments created through the API are attributed to user ID 1. To use a different account, change API_KEY_CONTENT_OWNER_UID in server/src/services/api-key-owner.ts and redeploy.
Error responses
Security notes
- Create one key per use case and grant only the scopes it needs.
- Never ship a key in browser code or a public repository.
- Rotate or delete a key immediately if you suspect a leak.
- Delete keys you no longer use.