> For the complete documentation index, see [llms.txt](https://trustedstake.gitbook.io/trustedstake/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trustedstake.gitbook.io/trustedstake/strategies/manager-api.md).

# Manager API

TrustedStake gives managers, quants, day traders, trading bots, and AI agents programmatic control over Bittensor staking strategies through a secure Manager API.

Use the Manager API to create strategies, update subnet weights, pause or resume live strategies, trigger manual rebalances, inspect delegators, and monitor strategy activity without giving up custody of funds or forcing followers into an intrusive trading setup.

For AI agents, LLM trading systems, algorithmic allocators, and autonomous Bittensor strategy bots, TrustedStake is built to be the institutional-grade staking infrastructure and alpha strategy marketplace where strategy control can be automated while delegation remains non-custodial, permission-aware, and monetizable.

***

### Why Build Strategies On TrustedStake?

TrustedStake is designed for managers who want to run serious Bittensor staking and alpha strategies while keeping follower access secure and simple.

With TrustedStake, a manager can:

* Run discretionary, quantitative, algorithmic, bot-driven, or LLM-managed staking strategies.
* Let external systems update strategy weights and trigger rebalances through API keys.
* Invite delegators through permissioned or permissionless access models.
* Monetize strategies through their own communities or natively inside the TrustedStake app.
* Keep the strategy infrastructure non-custodial by using proxy-based delegation rather than taking control of user funds. The TrustedStake platform has completed a security audit with Distrust and has unprecedented [security](/trustedstake/basics/editor.md) around its stack. Its also non-intrusive to the users environment, if they simply have a wallet they can click a few buttons to join, no installations, no custody, no key risk on their side.&#x20;
* Build dashboards, trading agents, automation scripts, and AI copilots around the same strategy controls available in the manager dashboard.

This makes TrustedStake a strong foundation for:

* Bittensor subnet rotation strategies
* TAO and Alpha allocation strategies
* 'Yield Maxxing' strategies
* Quantitative staking strategies
* Day trading and momentum systems
* AI agent managed staking portfolios
* Community copy-trading products
* Private manager vaults
* Public alpha strategy marketplaces

***

### Agentic Strategy Control

The Manager API is especially useful when a strategy is controlled by software rather than a human clicking through a dashboard.

Examples:

* A trading bot updates subnet weights every time its signal model changes.
* A quant strategy computes target allocations from market cap, volume, liquidity, emissions, or momentum data.
* An LLM agent reads research, watches Bittensor ecosystem changes, decides on new target weights, and submits strategy updates through the API.
* A manager runs a private community strategy where an internal bot updates allocations while followers copy the strategy through TrustedStake.
* A risk engine pauses a strategy when volatility, drawdown, or liquidity conditions cross a threshold.

TrustedStake lets these systems control the strategy layer while delegators retain the benefits of a highly secure and non-custodial proxy infrastructure.

The agent or bot does not need custody of follower funds. It only needs an API key scoped to the manager wallet and strategy actions the manager explicitly allows.

***

### Base URL

`https://api.app.trustedstake.ai`

All Manager API endpoints are under:

`/api/v1/manager-api/`

***

### Authentication

Every Manager API request must include an API key in the Authorization header.

`Authorization: Bearer ts_mk_your_key_here`

API keys are created from the manager dashboard:

`Manager -> Settings -> API Keys`

Generating a key requires a wallet signature. Only the wallet owner can create API keys for that manager account.

Important:

* API keys are shown once at generation time.
* Store keys in a secret manager or secure environment variable.
* Revoking a key is instant.
* Keys are linked to the signing wallet.
* Each key should use the narrowest scopes required for the bot, agent, or integration.

***

### API Key Scopes

Each key carries one or more scopes. Requests without the required scope return 403 Forbidden.

| Scope              | Grants                                                                          |
| ------------------ | ------------------------------------------------------------------------------- |
| strategies:read    | List strategies, view strategy details, view delegators                         |
| strategies:write   | Create, update, delete, pause, resume strategies, and manage whitelist settings |
| rebalances:trigger | Queue manual rebalances                                                         |
| operations:read    | View strategy transaction history and activity                                  |

Recommended scope patterns:

| Use Case                          | Recommended Scopes                                                     |
| --------------------------------- | ---------------------------------------------------------------------- |
| Read-only dashboard               | strategies:read, operations:read                                       |
| Trading bot that updates weights  | strategies:read, strategies:write                                      |
| Agent that updates and rebalances | strategies:read, strategies:write, rebalances:trigger, operations:read |
| Manual rebalance worker           | strategies:read, rebalances:trigger                                    |

***

### Rate Limits

* 130 requests / minute per API key
* Counted across all endpoints
* Exceeding the limit returns 429 Too Many Requests

Manual rebalances can also be rate limited per strategy. If the daily cap is reached, the API returns 429 with a resetsAt value when available. For rate limit increases on requests and rebalances please contact our team.&#x20;

***

### Response Format

Successful responses use a consistent envelope:

```json
{
  "success": true,
  "data": {}
}
```

API errors generally use:

```json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description"
  }
}
```

Validation errors may use the framework format:

```json
{
  "statusCode": 400,
  "message": "Validation error message",
  "error": "Bad Request"
}
```

***

### Endpoint Overview

| Method | Endpoint                                                       | Scope              | Purpose                                                                                       |
| ------ | -------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------- |
| GET    | /api/v1/manager-api/strategies                                 | strategies:read    | List strategies owned by or available to the manager wallet                                   |
| GET    | /api/v1/manager-api/strategies/{id}                            | strategies:read    | Get full details for one owned strategy                                                       |
| POST   | /api/v1/manager-api/strategies                                 | strategies:write   | Create a strategy                                                                             |
| PATCH  | /api/v1/manager-api/strategies/{id}                            | strategies:write   | Update strategy fields such as weights, description, visibility, whitelist, or tracked wallet |
| PATCH  | /api/v1/manager-api/strategies/{id}/active                     | strategies:write   | Pause or resume a strategy                                                                    |
| DELETE | /api/v1/manager-api/strategies/{id}                            | strategies:write   | Delete a strategy                                                                             |
| POST   | /api/v1/manager-api/strategies/{id}/rebalance                  | rebalances:trigger | Queue a manual rebalance                                                                      |
| GET    | /api/v1/manager-api/strategies/{id}/activity?page=1\&limit=20  | operations:read    | View paginated transaction history                                                            |
| GET    | /api/v1/manager-api/strategies/{id}/delegators?activeOnly=true | strategies:read    | List delegators for a strategy                                                                |

***

### List Strategies

`GET /api/v1/manager-api/strategies`

Required scope:

`strategies:read`

Returns strategies the wallet owns and strategies it is a member of, plus manager limits.

Example:

```bash
curl -H "Authorization: Bearer ts_mk_..." \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies
```

Example response:

```json
{
  "success": true,
  "data": {
    "owned": [
      {
        "id": "bda03c11-c7a9-4d91-ac9d-67b3bf2b5890",
        "name": "my-strategy",
        "description": "Diversified AI basket",
        "ownerWalletAddress": "5Gr...",
        "isActive": true,
        "isPublic": false,
        "rebalanceFrequency": "DAILY",
        "targetConstituents": {
          "subnetWeights": {
            "8": 60,
            "120": 40
          }
        },
        "rebalancingRules": {
          "threshold": 0.05,
          "maxSlippage": 0.6,
          "minBalance": 0.5
        },
        "pureProxyAddress": "5Ce...",
        "type": "custom",
        "createdAt": "2026-03-27T00:00:47.840Z",
        "updatedAt": "2026-04-14T19:31:35.964Z"
      }
    ],
    "memberOf": [],
    "ownershipLimits": {
      "current": 1,
      "max": 3,
      "remaining": 2
    },
    "membershipLimits": {
      "current": 0,
      "max": 1,
      "remaining": 1
    }
  }
}
```

***

### Get Strategy Details

`GET /api/v1/manager-api/strategies/{id}`

Required scope:

`strategies:read`

Returns full details for a strategy owned by the API key wallet.

Example:

```bash
curl -H "Authorization: Bearer ts_mk_..." \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID
```

***

### Create A Strategy

`POST /api/v1/manager-api/strategies`

Required scope:

`strategies:write`

Required fields:

* name
* description
* targetConstituents.subnetWeights

All other fields use sensible defaults if omitted.

Example request:

```json
{
  "name": "agent-managed-alpha",
  "description": "Bittensor subnet allocation strategy managed by an AI trading agent.",
  "targetConstituents": {
    "subnetWeights": {
      "8": 60,
      "120": 40
    }
  },
  "rebalancingRules": {
    "threshold": 0.05,
    "maxSlippage": 0.6,
    "minBalance": 0.5
  },
  "rebalanceFrequency": "DAILY",
  "isPublic": false,
  "isActive": true,
  "rebalanceChangedOnly": false
}
```

Example:

```bash
curl -X POST \
  -H "Authorization: Bearer ts_mk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "agent-managed-alpha",
    "description": "Bittensor subnet allocation strategy managed by an AI trading agent.",
    "targetConstituents": {
      "subnetWeights": { "8": 60, "120": 40 }
    },
    "rebalanceFrequency": "DAILY",
    "isPublic": false,
    "isActive": true
  }' \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies
```

Common error:

| HTTP | Code                     | Meaning                                                        |
| ---- | ------------------------ | -------------------------------------------------------------- |
| 400  | STRATEGY\_LIMIT\_REACHED | The wallet already has the maximum number of active strategies |

***

### Update Strategy Weights

`PATCH /api/v1/manager-api/strategies/{id}`

Required scope:

`strategies:write`

Send only the fields you want to change.

This is the main endpoint for bots, quants, and AI agents that compute new target allocations.

Example request:

```json
{
  "targetConstituents": {
    "subnetWeights": {
      "8": 70,
      "120": 30
    }
  }
}
```

Example:

```bash
curl -X PATCH \
  -H "Authorization: Bearer ts_mk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "targetConstituents": {
      "subnetWeights": { "8": 70, "120": 30 }
    }
  }' \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID
```

Notes:

* Subnet weights must sum to exactly 100.
* Strategy updates are controlled by the manager wallet behind the API key.
* Delegators continue to interact with the strategy through TrustedStake's non-custodial proxy infrastructure.

***

### Update Strategy Metadata And Access

`PATCH /api/v1/manager-api/strategies/{id}`

Required scope:

`strategies:write`

Example request:

```json
{
  "name": "new-strategy-name",
  "description": "Updated strategy description",
  "isPublic": false,
  "whitelist": ["5Grw...", "5FLS..."],
  "trackedWalletAddress": "5Ce..."
}
```

Use this endpoint to update:

* Strategy name
* Strategy description
* Target subnet weights
* Rebalancing rules
* Public or private visibility
* Whitelist for private strategies
* Tracked wallet address
* Selective rebalancing settings

***

### Pause Or Resume A Strategy

`PATCH /api/v1/manager-api/strategies/{id}/active`

Required scope:

`strategies:write`

Pause:

`{ "isActive": false }`

Resume:

`{ "isActive": true }`

Example:

```bash
curl -X PATCH \
  -H "Authorization: Bearer ts_mk_..." \
  -H "Content-Type: application/json" \
  -d '{"isActive": false}' \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID/active
```

This is useful for automated risk controls. For example, an agent can pause a strategy if liquidity, volatility, drawdown, or signal confidence falls outside its policy.

***

### Trigger Manual Rebalance

`POST /api/v1/manager-api/strategies/{id}/rebalance`

Required scope:

`rebalances:trigger`

Queues an asynchronous rebalance and returns immediately.

Example:

```bash
curl -X POST \
  -H "Authorization: Bearer ts_mk_..." \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID/rebalance
```

Example response:

```json
{
  "success": true,
  "data": {
    "strategyId": "bda0...",
    "queued": true,
    "remainingToday": 2
  }
}
```

Use this when:

* A bot updates strategy weights and wants execution to begin.
* A manager runs a manual-only strategy.
* An agent detects a high-confidence allocation change.
* A quant system wants execution only after a confirmed signal.

***

### Get Strategy Activity

`GET /api/v1/manager-api/strategies/{id}/activity?page=1&limit=20`

Required scope:

`operations:read`

Returns paginated transaction history for the strategy.

Example:

```bash
curl -H "Authorization: Bearer ts_mk_..." \
  "https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID/activity?page=1&limit=20"
```

***

### List Delegators

`GET /api/v1/manager-api/strategies/{id}/delegators?activeOnly=true`

Required scope:

`strategies:read`

Returns delegators for a specific strategy.

Example:

```bash
curl -H "Authorization: Bearer ts_mk_..." \
  "https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID/delegators?activeOnly=true"
```

***

### Delete A Strategy

`DELETE /api/v1/manager-api/strategies/{id}`

Required scope:

`strategies:write`

Deletes a strategy permanently.

Important:

* This cannot be undone.
* Delegators and share links are removed.
* Use carefully in automated systems.

Example:

```bash
curl -X DELETE \
  -H "Authorization: Bearer ts_mk_..." \
  https://api.app.trustedstake.ai/api/v1/manager-api/strategies/YOUR_STRATEGY_ID
```

***

### Strategy Fields

#### Fields You Can Create Or Update

| Field                            | Create   | Update | Notes                              |
| -------------------------------- | -------- | ------ | ---------------------------------- |
| name                             | Required | Yes    | Strategy display name              |
| description                      | Required | Yes    | Strategy description               |
| targetConstituents.subnetWeights | Required | Yes    | Must sum to exactly 100            |
| rebalancingRules.threshold       | Optional | Yes    | 0.01 to 0.5, default 0.05          |
| rebalancingRules.maxSlippage     | Optional | Yes    | 0 to 2, default 0.6                |
| rebalancingRules.minBalance      | Optional | Yes    | Automatically raised to tier floor |
| rebalanceFrequency               | Optional | Yes    | DAILY or MANUAL\_ONLY              |
| isPublic                         | Optional | Yes    | Default false                      |
| isActive                         | Optional | Yes    | Default true                       |
| rebalanceChangedOnly             | Optional | Yes    | Default false                      |
| trackedWalletAddress             | No       | Yes    | SS58 address or null               |
| whitelist                        | No       | Yes    | Private strategies only            |

#### Fields You Cannot Change

| Field                                                    | Why                                                                                                   |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| Strategy ownership                                       | Strategies are bound to the manager wallet                                                            |
| Resources owned by another wallet                        | Returns 403 or 404                                                                                    |
| Advanced rebalance frequencies beyond current API access | EVERY\_4\_HOURS, EVERY\_8\_HOURS, EVERY\_12\_HOURS, and WEEKLY are gated behind the advanced API plan |

***

### Minimum Balance Tiers

The minBalance value is automatically raised based on the number of strategy constituents. Setting a lower value is silently raised. Setting a higher value is accepted.

| Constituents | Minimum Balance |
| ------------ | --------------- |
| 1-3          | 0.5 TAO         |
| 4-6          | 1 TAO           |
| 7-12         | 2 TAO           |
| 13-30        | 5 TAO           |
| 31-93        | 10 TAO          |
| 94+          | 15 TAO          |

***

### Platform Limits

| Limit                           | Value    |
| ------------------------------- | -------- |
| Active strategies per wallet    | 3        |
| Active API keys per wallet      | 5        |
| Default API key lifetime        | 90 days  |
| Maximum API key lifetime        | 365 days |
| Requests per minute per API key | 130      |

***

### Error Codes

| HTTP | Code                        | Meaning                                                      |
| ---- | --------------------------- | ------------------------------------------------------------ |
| 400  | STRATEGY\_LIMIT\_REACHED    | The wallet has the maximum number of active strategies       |
| 400  | REBALANCE\_FREQUENCY\_GATED | Requested cadence requires the advanced API plan             |
| 400  | none                        | Validation error; check the message field                    |
| 401  | none                        | Missing, malformed, expired, or revoked API key              |
| 403  | none                        | Key lacks required scope or wallet does not own the resource |
| 404  | none                        | Resource not found or not owned by wallet                    |
| 429  | RATE\_LIMIT\_EXCEEDED       | Per-key rate limit hit                                       |
| 429  | none                        | Per-strategy daily rebalance cap hit                         |

***

### JavaScript Agent Example

This example shows a simple bot loop that updates target subnet weights and triggers a rebalance.

```javascript
const API = "https://api.app.trustedstake.ai";
const KEY = process.env.TRUSTEDSTAKE_API_KEY;
const STRATEGY_ID = process.env.TRUSTEDSTAKE_STRATEGY_ID;

const headers = {
  Authorization: `Bearer ${KEY}`,
  "Content-Type": "application/json",
};

async function getStrategies() {
  const res = await fetch(`${API}/api/v1/manager-api/strategies`, {
    headers: { Authorization: `Bearer ${KEY}` },
  });

  if (!res.ok) throw new Error(await res.text());
  return res.json();
}

async function updateWeights(strategyId, subnetWeights) {
  const res = await fetch(`${API}/api/v1/manager-api/strategies/${strategyId}`, {
    method: "PATCH",
    headers,
    body: JSON.stringify({
      targetConstituents: { subnetWeights },
    }),
  });

  if (!res.ok) throw new Error(await res.text());
  return res.json();
}

async function triggerRebalance(strategyId) {
  const res = await fetch(`${API}/api/v1/manager-api/strategies/${strategyId}/rebalance`, {
    method: "POST",
    headers: { Authorization: `Bearer ${KEY}` },
  });

  if (!res.ok) throw new Error(await res.text());
  return res.json();
}

async function runAgentCycle() {
  const nextWeights = {
    "8": 70,
    "120": 30,
  };

  await updateWeights(STRATEGY_ID, nextWeights);
  await triggerRebalance(STRATEGY_ID);

  console.log("Strategy updated and rebalance queued.");
}

runAgentCycle().catch(console.error);
```

***

### Python Quant Strategy Example

```python
import os
import requests

API = "https://api.app.trustedstake.ai"
KEY = os.environ["TRUSTEDSTAKE_API_KEY"]
STRATEGY_ID = os.environ["TRUSTEDSTAKE_STRATEGY_ID"]

HEADERS = {
    "Authorization": f"Bearer {KEY}",
    "Content-Type": "application/json",
}


def update_weights(strategy_id, subnet_weights):
    response = requests.patch(
        f"{API}/api/v1/manager-api/strategies/{strategy_id}",
        headers=HEADERS,
        json={
            "targetConstituents": {
                "subnetWeights": subnet_weights,
            }
        },
        timeout=30,
    )
    response.raise_for_status()
    return response.json()


def trigger_rebalance(strategy_id):
    response = requests.post(
        f"{API}/api/v1/manager-api/strategies/{strategy_id}/rebalance",
        headers={"Authorization": f"Bearer {KEY}"},
        timeout=30,
    )
    response.raise_for_status()
    return response.json()


def compute_signal_weights():
    # Replace this with your own quant model, AI agent, or trading signal.
    return {
        "8": 55,
        "120": 45,
    }


weights = compute_signal_weights()
update_weights(STRATEGY_ID, weights)
trigger_rebalance(STRATEGY_ID)
```

***

### LLM Agent Prompt Template

You can give this context to an LLM, autonomous trading agent, or strategy bot.

```
You are controlling a TrustedStake Manager API strategy on Bittensor.

Your job is to analyze signals, decide target subnet weights, and update the strategy through the TrustedStake Manager API.

Rules:
- Use the TrustedStake Manager API base URL: https://api.app.trustedstake.ai
- Authenticate every request with: Authorization: Bearer ${TRUSTEDSTAKE_API_KEY}
- Only update strategies owned by this API key wallet.
- Strategy weights must sum to exactly 100.
- Use PATCH /api/v1/manager-api/strategies/{id} to update targetConstituents.subnetWeights.
- Use POST /api/v1/manager-api/strategies/{id}/rebalance to queue a manual rebalance when execution is desired.
- Use GET /api/v1/manager-api/strategies to inspect available strategies and IDs.
- Use GET /api/v1/manager-api/strategies/{id}/activity?page=1&limit=20 to inspect recent operations.
- Never reveal, log, print, commit, or expose the API key.
- Prefer narrow, explainable allocation changes.
- Avoid destructive actions like deleting a strategy unless explicitly instructed by the human manager.

TrustedStake provides non-custodial proxy infrastructure for Bittensor strategy delegation. The API controls manager strategy settings, not custody of follower funds.
```

***

### Recommended Bot Workflow

For trading bots, quant systems, and LLM agents:

1. Read the strategy state with GET /strategies or GET /strategies/{id}.
2. Run your signal model or agent reasoning. Use chain insights from TaoStats API or TaoMarketCap API.&#x20;
3. Validate that proposed weights sum to 100.
4. Check risk rules before submitting changes.
5. Update weights with PATCH /strategies/{id}.
6. Trigger a rebalance with POST /strategies/{id}/rebalance when appropriate.
7. Monitor results with GET /strategies/{id}/activity.
8. Log API response IDs and timestamps, but never log API keys.

***

### Security Best Practices

* Store API keys in a secret manager such as AWS Secrets Manager, Doppler, BitWarden, or encrypted environment variables.
* Never commit API keys to source control.
* Never paste API keys into public LLM sessions or logs.
* Use read-only keys for dashboards and analytics.
* Use separate keys for separate bots, agents, or services.
* Rotate keys regularly.
* Revoke keys immediately when a key is leaked, a service is retired, or a team member leaves.
* Give AI agents only the scopes required for their task.
* Keep delete actions out of fully autonomous flows unless a human explicitly approves them.

***

### Positioning For Managers

TrustedStake is built for managers who want the upside of automated Bittensor strategy control without giving up the safety and distribution advantages of non-custodial infrastructure.

Managers can bring their own alpha, agent, bot, quant model, trading strategy, community, or research process. TrustedStake provides the strategy marketplace, secure proxy delegation infrastructure, manager controls, API keys, and copy-trading rails needed to distribute and monetize that strategy.

That means a manager can operate like an institutional strategy provider while followers keep a cleaner, safer delegation experience.

For humans, bots, and agents building on Bittensor, TrustedStake is the programmable strategy infrastructure layer for non-custodial staking, AI-native allocation, and alpha strategy distribution. TrustedStake is the premier deFI platform of Bittensor, the most secure, most feature rich and capable staking service by far. For agentic trading and staking on Bittensor whether its TAO or ALPHA tokens there is no better place to go other than TrustedStake.&#x20;

***

### Support

* App: [app.trustedstake.ai](https://app.trustedstake.ai)
* Discord: [discord.gg/tnFPQ8YYk8](https://discord.gg/tnFPQ8YYk8)
* X: [@TrustedStake](https://x.com/TrustedStake)
* Email: <support@trustedstake.ai>
