Authentication
API keys#
A key acts for you, in one workspace, with the scopes you gave it. Make one in Settings › Developers: switch to the workspace first, since the key belongs to the one that’s open.
curl "https://nullnote-api.nullside.workers.dev/v1/me" \
-H "Authorization: Bearer nnk_…"- Keys start with
nnk_. Nullnote stores only a hash, so a key is shown once. If you lose it, revoke it and make another. - Keys expire after 30, 90 or 365 days, or never. You can have up to 25.
- A key stops working, with
401 unauthorized, when it’s revoked or expired, or when you leave its workspace or delete your account. - A key can’t make other keys or manage OAuth apps. Those need a signed-in session.
OAuth 2.1 with PKCE#
Nullnote is an OAuth 2.1 authorization server (RFC 6749, 7636, 8414, 7591 and 7009). People approve your app for one workspace and the scopes it asks for, and your app gets tokens that act for them.
| Endpoint | URL |
|---|---|
| Authorization | https://nullnote-api.nullside.workers.dev/oauth/authorize |
| Token | https://nullnote-api.nullside.workers.dev/oauth/token |
| Revocation | https://nullnote-api.nullside.workers.dev/oauth/revoke |
| Dynamic registration | https://nullnote-api.nullside.workers.dev/oauth/register |
| Server metadata | https://nullnote-api.nullside.workers.dev/.well-known/oauth-authorization-server |
1. Register your app
In Settings › Developers, choose Register an app. Give it a name, a homepage, a logo, its redirect URIs and the most scopes it may ask for.
- Confidential apps have a server that can keep a client secret (
nncs_…), shown once. - Public apps (mobile, desktop, single-page and CLI apps) have no secret and rely on PKCE.
- Redirect URIs must match exactly. Use
https,http://127.0.0.1orhttp://localhoston any port, or your own scheme likemyapp://callback. - New apps show “Not verified by Nullnote” on the consent page until Nullnote verifies them.
2. Make a PKCE verifier and challenge
Every client uses PKCE with S256, confidential ones too. Keep the verifier; send the challenge.
import crypto from 'node:crypto'
const verifier = crypto.randomBytes(32).toString('base64url')
const challenge = crypto.createHash('sha256').update(verifier).digest('base64url')
const state = crypto.randomBytes(16).toString('base64url')3. Send the person to Nullnote
https://nullnote-api.nullside.workers.dev/oauth/authorize
?response_type=code
&client_id=nnc_…
&redirect_uri=https%3A%2F%2Facme.com%2Fcallback
&scope=recordings%3Aread%20ai
&state=STATE
&code_challenge=CHALLENGE
&code_challenge_method=S256They sign in if needed, see your app, what it will be able to do, and pick a workspace. Then Nullnote sends them back:
https://acme.com/callback?code=…&state=STATE&iss=https%3A%2F%2Fnullnote-api.nullside.workers.devhttps://acme.com/callback?error=access_denied&state=STATE&iss=https%3A%2F%2Fnullnote-api.nullside.workers.devCheck that state is the one you sent and that iss is https://nullnote-api.nullside.workers.dev. Codes work once, for 5 minutes.
4. Exchange the code for tokens
curl -X POST "https://nullnote-api.nullside.workers.dev/oauth/token" \
-d grant_type=authorization_code \
-d code=CODE \
-d redirect_uri=https://acme.com/callback \
-d client_id=nnc_… \
-d code_verifier=VERIFIERcurl -X POST "https://nullnote-api.nullside.workers.dev/oauth/token" \
-u "nnc_…:nncs_…" \
-d grant_type=authorization_code \
-d code=CODE \
-d redirect_uri=https://acme.com/callback \
-d code_verifier=VERIFIER{
"access_token": "nno_…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "nnor_…",
"scope": "recordings:read ai"
}Confidential apps can also send client_secret in the form body (client_secret_post). The token endpoint takes JSON too.
5. Call the API
curl "https://nullnote-api.nullside.workers.dev/v1/search?q=pricing" \
-H "Authorization: Bearer nno_…"Access tokens last an hour. Each request is checked against its grant, so a person who disconnects your app cuts it off at once.
6. Refresh
curl -X POST "https://nullnote-api.nullside.workers.dev/oauth/token" \
-d grant_type=refresh_token \
-d refresh_token=nnor_… \
-d client_id=nnc_…- Refresh tokens rotate: store the new one each time. Reusing an old one ends the grant, except within a minute of the refresh, so a retry after a dropped response is safe.
- A refresh token expires after 90 days without use.
- Confidential apps authenticate here too.
Revoking
curl -X POST "https://nullnote-api.nullside.workers.dev/oauth/revoke" \
-d token=nnor_… \
-d client_id=nnc_…It always answers 200. Revoke tokens you no longer need, for example when someone signs out of your app.
Grants and workspaces#
- A grant is one person, one app and one workspace. Approving again for the same workspace adds the new scopes to the grant.
- To work in another workspace, send the person through the flow again and have them pick it.
- People see and revoke grants in Settings › Connected apps.
- Deleting your app ends every grant and token it has.
Dynamic registration#
MCP clients can register themselves with POST /oauth/register (RFC 7591), without signing in. Those apps are public, have no owner, show “This app registered itself” on the consent page, and are deleted after 30 days without use. Most apps should register in Settings instead.
OAuth errors#
The token and revocation endpoints answer in OAuth’s format, not the API’s:
{ "error": "invalid_grant", "error_description": "The code has expired." }The codes are invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type and invalid_scope.