Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,48 @@ admin/
- **Language:** TypeScript 5
- **Styling:** Tailwind CSS 4
- **React:** 19
- **Auth:** [Privy](https://privy.io) (login + access tokens)
- **Data Fetching:** [TanStack React Query](https://tanstack.com/query)
- **Linting:** ESLint 9 with next/core-web-vitals

## API Calls

All API calls target the Recoup API (`https://recoup-api.vercel.app` in production, `https://test-recoup-api.vercel.app` in development/test). Every request is authenticated with a Privy access token via `Authorization: Bearer <token>`.

| Endpoint | Method | Description | Docs |
|---|---|---|---|
| `/api/admins` | GET | Check whether the authenticated account is a Recoup admin | [Check Admin Status](https://developers.recoupable.com/api-reference/admins/check) |
| `/api/admins/emails` | GET | Fetch Resend emails for an account (used for pulse email previews) | [Admin Emails](https://developers.recoupable.com/api-reference/admins/emails) |
| `/api/admins/sandboxes` | GET | Fetch per-account sandbox statistics | [Admin Sandboxes](https://developers.recoupable.com/api-reference/admins/sandboxes) |
| `/api/admins/sandboxes/orgs` | GET | Fetch org repo commit statistics ordered by total commits | [Admin Sandbox Orgs](https://developers.recoupable.com/api-reference/admins/sandboxes-orgs) |
| `/api/tasks/runs` | GET | Fetch background task runs for a specific account | [Get Task Runs](https://developers.recoupable.com/api-reference/tasks/runs) |

### Query Parameters

**`GET /api/admins/emails`**
- `account_id` — fetch all emails sent to this account
- `email_id` — fetch a single email by Resend ID

**`GET /api/tasks/runs`**
- `account_id` *(required)* — account whose runs to fetch
- `limit` *(optional, default: 20)* — maximum number of runs to return

### Authentication

Privy issues a short-lived access token after login. The token is retrieved with `getAccessToken()` from the Privy React SDK and sent in every request header:

```
Authorization: Bearer <privy-access-token>
```
Comment on lines +88 to +90
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language identifier to the fenced code block (MD040).

Line 88 uses an untyped fenced block, which triggers markdownlint and can reduce rendering quality in some tooling.

Suggested fix
-```
+```http
 Authorization: Bearer <privy-access-token>
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.21.0)</summary>

[warning] 88-88: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 88 - 90, The fenced code block containing the header
example "Authorization: Bearer " in README.md is missing a
language identifier; update that fenced block to include an appropriate language
tag (e.g., http) so the block starts with ```http to satisfy MD040 and improve
rendering and syntax highlighting.


</details>

<!-- fingerprinting:phantom:triton:hawk -->

<!-- This is an auto-generated comment by CodeRabbit -->


The API resolves the token to an `account_id` and enforces admin-only access for `/api/admins/*` endpoints.

See the [Authentication docs](https://developers.recoupable.com/authentication) for the full token flow.

## Learn More

- [Recoup API Docs](https://developers.recoupable.com)
- [Next.js Documentation](https://nextjs.org/docs)
- [Tailwind CSS v4](https://tailwindcss.com/docs)
- [Privy Docs](https://docs.privy.io)
- [TanStack Query Docs](https://tanstack.com/query/latest/docs/framework/react/overview)
Loading