I am automating the creation of Vercel Projects by leveraging the API.
I can successfully create Environment Variable (either through project creation or through the environment variables endpoint) with the exception of environment variables that contain a secret. I get the following error:
Error creating project: { error: { code: 'ENV_SHOULD_BE_A_SECRET', message: 'Value for variable NEXT_PUBLIC_POSTHOG_KEY is forbidden. Only secret IDs are allowed.', key: 'environmentVariables.value', envVarKey: 'NEXT_PUBLIC_POSTHOG_KEY', value: '' } }
However, the secrets endpoint does not allows me to specify secrets for a specific project since the projectID property is marked as depecreated:
https://vercel.com/docs/rest-api/endpoints/secrets#create-a-new-secret
How should I use the Vercel API to create Environment Variable secrets that are specific for a single project?