Treasures Finance Manager API
API for fund managers who publish a strategy on Treasures. You publish the target weights of the strategy you manage; Treasures rebalances every follower's wallet towards them and pays you your share of the fees those followers pay.
What you can do.
- Publish a book (
POST /strategies/{strategyId}/signals) - read the strategies assigned to you with their signal history and performance
(
GET /strategies,GET /strategies/{strategyId}/signals,GET /strategies/{strategyId}/performance) - read the separately managed accounts of an SMA strategy with their fills, holdings and
daily valuations (
GET /strategies/{strategyId}/accounts,GET /strategies/{strategyId}/accounts/{address}/fills,.../holdings,.../performance) - read the orders a strategy's books produced (
GET /strategies/{strategyId}/orders) - read your fee ledger (
GET /fees) - from a signed-in dashboard session, list, mint and revoke your own API keys (
/keys).
A dashboard session can also publish a book, within 900 seconds of a sign-in.
On a retail strategy you never see, and cannot ask about, an individual follower. The aggregates you receive are follower counts, the total value of your followers' portfolios once at least three followers contribute to it, and a signal's order counts by state once at least three followers hold orders on it. On an SMA strategy that minimum does not apply, and you see each account by its own wallet addresses, never the client behind it; but if anyone other than a separately managed account has ever followed it, those aggregates are withheld on every read.
Every {strategyId} accepts the strategy's id or its slug.
Onboarding. Treasures creates your manager account and assigns the strategy you will publish into. Your first key, or the link to your dashboard sign-in, comes from Treasures; after that you can mint and revoke keys yourself. Ask your Treasures contact for a strategy to be assigned to you or to set the address your fees are paid to; neither can be done through this API.
Auth. Every route requires a credential; there is no anonymous route on this API. Two credentials are accepted:
| Action | Manager API key | Dashboard session |
|---|---|---|
Publish a book (POST /strategies/{strategyId}/signals) | yes | yes, with a recent sign-in |
Read your fee ledger (GET /fees) and every other read | yes | yes |
List, mint and revoke your keys (/keys) | no, 403 session_required | yes |
Recent sign-in. Publishing a book from a dashboard session, and minting a key, need a sign-in made in the last 15 minutes: otherwise the request is refused
403 reauth_required; sign out and in again, then retry. Only signing in counts. Linking a
new login method to a signed-in session does not, and neither does a login method first
linked in the last 15 minutes.
Treasures confirms the sign-in with its identity provider on each such request; if that check
cannot complete, the request is refused 503 sign_in_check_unavailable and nothing is
written. A manager API key is never asked for a sign-in.
A manager API key goes in the X-API-Key header (see ManagerApiKey); it is the
credential for your publishing system. A dashboard session is your own Privy login on
the Treasures dashboard, as a Member of the Organization your manager account belongs to:
send the Privy access token as Authorization: Bearer <token> and the Privy identity token
in the Privy-Id-Token header (see ManagerSession and PrivyIdToken). Both answer reads
identically. When X-API-Key is present it is the only credential checked: a bad key is
refused even if a valid session is also sent.
Organizations and permissions. A login that is a Member of more than one Organization
with a manager account names the one it acts for in the X-Organization-Id header; without
it the request is refused 400 organization_required, and naming an Organization the login
is not a Member of is 404 organization_not_found.
A Member who is not an Admin may only do what its permissions grant:
strategies:viewfor the strategy list, signals, performance and publishing a bookinvested_wallets:viewfor the accounts, their fills, holdings and performance, and the orders feedfees:viewfor the fee ledger; a separately managed account's address and transactions on it also needinvested_wallets:view(fees:updategrants nothing any more and is being retired)api_keys:view,api_keys:updateandapi_keys:deleteto list, mint and revoke keys.
Anything else is refused 403 permission_denied; an Admin holds every permission.
A suspended Organization refuses every Member session 403 organization_suspended; the
manager API keys keep working. Permissions never apply to an API key.
Breaking change (v1). A request that carries no credential at all is now
401 unauthorized. It used to be 401 invalid_api_key. A key that is present but
malformed, unknown or revoked still answers invalid_api_key or key_revoked, so a
publishing system that always sends its key sees no change.
Wire format. Weights and USDC amounts are JSON strings to avoid float drift.
Timestamps are ISO-8601 UTC strings; trading_day is a YYYY-MM-DD date.
Rate limits. Per manager, one budget per credential kind: 60 requests per minute
shared by every key you hold, and a separate 120 requests per minute for dashboard
sessions. A dashboard can never use up the budget your keys publish with, nor the reverse.
A 429 carries a Retry-After header in seconds; wait that long before retrying.
A book published from a dashboard session counts against the session budget, not the key's.
Bodies must be JSON. Send Content-Type: application/json on every request that
carries a body; any other content type is refused 415 before the body is read.
Authentication
- API Key: ManagerApiKey
- HTTP: Bearer Auth
- API Key: PrivyIdToken
Your manager API key, cmk_ followed by 24 alphanumeric characters, issued by Treasures or
minted by you (POST /keys). It is shown to you once at issue and cannot be retrieved
afterwards, so store it when you receive it; if you lose it, revoke it yourself
(DELETE /keys/{keyId}) and mint a new one.
The machine credential: it publishes a book with no sign-in step, and it cannot list, mint or revoke keys. When a request carries both a key and a session, only the key is checked.
A malformed or unknown key is 401 invalid_api_key and a revoked key (by you or by
Treasures) is 401 key_revoked. A key for a different Treasures API (an integrator tik_
key, a wallet twk_ key) is not accepted here.
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | X-API-Key |
The Privy access token of your login on the Treasures manager dashboard, sent with
PrivyIdToken. Accepted on every read, and the only credential that can list, mint or
revoke keys. It can also publish a book, but only within 900 seconds
of a sign-in (403 reauth_required otherwise; 503 sign_in_check_unavailable when the
sign-in cannot be checked).
The login must be a Member of the Organization your manager account belongs to
(403 manager_not_linked otherwise); a Member of several such Organizations sends
X-Organization-Id. A Member's permissions decide which routes it may call
(403 permission_denied).
Security Scheme Type: | http |
|---|---|
HTTP Authorization Scheme: | bearer |
The Privy identity token of the same dashboard login, sent with ManagerSession. A session without it, or with one for a different login, is 401 unauthorized.
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | Privy-Id-Token |