netlify-autoreg: signup farm + AI Gateway reverse (281 models on free), dashboard, multi-mailbox, captcha layer, full guide
This commit is contained in:
+79
@@ -0,0 +1,79 @@
|
||||
# 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.
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
# Полный гайд: свой OpenAI/Anthropic-совместимый шлюз на бесплатном Netlify
|
||||
|
||||
Коротко: любой free-проект Netlify получает доступ к их AI Gateway. Каталог — 281 модель
|
||||
(Claude Opus 5.5, GPT-6.1 Sol, Gemini 4 Argon, Grok 4.7, Kimi K3, DeepSeek V4.1, GLM 5.3).
|
||||
Ключ и база живут в переменных окружения **edge-функции** (Deno), а не обычной функции.
|
||||
Проксируешь шлюз своей edge-функцией — получаешь личный эндпоинт `/ai/v1/...`, который
|
||||
работает как обычный OpenAI/Anthropic API.
|
||||
|
||||
Проверено 11.11.2026: 15/15 моделей отвечают 200, стриминг и tool use работают.
|
||||
|
||||
---
|
||||
|
||||
## 1. Что нужно
|
||||
|
||||
| нужно | зачем | где взять |
|
||||
|---|---|---|
|
||||
| аккаунт Netlify (free) | 300 кредитов на шлюз | авторег (`netlify_farm.py`) или руками |
|
||||
| сайт в аккаунте | шлюз привязан к домену сайта | `POST /api/v1/sites` |
|
||||
| одна edge-функция | она видит ключ и проксирует | код ниже, деплой CLI или drag-n-drop |
|
||||
| Node + netlify-cli (для CLI-деплоя) | удобно | или залить через UI |
|
||||
|
||||
Время: 5 минут на аккаунт, если аккаунт уже есть.
|
||||
|
||||
---
|
||||
|
||||
## 2. Шаг 1 — аккаунт
|
||||
|
||||
Авторег (быстро, пачкой):
|
||||
|
||||
```bash
|
||||
python netlify_farm.py --count 1 --site \
|
||||
--mails "C:/path/to/mails.txt" \
|
||||
--bank "C:/path/to/netlify_bank.jsonl"
|
||||
```
|
||||
|
||||
Руками: `app.netlify.com/signup/email`, email + пароль. Капча невидимая, обычно проходит сама.
|
||||
Внимание: gmail с `+алиасом` форма отбивает как «Email address is invalid» — нужен обычный ящик.
|
||||
|
||||
Из ответа сохрани `token` (`nfu_...`) и `site_id`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Шаг 2 — сайт
|
||||
|
||||
```bash
|
||||
curl -X POST https://api.netlify.com/api/v1/sites \
|
||||
-H "Authorization: Bearer $NF_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"name":"my-ai-gw"}'
|
||||
```
|
||||
|
||||
Сразу сними SSO-замок, иначе публичный URL отдаёт 401:
|
||||
|
||||
```bash
|
||||
curl -X PATCH https://api.netlify.com/api/v1/sites/$SITE_ID \
|
||||
-H "Authorization: Bearer $NF_TOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"sso_login":false,"account_sso_login":false}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Шаг 3 — edge-функция прокси
|
||||
|
||||
Создай в проекте файл `netlify/edge-functions/ai-proxy.ts`:
|
||||
|
||||
```ts
|
||||
export default async (req: Request, _ctx: any) => {
|
||||
// ключ читаем НА КАЖДЫЙ запрос: JWT живёт минуты и ротируется
|
||||
const KEY = Deno.env.get('NETLIFY_AI_GATEWAY_KEY') || '';
|
||||
const SECRET = Deno.env.get('PROXY_SECRET') || '';
|
||||
if (SECRET && req.headers.get('x-proxy-secret') !== SECRET) {
|
||||
return new Response('{"error":"unauthorized"}', {status: 401, headers: {'content-type':'application/json'}});
|
||||
}
|
||||
|
||||
const url = new URL(req.url);
|
||||
const upstream = `${url.origin}/.netlify/ai${url.pathname.replace(/^\/ai/, '')}${url.search}`;
|
||||
|
||||
const headers: Record<string,string> = {
|
||||
authorization: `Bearer ${KEY}`,
|
||||
'x-api-key': KEY,
|
||||
'content-type': req.headers.get('content-type') || 'application/json',
|
||||
accept: req.headers.get('accept') || 'application/json',
|
||||
};
|
||||
const av = req.headers.get('anthropic-version');
|
||||
if (av) headers['anthropic-version'] = av;
|
||||
|
||||
const init: RequestInit = { method: req.method, headers };
|
||||
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
||||
init.body = req.body;
|
||||
// @ts-ignore требуется Deno для стриминга тела запроса
|
||||
init.duplex = 'half';
|
||||
}
|
||||
|
||||
const r = await fetch(upstream, init);
|
||||
return new Response(r.body, {
|
||||
status: r.status,
|
||||
headers: {
|
||||
'content-type': r.headers.get('content-type') || 'application/json',
|
||||
'cache-control': 'no-store',
|
||||
'x-gateway-status': String(r.status),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const config = { path: "/ai/*" };
|
||||
```
|
||||
|
||||
Три правила, без которых не работает:
|
||||
|
||||
1. `Deno.env.get(...)` **внутри** обработчика, не в константе модуля. Ключ ротируется, а константа
|
||||
кешируется на деплое и через несколько минут даёт 401.
|
||||
2. `init.duplex = 'half'` при передаче `req.body`, иначе Deno бросает `TypeError: duplex`.
|
||||
3. `export const config = { path: "/ai/*" }` — без этого маршрут не зарегистрируется.
|
||||
|
||||
Деплой через CLI:
|
||||
|
||||
```bash
|
||||
netlify link --id $SITE_ID # привязать каталог к сайту
|
||||
netlify deploy --prod --no-build --dir="$PWD"
|
||||
```
|
||||
|
||||
`--no-build` обязателен, иначе Netlify попытается собрать проект (часто падает на hugo/jekyll).
|
||||
|
||||
Деплой через UI: создай на сайте файл тем же путём и задеплой проект как обычно.
|
||||
|
||||
---
|
||||
|
||||
## 5. Шаг 4 — проверка
|
||||
|
||||
```bash
|
||||
S="https://<твой-сайт>.netlify.app/ai"
|
||||
|
||||
# OpenAI-совместимый вызов
|
||||
curl -s -X POST "$S/v1/chat/completions" -H 'Content-Type: application/json' -d '{
|
||||
"model":"gpt-6.1-sol",
|
||||
"messages":[{"role":"user","content":"Reply with OK"}]
|
||||
}'
|
||||
|
||||
# Anthropic-совместимый вызов
|
||||
curl -s -X POST "$S/v1/messages" \
|
||||
-H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' \
|
||||
-d '{"model":"claude-opus-5-5","max_tokens":50,"messages":[{"role":"user","content":"Reply OK"}]}'
|
||||
|
||||
# стриминг
|
||||
curl -sN -X POST "$S/v1/chat/completions" -H 'Content-Type: application/json' -d '{
|
||||
"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Count 1 to 5"}],"stream":true
|
||||
}'
|
||||
|
||||
# tool use (Anthropic shape)
|
||||
curl -s -X POST "$S/v1/messages" -H 'Content-Type: application/json' -H 'anthropic-version: 2023-06-01' -d '{
|
||||
"model":"claude-opus-5-5","max_tokens":200,
|
||||
"messages":[{"role":"user","content":"Weather in Berlin? Use tool."}],
|
||||
"tools":[{"name":"get_weather","description":"weather",
|
||||
"input_schema":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}]
|
||||
}'
|
||||
# ответ: stop_reason=tool_use, content[0].input={"city":"Berlin"}
|
||||
```
|
||||
|
||||
Ожидаемый результат: 200 и текст. Если 401 — см. FAQ.
|
||||
|
||||
---
|
||||
|
||||
## 6. Использование из кода
|
||||
|
||||
### Python (openai SDK)
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(base_url="https://<сайт>.netlify.app/ai/v1", api_key="unused")
|
||||
r = client.chat.completions.create(
|
||||
model="claude-opus-5-5", # да, Claude через OpenAI-схему тоже идёт
|
||||
messages=[{"role": "user", "content": "say OK"}],
|
||||
)
|
||||
print(r.choices[0].message.content)
|
||||
```
|
||||
|
||||
### Python (anthropic SDK)
|
||||
|
||||
```python
|
||||
from anthropic import Anthropic
|
||||
|
||||
client = Anthropic(base_url="https://<сайт>.netlify.app/ai", api_key="unused")
|
||||
r = client.messages.create(
|
||||
model="claude-opus-5-5", max_tokens=200,
|
||||
messages=[{"role": "user", "content": "say OK"}],
|
||||
)
|
||||
print(r.content[0].text)
|
||||
```
|
||||
|
||||
### OpenAI-совместимые клиенты (Cursor, Cline, LiteLLM, any)
|
||||
|
||||
```
|
||||
Base URL: https://<сайт>.netlify.app/ai/v1
|
||||
API key: любой непустой (если PROXY_SECRET не задан), иначе тот же секрет в заголовке
|
||||
Model: gpt-6.1-sol / claude-opus-5-5 / gemini-4-argon / ...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Модели
|
||||
|
||||
Проверенные (все 200, замер латентности на коротком промпте):
|
||||
|
||||
| модель | id | латентность |
|
||||
|---|---|---|
|
||||
| GPT-6.1 Sol | `gpt-6.1-sol` | 2.3s |
|
||||
| GPT-6 Astra | `gpt-6-astra` | 2.3s |
|
||||
| GPT-6 Luna | `gpt-6-luna` | 3.0s |
|
||||
| GPT-5.5 | `gpt-5.5` | 1.7s |
|
||||
| GPT-5.4 mini | `gpt-5.4-mini` | 1.3s |
|
||||
| Claude Opus 5.5 | `claude-opus-5-5` | 2.3s |
|
||||
| Claude Sonnet 5.5 | `claude-sonnet-5-5` | 1.9s |
|
||||
| Claude Haiku 5.5 | `claude-haiku-5-5` | 1.3s |
|
||||
| Claude Fable 5.2 | `claude-fable-5-2` | 2.8s |
|
||||
| Gemini 4 Argon | `gemini-4-argon` | 7.7s |
|
||||
| Gemini 3.8 Flash | `gemini-3.8-flash` | 2.3s |
|
||||
| Grok 4.7 | `x-ai/grok-4.7` | 5.6s |
|
||||
| Kimi K3 | `moonshotai/kimi-k3` | 1.3s |
|
||||
| DeepSeek V4.1 Flash | `deepseek/deepseek-v4.1-flash-1017` | 1.2s |
|
||||
| GLM 5.3 | `z-ai/glm-5.3` | 1.3s |
|
||||
|
||||
Полный каталог без авторизации:
|
||||
|
||||
```bash
|
||||
curl -s https://api.netlify.com/api/v1/ai-gateway/providers/detailed | jq '.providers | to_entries[] | {p:.key, n:(.value.models|length)}'
|
||||
```
|
||||
|
||||
Модели OpenRouter-нотации (`x-ai/`, `moonshotai/`, `deepseek/`, `z-ai/`) идут через OpenRouter-плечо,
|
||||
они доступны только при Zero Data Retention у провайдера.
|
||||
|
||||
Цены берутся из того же ответа: `claude-opus-5-5` $4/$20 за 1M, `gpt-6.1-sol` $2/$10,
|
||||
`gemini-4-argon` $2/$10, `claude-haiku-5-5` $1/$5.
|
||||
|
||||
---
|
||||
|
||||
## 8. Лимиты и экономика
|
||||
|
||||
- **300 кредитов** на аккаунт. Расход считается по токенам, курс виден в кабинете Netlify.
|
||||
- контекст **200k** токенов на запрос.
|
||||
- один аккаунт = один шлюз. Больше аккаунтов = больше суммарного лимита, но каждый требует
|
||||
своего сайта и своей edge-функции.
|
||||
- кэш промпта: Anthropic — стандартные 5 минут, OpenAI — `prompt_cache_key` на аккаунт.
|
||||
- таймаут edge-функции ~30-50 с: длинные стримы рвать на части, а не ждать одним куском.
|
||||
|
||||
---
|
||||
|
||||
## 9. Минусы (проверено)
|
||||
|
||||
| минус | деталь | обход |
|
||||
|---|---|---|
|
||||
| кредитов мало | 300 на аккаунт, хватает на день работы | несколько аккаунтов/сайтов |
|
||||
| ключ короткий | JWT 497 симв., живёт минуты | читать `Deno.env` в каждом запросе (уже в коде) |
|
||||
| база прибита к домену | снаружи нужен именно твой сайт | свой домен/алиас на тот же сайт |
|
||||
| Lambda не видит ключи | в обычных функциях 37 env без AI | только Edge Functions (Deno) |
|
||||
| `max_tokens` в chat | 400 `unsupported_parameter` | не передавать, либо `max_completion_tokens` |
|
||||
| tools в chat/completions | у gpt-6.1-sol 400 (конфликт с reasoning) | `POST /v1/responses` или Anthropic `/v1/messages` |
|
||||
| ручная модерация | `Account suspended`, `spam: manual` | чистые ящики, ровный темп |
|
||||
| логин 429 | после ~20 проб с IP | пауза, ротация egress |
|
||||
| Chrome умирает | падает на 4-м аккаунте | перезапуск браузера каждые 3 аккаунта |
|
||||
|
||||
---
|
||||
|
||||
## 10. FAQ
|
||||
|
||||
**401 от `/ai/...`**
|
||||
1. Ключ прочитан на уровне модуля → перенести `Deno.env.get` внутрь обработчика.
|
||||
2. Edge-функция не задеплоилась: проверь `netlify deploy --prod --no-build` вывод, должно быть
|
||||
«Edge function ... deployed».
|
||||
3. `PROXY_SECRET` задан, а заголовок `x-proxy-secret` не передан.
|
||||
|
||||
**404 на `/ai/v1/chat/completions`**
|
||||
Нет `export const config = { path: "/ai/*" }` или путь отличается.
|
||||
|
||||
**`unsupported_parameter: max_tokens`**
|
||||
Убрать параметр. Для ограничения длины — `max_completion_tokens`.
|
||||
|
||||
**`Function tools with reasoning_effort are not supported`**
|
||||
Использовать `/v1/responses` для OpenAI-моделей или `/v1/messages` для Anthropic.
|
||||
|
||||
**Пустой ответ, `finish_reason=length`**
|
||||
У reasoning-моделей бюджет уходит в thinking. Поднять лимит до 512+ или не ограничивать.
|
||||
|
||||
**Сайт отдаёт 401 с «Login Redirect»**
|
||||
Не снят SSO-замок: `PATCH /api/v1/sites/{id} {"sso_login":false,"account_sso_login":false}`.
|
||||
|
||||
---
|
||||
|
||||
## 11. Мультиаккаунт
|
||||
|
||||
Один шлюз = один сайт. Схема на N аккаунтов:
|
||||
|
||||
```
|
||||
account_1 -> site_1 -> edge fn -> https://site1.netlify.app/ai
|
||||
account_2 -> site_2 -> edge fn -> https://site2.netlify.app/ai
|
||||
...
|
||||
```
|
||||
|
||||
Клиент (LiteLLM, свой роутер) держит список base_url и переключает при 429/исчерпании кредитов.
|
||||
Авторег и деплой обоих шагов — в `netlify_farm.py` и `deploy_all.py` этого репозитория.
|
||||
|
||||
Дашборд по аккаунтам: `python dashboard.py --port 8791`.
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
# Netlify signup — reverse engineering notes
|
||||
|
||||
Captured 2026-11-11 from a live Chrome session on `app.netlify.com`.
|
||||
|
||||
## 1. Front-end page
|
||||
|
||||
- `https://app.netlify.com/signup` — provider chooser (Google / GitHub / email / SSO)
|
||||
- `https://app.netlify.com/signup/email` — the real form (email + password)
|
||||
|
||||
The page loads webpack chunks (`actions.*.js`, `app.*.js`, `lib.*.js`,
|
||||
`helpers.*.js`). The captcha wrapper lives in `helpers`, the API client in `lib`
|
||||
(`apiBase`, `captcha_source`, `authLink`, `async authenticate()`).
|
||||
|
||||
## 2. reCAPTCHA Enterprise
|
||||
|
||||
```html
|
||||
<iframe src="https://www.google.com/recaptcha/enterprise/anchor
|
||||
?k=6Lfj2-EtAAAAAABMy0F1oAGRPQOCTZhnt1KQ7Xat
|
||||
&co=aHR0cHM6Ly9hcHAubmV0bGlmeS5jb206NDQz
|
||||
&size=invisible&sa=SIGNUP">
|
||||
```
|
||||
|
||||
- sitekey: `6Lfj2-EtAAAAAABMy0F1oAGRPQOCTZhnt1KQ7Xat`
|
||||
- action: **`SIGNUP`** (visible as `sa=SIGNUP` on the anchor iframe)
|
||||
- size: `invisible`, render args include `anchor-ms=20000&execute-ms=30000`
|
||||
|
||||
Token acquisition inside the page:
|
||||
|
||||
```js
|
||||
await new Promise(res => grecaptcha.enterprise.ready(async () => {
|
||||
res(await grecaptcha.enterprise.execute(SITEKEY, {action: 'SIGNUP'}));
|
||||
}));
|
||||
// → 2400-2500 char token
|
||||
```
|
||||
|
||||
### Solver tokens are rejected
|
||||
|
||||
| attempt | token | result |
|
||||
|---|---|---|
|
||||
| no captcha | `""` | `Please complete the security check` |
|
||||
| fake | `test_token` | same |
|
||||
| 2captcha, `RecaptchaV2EnterpriseTaskProxyless`, action SIGNUP | 2425 chars | same |
|
||||
| in-page `enterprise.execute` | 2510 chars | **`success`** |
|
||||
|
||||
## 3. Signup endpoint
|
||||
|
||||
```
|
||||
POST https://api.netlify.com/auth/signup
|
||||
?provider=email
|
||||
&site_id=app.netlify.com
|
||||
&tracking_session_id=
|
||||
&login=true
|
||||
&entry_point=direct
|
||||
&redirect=https%3A%2F%2Fapp.netlify.com%2F
|
||||
```
|
||||
|
||||
Headers: `Content-Type: application/json`, `Origin: https://app.netlify.com`,
|
||||
`Referer: https://app.netlify.com/signup/email`.
|
||||
|
||||
Body:
|
||||
|
||||
```json
|
||||
{
|
||||
"email": "…",
|
||||
"password": "…",
|
||||
"invite_code": null,
|
||||
"no_autosignup": false,
|
||||
"redirect": "https://app.netlify.com",
|
||||
"entry_point": "direct",
|
||||
"captcha_response": "<token>",
|
||||
"captcha_source": "google",
|
||||
"browser_fingerprint": "<32 hex>",
|
||||
"device_fingerprint": "<32 hex>"
|
||||
}
|
||||
```
|
||||
|
||||
`browser_fingerprint` / `device_fingerprint` are optional — the real form sends
|
||||
them, but the request succeeds without them. They come from a fingerprint
|
||||
module loaded lazily (`l.u$.getFingerprints()` in `lib.js`).
|
||||
|
||||
Success:
|
||||
|
||||
```json
|
||||
{"state":"success","verify":true,"code_id":"6af4928ee9f2819062b957cb"}
|
||||
```
|
||||
|
||||
Failure variants seen:
|
||||
|
||||
```json
|
||||
{"state":"error","message":"Please complete the security check and try again."}
|
||||
{"state":"error","message":"Email address is invalid"}
|
||||
```
|
||||
|
||||
The second one fires for gmail `+alias` addresses — Netlify validates the mailbox
|
||||
format and rejects plus-addressing.
|
||||
|
||||
## 4. Email verification
|
||||
|
||||
Subject: `[Netlify] Let's verify your email` from `team@netlify.com`.
|
||||
|
||||
The link is:
|
||||
|
||||
```
|
||||
https://app.netlify.com/signup?redirect=…#verify_token=<code_id>-<8 digits>&new_user=true
|
||||
```
|
||||
|
||||
Both halves matter: `code_id` is the 24-hex string returned by signup, the second
|
||||
part is the secret.
|
||||
|
||||
## 5. Verify endpoint
|
||||
|
||||
```
|
||||
POST https://api.netlify.com/auth/verify
|
||||
Content-Type: application/json
|
||||
|
||||
{"code_id":"6af4928ee9f2819062b957cb","code":"79923092"}
|
||||
```
|
||||
|
||||
Success returns the full user object including `access_token` (`nfu_…`),
|
||||
`account_id`, `id`, `login_providers: ["password"]`, `has_pending_email_verification: false`.
|
||||
|
||||
In the bundle this is `verifyUserByToken()`: it splits the token on `-` into
|
||||
`code_id` + `code` and POSTs `/auth/verify` with `noPrefix: true`.
|
||||
|
||||
There is also `PUT /users/{id}/confirm_email {secret}` (`verifyUser`) used by the
|
||||
in-app flow.
|
||||
|
||||
## 6. Sites
|
||||
|
||||
### New accounts are SSO-locked
|
||||
|
||||
`POST /api/v1/sites` succeeds, deployment succeeds, and the public URL returns
|
||||
**401 Unauthorized** with a `Login Redirect` body. The site object has:
|
||||
|
||||
```json
|
||||
{"sso_login": true, "sso_login_context": "all",
|
||||
"account_sso_login": true, "account_sso_login_context": "all"}
|
||||
```
|
||||
|
||||
Fix:
|
||||
|
||||
```
|
||||
PATCH /api/v1/sites/{site_id}
|
||||
{"sso_login": false, "account_sso_login": false}
|
||||
```
|
||||
|
||||
After that the same URL returns 200.
|
||||
|
||||
### Deploy
|
||||
|
||||
```
|
||||
POST /api/v1/sites/{site_id}/deploys
|
||||
Authorization: Bearer nfu_…
|
||||
Content-Type: application/zip
|
||||
<body: raw zip bytes>
|
||||
```
|
||||
|
||||
Response: `{"id":"…","state":"uploaded", …}`; the deploy transitions
|
||||
`uploaded → ready` within ~10-15s (`published_deploy` points at it).
|
||||
|
||||
### Build settings
|
||||
|
||||
A site created via API may inherit `build_settings.cmd = "hugo"` from the
|
||||
project template, which breaks CLI deploys. Reset with
|
||||
`PATCH /api/v1/sites/{id} {"build_settings":{"cmd":"","dir":"","publish":""}}`
|
||||
or always pass `--no-build`.
|
||||
|
||||
## 7. Account creation counters
|
||||
|
||||
Nothing rate-limited us at 15 accounts from a single residential IP. Every
|
||||
account: signup → verify → site → deploy → 200. The wall is the mailbox pool, not
|
||||
the API.
|
||||
Reference in New Issue
Block a user