Skip to content

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.

/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.

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.

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,
});

Replace the path; the headers, query string and body stay the same:

Terminal window
# Before
curl https://api.vaif.studio/generated/posts -H "X-Vaif-Key: $VAIF_PUBLISHABLE_KEY"
# After
curl https://api.vaif.studio/v1/data/$VAIF_PROJECT_ID/posts -H "X-Vaif-Key: $VAIF_PUBLISHABLE_KEY"