Documentation Index
Fetch the complete documentation index at: https://docs.auditynow.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Audity uses Bearer token authentication for all agent API calls. The token is a Personal Access Token (PAT) you generate from your Audity settings page. Every API request must include:- Subscription tier, gates which features are callable
- Supabase Row-Level Security, you only ever see rows your
user_idowns - Credit balance, write operations that cost credits deduct from your balance
- Rate limits, per-token
Token format
aky_ prefix is reserved. The middleware uses it to distinguish PATs from Clerk session JWTs without doing a database lookup on every request.
Tokens are stored as bcrypt hashes plus an HMAC lookup digest. The plaintext leaves the database after creation and is never written to logs.
Generating a token
- Sign in at app.auditynow.com
- Go to Settings → API Tokens
- Click Create Token
- Choose:
- Label, a human-readable name (e.g.,
Claude on my MacBook,n8n production) - Scopes,
read,write, or both - Expiry (optional), set an expiry date or leave blank
- Label, a human-readable name (e.g.,
- Click Create
- Copy the token immediately, it will not be shown again
Scopes
| Scope | What it allows |
|---|---|
read | All GET requests on agent-allowlisted routes |
write | All POST / PATCH / DELETE on agent-allowlisted routes (also implicitly grants read) |
admin | Reserved for future team-level operations. The middleware accepts the scope today but no route requires it. |
read + write is what you want. Use read only for read-only dashboards or reporting where the agent should never spend credits or mutate state.
GET, HEAD, and OPTIONS requests don’t require a scope (read is implicit). POST, PATCH, and DELETE require write.
What’s exposed to PATs (the agent surface)
The PAT-accessible route allowlist is intentionally narrow. As of v1:GET /api/user/current,GET /api/user/tier,GET /api/user/creditsGET /api/projects,POST /api/projectsGET /api/projects/{id},PATCH /api/projects/{id}POST /api/projects/{id}/audit-analysis,GET /api/projects/{id}/audit-analysisGET /api/projects/{id}/opportunitiesGET /api/projects/{id}/deliverablesGET /api/lead-generation/leads,GET /api/lead-generation/leads/{id}POST /api/lead-generation/leads/{id}/convert- All
/api/nucleus/{captures,memories,contacts,insights,suggestions}endpoints documented in the API Reference
403 PAT_ROUTE_NOT_ALLOWED. This includes web research, billing, admin, and the PAT management endpoints themselves.
Tier requirements
Tier gating is enforced on every request the same way the web app enforces it. Roughly:- Solo / Scout, evaluation tiers, read-only access to your data via the agent API
- Starter, the recommended baseline, full read + write
- Growth and above, includes everything plus higher rate limits and feature additions
requiredTier in the body tells you what to upgrade to.
Rate limits
Per-token, enforced by Audity’s existing rate limiter:| Endpoint class | Limit |
|---|---|
| Standard reads | 60 / minute |
| Writes (create, update, delete) | 30 / minute |
| Expensive operations (audit synthesis) | 5 / minute |
Capture submissions (POST /api/nucleus/capture/note) | 30 / hour |
Retry-After (in seconds). Back off and retry.
Rotation
We recommend rotating PATs every 90 days. Multiple active tokens make this zero-downtime:- Create a new token with the same label suffixed
-rotate(or with the new date) - Update your agent’s connection settings to use the new token
- Verify with a
GET /api/user/currentround-trip - Revoke the old token
Revocation
To revoke a token: Settings → API Tokens → Revoke. The token stops working immediately on the next request (no caching). Revoke immediately if:- A token may have been exposed (committed to git, pasted into a chat, leaked to a screen recording)
- A device is lost or stolen
- An integration goes rogue or you stop trusting it
revoked_at is set). The row stays in the database for audit history.
Security guidelines
Never commit tokens to git
Never commit tokens to git
Add
.env, .env.local, *.env to your .gitignore. Use environment variables or a secret manager.Never paste tokens into chat conversations
Never paste tokens into chat conversations
Tokens belong in connection settings, not message bodies. If you paste one accidentally, revoke it.
Use one token per integration
Use one token per integration
One token per device or integration. Easier to revoke a single compromised token without breaking everything else.
Set expiry for shared environments
Set expiry for shared environments
Use read-only tokens where you can
Use read-only tokens where you can
If your agent only fetches data (dashboards, reporting), give it a
read token. Reduces blast radius.Error codes
Authentication and validation errors return JSON with a stablecode field. Branch on code (the human-readable error string may change). All error responses on /api/... routes are JSON, the middleware never returns HTML for an auth failure.
Authentication and authorization
| HTTP | code | When it fires |
|---|---|---|
| 401 | PAT_MALFORMED | The Authorization header carries a Bearer aky_... token whose format is invalid (wrong length, wrong charset). Don’t retry, regenerate the token. |
| 401 | (no code) | A correctly-shaped aky_... token that doesn’t resolve to an active key. The token was revoked, expired, or never existed. Generate a new one. |
| 403 | PAT_ROUTE_NOT_ALLOWED | Valid PAT, but the route is not on the agent allowlist. Use a browser session for non-allowlisted routes. |
| 403 | PAT_NOT_SUPPORTED_FOR_ENDPOINT | Valid PAT hitting a defense-in-depth Clerk-only endpoint (e.g. /api/user/api-keys). PATs cannot manage other PATs. |
| 403 | PAT_SCOPE_INSUFFICIENT | Token is valid but missing a scope. The error message lists what’s missing (e.g. Token missing required scope(s): write). Generate a token with the right scopes. |
| 503 | PAT_DISABLED | The agent API is gated behind a kill switch (AUDITY_AGENT_API_ENABLED). If you see this on prod, the switch is off, contact support. |
Endpoint validation errors
| HTTP | code | Endpoint |
|---|---|---|
| 400 | EMPTY_PATCH | PATCH /api/projects/{id} with no allowed fields |
| 400 | INVALID_DESCRIPTION_TYPE | PATCH /api/projects/{id} with a non-string description |
| 400 | DESCRIPTION_TOO_LONG | PATCH /api/projects/{id} with description over 5,000 chars |
Out of scope for v1
A few capabilities are intentionally not exposed via the agent API:- Document upload. Files (PDFs, transcripts, contracts) are uploaded through the web app. Agents read them via project detail and trigger analysis on what’s already there.
- Streaming responses. Audity is not a chatbot. Agents call the API for structured outputs, not for token-by-token completion. Stream prose with your own LLM; use Audity for synthesis, memory, and project state.
- Deliverable document regeneration. The synthesis pipeline produces stakeholder memos and other deliverables when
audit-analysisruns. Agents read them viaGET /api/projects/{id}/deliverables. - Web research. The
POST /api/projects/{id}/web-researchroute exists but is not on the agent allowlist in v1. It runs from the web app. - PAT management via PAT. Tokens are created and revoked from the browser. PATs cannot manage other PATs.
- Listing ReadyLinks. The response shape is unstable behind a feature flag. Manage links via the web app; you can still filter the lead list by a known
staticSlugId.
What gets logged
Two systems run in parallel: The Nucleus action audit log (nucleus_actions table). Populated by the withAudit wrapper that sits around Nucleus’s internal AI tools and slash commands when you use Nucleus inside the web app. Records the user, tool, payload, and outcome for every Nucleus tool call.
The agent API has its own surface and is not currently mirrored into nucleus_actions. PAT writes (create project, trigger audit, create memory, etc.) are persisted in their own tables (the rows themselves are the record), but there’s no per-call audit trail in v1. If you need an audit log for compliance reasons, run your agent-side requests through your own logging proxy until we ship a dedicated PAT activity feed.
What’s stored when you create a token
- A bcrypt hash of the plaintext token
- An HMAC lookup digest so the resolver can find the row without scanning every hash
- The first 6 characters (e.g.
aky_a1b) for visual identification in your settings - The label, scopes, expiry, created/last-used timestamps
last_used_at, and lets the request proceed with your normal Clerk identity attached.