Migrating from /generated to /v1/data
The data API’s URL is /v1/data/{projectId}/{table}. The older /generated/{table} form still works but is deprecated, with a sunset date of 12/01/2026.
Why the change
Section titled “Why the change”/generated/{table} found the project from the API key, so the same URL meant different projects for different keys. /v1/data/{projectId}/{table} puts the project in the URL, so logs, traces and bug reports identify it without the key. The API key still authenticates, and it must belong to the project in the URL; a key for another project is refused with 403.
Deprecation headers
Section titled “Deprecation headers”Responses from /generated/* carry Sunset, Deprecation and a Link: <…>; rel="successor-version" header pointing at the /v1/data URL, so HTTP tools surface the change. Responses from /v1/data/* carry Api-Version: v1.
How to migrate
Section titled “How to migrate”@vaifstudio/client
Section titled “@vaifstudio/client”Pass projectId and the SDK uses /v1/data for you:
import { createVaifClient } from "@vaifstudio/client";
const vaif = createVaifClient({ projectId: process.env.VAIF_PROJECT_ID, // needed for /v1/data URLs apiKey: process.env.VAIF_PUBLISHABLE_KEY,});To stay on the old path for a while (for example, while you stage the change), set useLegacyDataUrls: true. Remove it before the sunset date:
import { createVaifClient } from "@vaifstudio/client";
const vaif = createVaifClient({ projectId: process.env.VAIF_PROJECT_ID, apiKey: process.env.VAIF_PUBLISHABLE_KEY, useLegacyDataUrls: true,});Other HTTP clients
Section titled “Other HTTP clients”Replace the path; the headers, query string and body stay the same:
# Beforecurl https://api.vaif.studio/generated/posts -H "X-Vaif-Key: $VAIF_PUBLISHABLE_KEY"
# Aftercurl https://api.vaif.studio/v1/data/$VAIF_PROJECT_ID/posts -H "X-Vaif-Key: $VAIF_PUBLISHABLE_KEY"