79 lines
3.8 KiB
Markdown
79 lines
3.8 KiB
Markdown
# Netlify API surface
|
|
|
|
Everything below was exercised with a fresh account token (`nfu_…`) obtained from
|
|
the signup flow. The token behaves like an ordinary bearer for the whole v1 API.
|
|
|
|
## Auth tokens
|
|
|
|
| kind | prefix | how to get | use |
|
|
|---|---|---|---|
|
|
| session access token | `nfu_` | `POST /auth/verify` result | everything in `/api/v1` |
|
|
| personal access token | `nfp_` | UI only: `/user/applications#personal-access-tokens` → *New access token* → *Generate token* | `netlify-cli`, long-lived scripts |
|
|
|
|
There is **no API endpoint** to create a PAT. `POST /api/v1/access_tokens`
|
|
returns the OAuth discovery root, not a token factory. Automate the UI with a
|
|
browser if you need `nfp_` (needed only for CLI deploys of functions).
|
|
|
|
## Endpoints (verified)
|
|
|
|
```
|
|
GET /api/v1/user → current profile
|
|
GET /api/v1/accounts → account object + capabilities
|
|
GET /api/v1/accounts/{id} → full capability matrix
|
|
GET /api/v1/sites → your sites
|
|
POST /api/v1/sites {name} → create site
|
|
GET /api/v1/sites/{id} → site detail (sso flags, build settings)
|
|
PATCH /api/v1/sites/{id} → update (sso_login, build_settings, …)
|
|
POST /api/v1/sites/{id}/deploys → zip deploy (Content-Type: application/zip)
|
|
GET /api/v1/sites/{id}/deploys/{did} → deploy state + summary messages
|
|
GET /api/v1/dns_zones → DNS zones (0 on fresh accounts)
|
|
GET /api/v1/accounts/{id}/env → env vars (empty until you add some)
|
|
GET /api/v1/ai-gateway/providers/detailed → model catalog + pricing
|
|
GET /api/v1/ai-gateway/providers → model ids per provider
|
|
```
|
|
|
|
404 on `/api/v1/forms`, `/api/v1/deploys`, `/api/v1/hooks`, `/api/v1/builds` —
|
|
those are site-scoped only.
|
|
|
|
## Free plan capabilities (snapshot)
|
|
|
|
```
|
|
sites: 500 domains: 10 collaborators: 1
|
|
credits: 300 concurrent_builds: 1 identity: true
|
|
firewall: true traffic_rules: 2 analytics: true
|
|
dev_servers: 1 agent_runners: 1 netlify_server: true
|
|
custom_provider_credentials: true ai_gateway_disabled: false
|
|
```
|
|
|
|
## AI Gateway
|
|
|
|
Catalog: **281 models** across six providers, exposed with per-model pricing.
|
|
|
|
| provider | env vars | models |
|
|
|---|---|---|
|
|
| anthropic | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL` | 18 (claude-opus-5-5, sonnet-5-5, fable-5-x, haiku-5-5) |
|
|
| openai | `OPENAI_API_KEY`, `OPENAI_BASE_URL` | 48 (gpt-6.1-sol/terra, gpt-6-astra/luna, gpt-5.4-*, images) |
|
|
| gemini | `GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL` | 18 (gemini-4-argon/carbon, 3.8-flash) |
|
|
| openrouter | `OPENROUTER_API_KEY`, `OPENROUTER_BASE_URL` | 188 (grok-4.7, kimi-k3, deepseek-v4.1, qwen3.8, glm-5.3) |
|
|
| meta | `META_API_KEY`, `META_BASE_URL` | 5 (muse-*) |
|
|
| typesafe | `TYPESAFE_API_KEY`, `TYPESAFE_BASE_URL` | 4 |
|
|
|
|
Credentials are injected **only into function runtime env**, and only when the
|
|
project has AI Gateway enabled. On a fresh free account a deployed function
|
|
enumerates 37 environment variables and **none** of them are AI keys;
|
|
`/projects/{slug}/configuration/general/ai-gateway` does not exist for the free
|
|
plan. `ai_gateway_disabled: false` in the capability matrix means "not blocked by
|
|
policy", not "provisioned".
|
|
|
|
Billing: token usage is converted into the account credit pool (300 credits on
|
|
free).
|
|
|
|
## Function deployment constraints
|
|
|
|
- Manual (zip) deploys never compile functions — the deploy summary reports
|
|
`No functions deployed`.
|
|
- Functions require `netlify-cli deploy --prod --no-build` after `netlify link --id <site>`.
|
|
- netlify-cli 17.x ignores `NETLIFY_AUTH_TOKEN`; it reads the PAT from
|
|
`%APPDATA%/netlify/Config/config.json` under `users.<uid>.auth.token`.
|
|
- A function bundled as `netlify/functions/<name>.zip` in the site zip is also
|
|
ignored — the API path only accepts CLI-bundled artifacts. |