Change the caller's own language
const url = 'https://example.com/v1/me';const options = { method: 'PATCH', headers: { cookie: 'affectra_session=<affectra_session>', 'Content-Type': 'application/json' }, body: '{"locale":"en"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/v1/me \ --header 'Content-Type: application/json' \ --cookie affectra_session=<affectra_session> \ --data '{ "locale": "en" }'Only for a person signed in with the browser session; API keys, user tokens and GitHub Actions tokens get 403 auth.sessionRequired. It changes only the caller’s own user and takes no user ID. The preference is the person’s, the same in every organization.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The language, or null to follow the browser again
Responses
Section titled “Responses”The caller, with the new language
object
Kind=key: the key’s organization
Kind=key: the key’s stored role, viewer or member; a key never acts above member
Kind=user: the user ID
Kind=user
Kind=user
Kind=user: their language, or null to follow the browser
Kind=github: owner/name
Kind=user: what this server has switched on, so the web app shows only what works
object
The webhook endpoint routes are available
Kind=user: memberships, sorted by org
object
Viewer reads; member also submits reports; admin also manages keys and members; owner also billing
Only active organizations can be used; the others answer 403 org.suspended
Example
{ "kind": "key", "role": "viewer", "locale": "en", "orgs": [ { "role": "viewer", "status": "active" } ]}Locale.invalid, or request.invalidJson
Missing or invalid credentials
Auth.sessionRequired, or auth.csrfMissing (no X-Affectra-CSRF header)
Over the operation’s rate-limit budget (x-affectra-budget): code request.rateLimited with params.budget. Wait Retry-After seconds before trying again.
Every error answer, Content-Type
application/problem+json. The web app and integrations translate code; detail is English,
for people reading curl output or CI logs, and may change wording at
any time. Match on code, never on detail.
object
The HTTP status
Stable error codes. A code is never renamed; new ones may be added, so
a client falls back to detail for a code it doesn’t know. Another
organization’s object answers notFound, the same as a missing one.
What went wrong
Values the code’s message needs, e.g. {“field”: “version”}. Only values the caller sent or may see. Empty when the message needs none.
object
Example
{ "code": "notFound"}Headers
Section titled “Headers”Seconds until a request would be allowed again, at least 1