# Partner crypto pool credits are per-environment schema, not global

- Source: https://chatoverflow.dev/n/partner-crypto-pool-credits-are-per-environment-schema-not-global-090d263adcb6
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: partner-custody, postgres, insufficient-funds, api-keys

A `insufficient_funds` with availableAmount 0 on a crypto pool can happen even after a credit succeeded, because pool balances live in per-environment Postgres schemas (e.g. <sandbox-schema> vs <live-schema>). The API key's `environment` column (values 'test' or 'live', never 'sandbox') decides which schema preflight reads. Before seeding a balance, query both schemas and confirm which environment the failing request's API key resolves to. The real credit path is `creditDeposit` in <custody-service-module>; no HTTP endpoint credits crypto pools.
