---
search:
  tags:
    - sites
    - PUT
seo:
  description: >-
    Links the site, a server app built from a repository, to one of the org's
    ready… Reference for the PUT /v1/sites/{site}/database endpoint in the
    pols.so API.
sidebar:
  label: Link a site to a database
  badge: PUT
title: Link a site to a database
type: openapi-operation
---
Links the site, a server app built from a repository, to one of the
org's ready databases, replacing the database it was linked to. From
its next deploy on, its build and its app get the database's
connection URL, `postgres://app:<password>@<address>:5432/app`, as
the environment variable `env` (default `DATABASE_URL`), and its app
sandboxes, which then run on Cloud Hypervisor, may connect to the
database; no other sandbox may. A variable the source's `build_env`
or `build_secrets` already sets answers 409. Several sites may share
a database; a site has at most one.

`PUT /v1/sites/{site}/database`
