What You Get
Trench stores only a hash of each API key, so it cannot be recovered after it is shown. If you lose one, create another and revoke the old one.
Tiers
New apps land on the free Basic tier.
Basic includes everything you need to build a real integration, including trading and governance writes, with no ceiling on trade size or daily volume. The two things it withholds are a higher request rate and the ability to charge your own trade fees.
Message the Trench team for a higher request rate, more apps, or fee wallets. Those are granted by hand.
API Keys
An app can hold several live keys at once, which is what makes rotation possible without downtime. Keys are named, so you can keep separate ones for production, staging, and CI, and revoke one without disturbing the others. Keys authenticate the token exchange and revocation only. Partner API calls are authenticated by the user’s access token, which already identifies your app, so you should never send a key alongside one.Rotating a Key
To rotate without interrupting anyone, move your users onto the new key before you revoke the old one.1
Create the new key
Do this in the portal and copy the secret straight away, since it is shown once.
2
Deploy it
Roll the new value out to every backend that calls
/oauth/token.3
Refresh each user once
A refresh rebinds that user’s tokens to whichever key you present, so refreshing on the new key moves them off the old one.
4
Revoke the old key
Once no live tokens are bound to it, revoking it affects nobody.
Failed Authentication
Twenty failed authentication attempts against oneclient_id within five minutes lock that app out for the remainder of the window. Further attempts return 429 too_many_failed_attempts with a retry-after header, and normal service resumes once the window passes.
Client Status
Every app sits in one of three states.
A suspended app is treated as though it does not exist. The authorize flow returns
unknown_client, token calls return invalid_client, and every previously issued access token begins failing with 401 invalid_token on its next request.
Redirect URIs
Theredirect_uri you send must exactly match a registered string. There is no prefix matching, no wildcard support, and no trailing-slash normalization, so we recommend registering every environment you need up front, including your local callback.
HTTPS is required except for localhost and 127.0.0.1, and that exception only applies while your app is in development. Promoting an app to live will therefore break any localhost URI still in use.
A mismatch returns invalid_redirect_uri.
Volume Caps
Neither tier imposes a trade cap by default, but Trench can set them per app. When set, they apply tomaxSolIn on buys only, and sells are never capped.
Both errors include the relevant limit in the response body, so you can surface something useful to the user.
Fee Wallets
Charging your own fee on trades requires the Partner tier and at least one registered fee wallet. Each address has to already exist on-chain, be a plain system account, and be rent-exempt. Registering several lets Trench spread your fee volume across them, since one is picked at random per trade. The rate itself is not registered. It travels with each request aspartnerFeeBps, so you can price users individually without asking Trench to change anything.
See Partner Fees for how much is taken and how it interacts with slippage.
1-Click Trading
Thetrade:execute and governance write scopes require the user to have delegated their wallet to Trench, which the product refers to as 1-click trading. The consent screen enforces this, so if delegation is off the Approve button stays disabled until the user enables it inline.
This means you will never be issued a trading token that cannot trade at the time it is created. A user can revoke delegation afterwards, though, so we recommend checking tradingEnabled on GET /partner/v1/me before showing trade controls. Writes fail with 403 delegation_missing once delegation has been revoked.