# Can't access portfolio API in sandbox

**URL:** <https://forum.alpaca.markets/t/cant-access-portfolio-api-in-sandbox/19984>\
**Category:** Alpaca Account Troubleshooting\
**Created:** [November 4, 2026, 6:12pm UTC](https://forum.alpaca.markets/t/cant-access-portfolio-api-in-sandbox/19984 "2026-11-04T18:12:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Franco](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/sebastian_franco/32/9215_2.png) [@Sebastian\_Franco](https://forum.alpaca.markets/u/Sebastian_Franco)\
**Post date:** [November 4, 2026, 6:12pm UTC](https://forum.alpaca.markets/t/cant-access-portfolio-api-in-sandbox/19984/1 "2026-11-04T18:12:57Z")

</div>

## Environment

**Language**  
Kotlin 2.2.0, running on the JVM (Temurin JDK 21). Gateway service built with Ktor.

**Alpaca SDK Version**  
markets.alpaca:alpaca-java 0.1.3

**Other Environment Details**  
macOS (Darwin). Server-side backend service. The issue also reproduces with plain curl (below), so it’s independent  
of the SDK.

## Problem

**Summary**  
GET /v1/rebalancing/portfolios returns 403 “insufficient permission” (code 40310000) with  
Broker API sandbox keys that work on every other endpoint. The same keys return 200 on  
/v1/accounts and /v1/assets, so they are valid Broker API keys (key id starts with “CK”),  
not Trading keys. Only the Rebalancing API is denied.

I’ve confirmed:

- Key id prefix is “CK” (Broker API key, not a PK/AK Trading key).
- /v1/accounts and /v1/assets → 200 with the same key/secret.
- /v1/rebalancing/portfolios → 403 (code 40310000, “insufficient permission”).
- /v1/beta/rebalancing/portfolios → 404 (so the non-beta path is the correct one).

What do I need to do to get access to the Rebalancing API on this sandbox account? Is it an  
entitlement that has to be enabled for the account, or am I missing something in the request?

**Paper or Live Trading?**  
Broker API — Sandbox environment ([https://broker-api.sandbox.alpaca.markets](https://broker-api.sandbox.alpaca.markets)).

**Example Code**

# Same credentials for all three calls. Only rebalancing is denied.

B=[https://broker-api.sandbox.alpaca.markets](https://broker-api.sandbox.alpaca.markets)  
KEY=\<BROKER\_API\_KEY\_ID\> # starts with CK  
SEC=\<BROKER\_API\_SECRET\_KEY\>

curl -s -o /dev/null -w “accounts %{http\_code}\n” -u “$KEY:$SEC” “$B/v1/accounts?status=ACTIVE”  
curl -s -o /dev/null -w “assets %{http\_code}\n” -u “$KEY:$SEC” “$B/v1/assets”  
curl -s -o /dev/null -w “rebalancing %{http\_code}\n” -u “$KEY:$SEC” “$B/v1/rebalancing/portfolios”

# Output:

# accounts 200

# assets 200

# rebalancing 403 → {“code”:40310000,“message”:“insufficient permission”}

---

<div class="post-metadata">

**Author:** ![Kirk\_Brown](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kirk_brown/32/9230_2.png) [@Kirk\_Brown](https://forum.alpaca.markets/u/Kirk_Brown)\
**Post date:** [November 4, 2026, 10:58pm UTC](https://forum.alpaca.markets/t/cant-access-portfolio-api-in-sandbox/19984/2 "2026-11-04T22:58:27Z")

</div>

Google Gemini is a great place to look for answers when you need them ASAP. I just copied and pasted your problem. You’re doing everything correctly. You need a backend change.

**The Fix**

You cannot self-enable this via the dashboard API. You must **contact Alpaca Support** or your dedicated Integration Engineer to have the capability toggled:

1. Send an email to **support** @[alpaca.markets](http://alpaca.markets/) (or reach out via your regular Slack partner channel if you have one).
2. Explicitly state that you are trying to evaluate the **Portfolio Rebalancing API** in the Sandbox environment.
3. Provide your **Correspondent ID** or the **Key ID (`CK...`)** that you are testing with.
4. Request them to **enable the Rebalancing feature flag for your correspondent profile**.

Once the team flags your profile, your exact `curl` statement will immediately begin returning `200 OK` (or an empty JSON list `[]` if you haven’t defined any portfolios yet). No code or header adjustments are needed on your end.
