---
title: Staff console
description: "Give the people who run your server the staff role, and what they do from the staff console."
sidebar:
  icon: shield-user
---

From the staff console you can find an account or a workspace, see how the server is doing, and act on accounts. It lives at `/admin` on your Peal address (`/fr/admin` in French), and its API under `/api/admin`.

## Make an account staff [#make-staff]

Staff are accounts with Better Auth's admin role. No page grants it. Set it in the database, then sign in again, because a session keeps the role it started with:

```sql
UPDATE auth."user" SET role = 'admin' WHERE email = 'you@example.com';
```

To take the role back, set `role` to `NULL`, then have other staff click **Sign out everywhere** on the account. The sessions it opened to act as someone else end on their next request, whatever it is. The server checks on each request that the staff member behind it is still staff and not banned, and the audit log records each end.

The console refuses anyone but staff in their own session, signed in or not, and answers 404 as if it weren't there. It also refuses an API key, an application acting through OAuth, and staff while they act as someone else. A banned staff account is refused at once.

> **Restrict the console at your edge**
>
> Peal's own servers also put `/admin`, `/en/admin`, `/fr/admin` and
> `/api/admin` behind Cloudflare Access. Behind your own edge, you can restrict
> them to your team's addresses the same way.

## What the console shows [#screens]

The console has these pages:

| Page              | What it shows                                                                                                                                                                                                                |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| System            | Whether the database answers, the release the server runs (`OTEL_SERVICE_VERSION`), the posts due within the hour, those overdue, and the channels to reconnect in every workspace                                           |
| Accounts          | Accounts by email, name or id, newest first, 25 a page                                                                                                                                                                       |
| An account        | Its name and email, whether the address is confirmed, its language, when it was created and last signed in, its ban, its workspaces and roles, how many sessions it has open, and whether two-step verification is on        |
| Workspaces        | Workspaces by name, slug or id, with their members                                                                                                                                                                           |
| A workspace       | Its members and roles, its plan and subscription, its channels and whether each works, how many posts it has in each status, the latest posts that failed or went unconfirmed, and whether it requires two-step verification |
| Contract requests | The requests to cancel a contract or withdraw from one that wait for staff, oldest first                                                                                                                                     |
| Audit log         | What staff did, newest first                                                                                                                                                                                                 |

