Skip to content

Authentication

The developer API uses bearer tokens. You create a token once from your dashboard, then send it on every request.

  1. Sign in to your dashboard and go to Settings → Developer (/settings/developer).
  2. Click Create token, give it a name so you can recognize it later, and select its scopes.
  3. Copy the generated token immediately — it is shown only once. Only a short hint (its leading characters) is stored afterward, so the full value can never be retrieved again.

Every token starts with a short platform prefix, followed by 40 random characters:

acme_nUq7Y…40 characters…0fA2

The prefix lets secret scanners (e.g. GitHub) flag the credential if it is ever leaked.

Send the token in the Authorization header as a bearer token:

Terminal window
curl https://api.prettycode.dev/v1/me \
-H "Authorization: Bearer YOUR_TOKEN"

A token is granted one or more scopes, and each endpoint requires a specific scope.

ScopeGrants
read_userRead the authenticated user’s profile (GET /v1/me).
render_snippetsTurn code into images (POST /v1/renders).
write_snippetsSave snippets, folders and tags in your library — needed with render_snippets when a render has save.
read_presetsList your organization’s style presets (GET /v1/presets).

Snippets and style presets the API reads or saves live in your organization’s default workspace (its oldest one), whichever workspace you have open in the app.

A request made with a token that lacks the required scope returns 403 Forbidden.

Requests are limited per minute for your whole organization (120 by default), not per token — another token doesn’t add to the limit. Going over it returns 429 Too Many Requests with a Retry-After header. See Rate limits.

Revoke a token at any time from Settings → Developer. Revoked tokens are rejected immediately.