Connect
Connect Neon from the terminal. Pass --help for the flags Neon accepts, plus --no-browser for headless environments.
polylane cloud connect --provider neonAn organization API key from your Neon organization settings, or a personal API key.
Neon connects with an API key:
- Open the Neon Console, go to Organization settings → API keys, and choose Create new API key. An organization API key reaches every project in that organization.
- Copy the key (it starts with
napi_). - Paste the key into Polylane. If it is a personal API key that reaches more than one organization, pick the one to connect when prompted.
- Polylane validates the key and starts syncing.
Each connection covers a single Neon organization. Polylane discovers its projects, branches, computes, and databases, including branch parentage, compute autoscaling limits, and the hosts your services connect to. Services elsewhere in your stack that reach a Neon compute host, for example through a DATABASE_URL or a Cloudflare Hyperdrive configuration, are linked to that compute on the topology. Keys are encrypted before they are stored, and the agent never sees them.
Each project's default branch is monitored by default. Turn on preview, staging and development branches in the account settings to monitor the other branches too. During an investigation, Polylane can run read-only queries on a branch, such as the slowest statements from pg_stat_statements; those queries start a suspended compute.
Troubleshooting
"Neon does not recognize this API key" error
- Check that the key was copied in full and has not been revoked under Organization settings → API keys.
"Cannot read the projects in this organization" error
- Project-scoped API keys reach one project and cannot list the organization. Create an organization API key instead.
- A personal API key must belong to an account that is a member of the organization.
"Multiple Neon organizations are reachable" error
- The key can reach more than one organization, so name the one to connect.
- Connecting in the console, pick the organization when prompted after validation.
- Connecting via the API, set the
orgIdfield to the organization id (org-…).
Missing resources
- Neon can take a few minutes to sync everything.
- Trigger a manual Sync from the account header to refresh.
Disconnecting
Disconnect the account in Polylane, then revoke the API key under Organization settings → API keys in the Neon Console.
Connect Neon from a CI job or any other environment without a browser.
Connecting Neon needs no browser: the same endpoint the console calls fits in a CI job. One authenticated POST creates the connection and starts the first sync.
Prerequisites
- A Polylane API key with the
cloud_accounts:writeandcloud_accounts:readscopes. See API keys and OAuth. - Your workspace ID, which starts with
ws_. Read it fromGET /v1/workspaceswith the same key. - A Neon organization API key, created under Organization settings → API keys in the Neon Console.
Create the connection
curl -X POST https://api.polylane.com/v1/cloud_accounts \
-H "x-api-key: $POLYLANE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "neon",
"workspaceId": "ws_0abc123",
"token": "<neon-api-key>",
"orgId": "org-example-12345678"
}'
One call connects one Neon organization.
orgIdmay be omitted only when the key reaches exactly one organization, as an organization API key does; otherwise the call fails with a400that lists the reachable organizations.
The response lists what was connected, with the first sync already running. Trimmed to the two fields the rest of the flow reads:
{
"success": true,
"result": {
"provider": "neon",
"accounts": [{ "id": "acc_34gky74ibc92h8t2efn8csrh", "status": "syncing" }],
"failures": []
}
}
An account that is already connected lands in failures instead of accounts, so repeating the call never duplicates a connection.
Wait for the first sync
Poll each returned account by its id until status reaches ready (new on registration, syncing while resources stream in):
until [ "$(curl -s "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY" | jq -r '.result.status')" = "ready" ]; do
sleep 15
done
Give the loop a deadline so a failed connect fails the job instead of hanging it. Once the account is ready, its resources are in the topology and Polylane has started its first check.
Disconnect from the API
Deleting the connection stops every sync and check and deletes the credentials Polylane held. The call needs the cloud_accounts:delete scope:
curl -X DELETE "https://api.polylane.com/v1/cloud_accounts/$WORKSPACE_ID/$ACCOUNT_ID" \
-H "x-api-key: $POLYLANE_API_KEY"
Then revoke the Neon API key on the provider side, as described under Disconnect below.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Everything Polylane set up in Neon is removed as well; nothing is left behind.
polylane cloud disconnect <id>Tools
4Operations agents can perform in threads.
Supported resources
4Resource types that show up in your infrastructure graph.