Staff see who an account is, never what it wrote. They see no post's text, no image or video and no token. A failed post shows as its ids, its platform, why it failed and the platform's code. To see what a member sees, staff act as them ([Acting as an account](#acting-as)).

"Last signed in" is when the newest session the account opened itself started, while one is left. Sessions that staff open to act as it don't count.

## What staff do [#actions]

Each action asks why, and keeps the reason in the audit log with the staff member's name. Write what was asked, and no more about the person than you need.

The actions on an account are these:

| Action                          | What it does                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Ban**                         | For a day, a week, 30 days or until lifted. The account is signed out everywhere, including the sessions it opened as staff to act as someone else, and can't sign in or use its API keys meanwhile. **Lift the ban** undoes it.                                                                                                                                                                                |
| **Sign out everywhere**         | Ends every session of the account, on every device. That includes those staff opened to act as it, and those it opened as staff to act as someone else. Its API keys keep working.                                                                                                                                                                                                                              |
| **Send the confirmation again** | Emails a new link to confirm the address, in the account's language, while the address isn't confirmed.                                                                                                                                                                                                                                                                                                         |
| **Reset two-step verification** | For a person who lost their phone and their recovery codes, while it's on. It turns [two-step verification](/guides/workspace/account#two-step) off, deletes the authenticator and the recovery codes, forgets the browsers it trusted, signs the account out everywhere, and emails it. The person then signs in with their password, and may turn it on again. Owners can't reset a member's, only staff can. |
| **Act as this account**         | Signs the staff member's browser in as the account for an hour. A banner at the top of every page says whose account it is, with **Stop acting as them**, which brings back the staff member's own session.                                                                                                                                                                                                     |

> **Check who's asking before you reset two-step verification**
>
> An email from the account's address isn't proof, because the mailbox may be
> what was taken.

### Acting as an account [#acting-as]

While acting as an account, staff see its posts and media, and can write and edit drafts in its name. What they make carries the account's name as its author, and the audit log keeps who made it ([While staff act as an account](#impersonation-log)). They can read its notifications, but not mark them read. They can ask the writing assistant in its workspaces, and that counts toward those workspaces' daily requests.

They can't do any of this:

- Schedule or publish.
- Connect channels.
- Manage API keys or billing.
- Change its workspaces or the account.
- Let an application act for it.
- Turn its two-step verification on or off, see its key or make recovery codes.

They're never asked the second step, because the session is theirs, opened from the console. Whether a workspace that requires two-step verification opens follows the account's own setting. The app keeps the language of its address and of the staff member's browser, never the account's.

Staff never ban, sign out, reset the two-step verification of or act as themselves, and never act as other staff. No one deletes an account but its owner, from [their account settings](/guides/workspace/account#delete-account).

Better Auth's own admin endpoints under `/api/auth/admin/` are off, so nothing staff do bypasses the audit log. Only `POST /api/auth/admin/stop-impersonating` stays, which the banner calls.

## Require two-step verification of staff [#two-step]

An account's page says whether its two-step verification is on. A workspace's page says whether the workspace requires it of its members.

With `PEAL_STAFF_TWO_STEP=true` ([Environment variables](/self-hosting/environment-variables)), staff whose own account doesn't have it on are refused the console. They're told to turn it on in their account settings. Anyone who isn't staff still finds no console.

> **Require two-step verification only once every staff account has it**
>
> Set `PEAL_STAFF_TWO_STEP=true` only once every staff account has two-step
> verification on, or staff without it lose the console.

## Grant a partner account [#partners]

A partner account lets a product use Peal for its own customers, one workspace each, through the API ([Embedding Peal](/developers/embedding)). A workspace's page says where it stands. Either it has a partner account, with how many workspaces that account owns, or a partner owns it, with the partner's home workspace and the id the partner gave it.

Click **Grant a partner account** to open one for the workspace, named after it. It asks why, as every action does. The workspace's owners and admins then name it, create its keys and register where hosted pages send their customers back, under **Settings**, then **Partner**.

With [`PEAL_PARTNER_SELF_SERVICE`](/self-hosting/environment-variables#sign-in) set to `true`, they open one themselves. The audit log records each grant with the workspace.

A workspace a partner owns has no members. Staff read it as any other workspace, and nobody can act as a member of it.

## Handle contract requests [#contract-requests]

On a server that bills, anyone can cancel a contract or withdraw from one without signing in ([Plans and billing](/guides/workspace/billing#cancelling)). Two kinds of request are applied without anyone's help: one that gives its contract number, and one whose sender follows the link emailed to an address that manages a contract.

**Contract requests** lists the others, those no contract was found for and those whose sender hasn't followed their link yet. Each shows what its sender wrote and nothing else: their name, the address their acknowledgement went to, the contract as they named it, the day wanted, and the account that address signs in to, if any.

You can do one of two things with each:

| Action                      | What it does                                                                                                                                                                                                                                                                                 |
| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Apply to this workspace** | Ties the request to a workspace's contract, by the workspace's id. It takes effect as of the date the request was received, whenever you apply it. A renewal charged since is refunded, and a withdrawal's 14 days and refund count from that date. The sender is emailed what became of it. |
| **Close without applying**  | For a request sent twice, or by someone who holds no contract. Peal doesn't write to the sender, so write to them yourself when they need an answer.                                                                                                                                         |

> **Apply a request only once you know the sender holds that contract**
>
> Applying it cancels or withdraws from that workspace's contract. Check first,
> for example by writing to the address the account has on file.

Both actions ask why. They're in the audit log with the request's id and the workspace's, never the name or the address the request holds. Requests are kept 5 years, as the contract's orders are.

## Turn off a short link [#short-links]

**Short links** finds a [short link](/guides/posts/published#short-links) by its code, or by its whole address pasted as reported. It shows where the link leads, the workspace and post that hold it, and whether it's on.

When a link is reported as leading somewhere it shouldn't, click **Turn it off** and give a reason. Whoever follows it then gets `410 Gone`, and nothing is counted. The post on the platform keeps its text, and **Turn it back on** makes the link redirect again.

A workspace's page lists its short links, newest first. **Turn them all off** stops every one still on at once, with a reason, recorded once in the audit log.

Each of these is recorded in the audit log before it's done, with the reason, the link's workspace and its code. A short link also answers only while the part of the post that holds it is live on its platform (`404` before it went out), and `410` once staff banned every account that owns its workspace.

The console's own endpoints, through the API:

| Endpoint                                              | What it does                      |
| ----------------------------------------------------- | --------------------------------- |
| `GET /api/admin/short-links/{code}`                   | Finds a short link                |
| `POST …/disable` and `…/enable`, with a `reason`      | Turns it off or back on           |
| `GET /api/admin/workspaces/{workspaceId}/short-links` | Lists a workspace's short links   |
| `POST …/short-links/disable`                          | Turns a workspace's links all off |

## Set a workspace's API rate limit [#rate-limits]

On a server that bills, a workspace's page shows the [rate limit](/developers/conventions/rate-limits#standing) its keys and the applications acting in it send under. It's 60 requests a minute without a payment method, the server's setting with one, or a limit of the workspace's own.

Staff give a workspace its own limit on request, usually 1,200, from 1 to 10,000, with a reason. They remove it the same way. It applies within a minute, whatever the billing account pays, and goes with the workspace. Each change is recorded in the audit log first (`setRequestLimit`, with the limit).

On a server that doesn't bill, the setting is everyone's, and nothing is set.

| Endpoint                                                        | What it does                                                    |
| --------------------------------------------------------------- | --------------------------------------------------------------- |
| `GET /api/admin/workspaces/{workspaceId}/request-limit`         | What the workspace sends under now                              |
| `POST …/request-limit`, with `requestsPerMinute` and a `reason` | Sets its own limit, or removes it with `requestsPerMinute` null |

## Settle refunds that didn't go through [#refunds]

On a server that bills, **Billing accounts** lists the money Peal owes back that Stripe didn't give, newest first. There are two kinds:

- A credit of a legacy plan's unused time that Stripe refused for good. The plan was ended all the same.
- A refund that Stripe reported failed after it was made, with its `refund.failed` event. Subscribe the webhook endpoint to that event.

Each shows its amount, Stripe's code, the subscription or the refund, and the workspace. The alert `peal-credit-problems` fires on each, and `GET /api/admin/billing/credit-problems` answers the same list.

The customer was told the money goes back, so settle each one by hand, in Stripe's dashboard or another way. Then click **Mark settled** and say how. It's recorded in the audit log first (`settleCreditProblem`), and the entry stays listed with the day.

## The audit log [#audit-log]

Each action is recorded before it's carried out, so nothing staff do goes unrecorded. An entry says who did it, what, to which account, why and when, with a ban's end. An action that then failed still shows what staff asked for. The log keeps ids, never what anyone wrote.

Entries are kept for these periods:

| Entry                        | Kept                                                                                                                                            |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| Any entry                    | 12 months                                                                                                                                       |
| A ban, or the lifting of one | 5 years (the limitation period for a claim about it, art. 2224 of the French Code civil), or 12 months past the end of a ban that lasted longer |
| A ban until lifted           | As long as it holds. It ends when it's lifted or the account is closed.                                                                         |

A daily job (`staff.audit-retention`, at 03:41 UTC) deletes older entries.

### While staff act as an account [#impersonation-log]

The server records every request that changes something, before it runs, whichever way it comes: Peal's API (`/api/…`) and the sign-in service's routes (`/api/auth/…`) alike. The request's handler has no say in it, so a change can't skip its record. A change the server then refuses is recorded too.

Each entry holds these fields:

| Field     | What it holds                                                                                                                    |
| --------- | -------------------------------------------------------------------------------------------------------------------------------- |
| Staff     | The staff member who acted                                                                                                       |
| Account   | The account they acted as                                                                                                        |
| Action    | Changed something as the account                                                                                                 |
| Operation | The API's endpoint, as `group.endpoint` (`posts.create`, `posts.schedule`), or the sign-in route, as `auth:/path`                |
| Workspace | The workspace it was in                                                                                                          |
| Ids       | The ids the request named, by name (`postId`, `channelId`, `organizationId`). Never the text, media or anything else it carried. |
| When      | When it was asked for                                                                                                            |

Reads aren't recorded. MCP clients, the command line and API keys never act for staff, because their tokens carry no impersonation, and staff acting as an account may not let an application act for it or create a key. A request to delete one of its workspaces or close the account is refused, so no subscription is cancelled, and it's recorded like any other change. These entries are kept 12 months, like the rest of the log.

The log also records how each impersonation ended:

- **Stopped acting as the account**, when staff stop it from the banner or sign out.
- **Acting as the account ended, by the server**, when the server ends it. That happens when its staff member was banned, signed out everywhere or is no longer staff, or when the account was banned or signed out everywhere.

One that's never stopped ends an hour after it began, as its start in the log shows.

**When an account is closed**

The log forgets it as the account acted on. Entries about it lose its id, the reason given, the workspace and the ids a change named, and its id leaves every other entry that names it.

A ban, or the lifting of one, keeps its reason for its 5 years, with a keyed pseudonym of the account's email address instead of its id. Whoever runs the server may have to show a court what it did and why, and can find the entry again only from that address.

Entries it made as staff keep their author, as a legitimate interest. Whoever runs the server answers for what staff did to other people's accounts, after staff leave too. What was done, and when, stays.

The account's data download lists what staff did to it, with the reason given and the changes staff made as it (what, where and on which ids), but not who did it.

## Answer legal requests [#legal-requests]

A judicial authority may ask, in writing, for the data that identifies who contributed content (loi n° 2004-575, Article 6, V, B). A server that keeps it ([Legal retention](/self-hosting/privacy#legal-retention)) answers from **Legal requests** in the console (`/admin/legal`). Staff see it only if they also have the legal role. Other staff get the not-found page there, and 404 from its API, like anyone else.

1. **Give the legal role**

    Give it to the few people who answer authorities, and no one else, then have them sign in again:

    ```sql
    UPDATE auth."user" SET role = 'admin,legal' WHERE email = 'you@example.com';
    ```

2. **Fill in the request from the authority's document**

    Enter these, as the document gives them:

    - What it names: an email address (the closed accounts that had it), an account's id (closed or not), or a workspace's id.
    - The authority, the request's reference, and its legal basis, the text that gives the authority the power to ask.
    - What it asks for, and nothing more: who held the account, how it signed in, its payment references, the connections that created, changed or deleted content, and the period of those connections when the request names one.

3. **Record the request and show the answer**

    Click **Record the request and show the answer**. It records the request first, then shows only what the request covers: the closed accounts that match, and the connections of those accounts, of the account named, or in the workspace named. A category the request didn't ask for reads **Not covered by this request**, and the server sends none of it.

How an account signed in and paid is kept 1 year after it closed, who held it 5 years, and each connection 1 year. This is the only way to read what a closed account left. A live account's details are on its page in the console, and only its connections need a legal request.

Each answer is recorded before it's given, and the record is kept 5 years. The record holds the staff member, the authority, its reference, its legal basis, what was asked about and for, and how many records it returned, never the data handed over. **Answers given** lists the records, newest first. Each also shows in the audit log, as **Answered a legal request** with the authority and its reference, so the rest of staff see it.

> **Tell the people you give the role to that their answers are recorded**
>
> The page says so before anything is entered. Tell the staff you give the role
> to that their answers are recorded and reviewed, as employment law may require
> of you. Enter only a request an authority made in writing, and keep the
> request itself with your legal records.

Scripts can do the same, as staff in their own session. `POST /api/admin/legal-requests` answers a request, and `GET /api/admin/legal-requests` lists the answers given.
