/projects/{project_id}/branches/{branch_id}/authEnable Neon Auth for the branchEnables Neon Auth for the specified branch by connecting it to an authentication provider. Creating the integration provisions the neon_auth schema in the branch database, which stores user identity data synchronized from the provider.
Parameters
project_idstringpathrequiredThe Neon project ID
branch_idstringpathrequiredThe Neon branch ID
Request body
requiredapplication/json
auth_providerstringrequiredAuthentication provider integrated with this Neon Auth configuration. `better_auth` integrates with Better Auth (the current, recommended provider). `stack` integrates with Stack Auth (deprecated). `mock` is a simulated provider for local development and testing only.
database_namestringName of the database to enable Neon Auth on. When omitted, the integration uses the project's default database.
{
"auth_provider": "better_auth",
"database_name": "string"
}Responses
auth_providerstringrequiredAuthentication provider integrated with this Neon Auth configuration. `better_auth` integrates with Better Auth (the current, recommended provider). `stack` integrates with Stack Auth (deprecated). `mock` is a simulated provider for local development and testing only.
auth_provider_project_idstringrequiredProject ID assigned by the auth provider for this integration.
base_urlstringBase URL of the Neon Auth service for this integration. Set as the NEON_AUTH_BASE_URL environment variable in your application.
jwks_urlstringrequiredURL of the provider's JWKS endpoint used to verify JWTs.
pub_client_keystringrequiredPublishable SDK key from the auth provider. Populated only for Stack Auth (deprecated); empty for Better Auth.
schema_namestringrequiredPostgres schema containing the auth integration tables. Defaults to `neon_auth`.
secret_server_keystringrequiredSecret server-side SDK key from the auth provider. Populated only for Stack Auth (deprecated); empty for Better Auth. Treat as a credential.
table_namestringrequiredPostgres table in the integration schema where synced user records are stored.
{
"auth_provider": "better_auth",
"auth_provider_project_id": "string",
"base_url": "string",
"jwks_url": "string",
"pub_client_key": "string",
"schema_name": "string",
"secret_server_key": "string",
"table_name": "string"
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}