---
title: "Create Subscription"
method: POST
path: "/v1/rebalancing/subscriptions"
tags: ["Rebalancing"]
---

# Create Subscription

`POST /v1/rebalancing/subscriptions`

## Request

- Base URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets`
- URL: `https://broker-api.giftcity.sandbox.in.alpaca.markets/v1/rebalancing/subscriptions`
- Auth: HTTP basic

Creates a subscription between an account and a portfolio.

## Request body

- object
  - `account_id` string: Account ID. Account must be active and the account must not have any active subscriptions already (only 1 is permitted at a time)
  - `portfolio_id` string: Portfolio ID. Portfolio must be active

## Response `200`

OK

- PortfolioSubscription
  - `account_id` string: Account ID subscribing to portfolio
  - `created_at` string, date-time: Subscription creation timestamp
  - `id` string: Subscription ID
  - `last_rebalanced_at` string: Last rebalancing event for this subscription. Can be null.
  - `portfolio_id` string: Portfolio ID for subscription

## Other responses

- `400`: The request body is missing, is not valid JSON, or has a value of the wrong type. Send a JSON body that matches the endpoint and try again.
- `401`: The request is not authenticated. Send a valid API key ID and secret, or a Broker Dashboard session, and try again.
- `403`: These credentials are not allowed to perform this action, or rebalancing is not permitted for this correspondent or account.
- `404`: No account with that ID exists for your correspondent. Check the account ID and try again.
- `415`: The Content-Type header is not application/json. Set Content-Type to application/json and send the body again.
- `422`: The request failed validation or cannot be completed in its current state. The message describes the reason.
- `500`: Something went wrong on our side while handling the request. Check whether the subscription was created before retrying, because this request is not idempotent. If it keeps happening, contact support.

---

[API](https://skmtc.dev/alpacahq/apis/broker-api.md) - [All operations](https://skmtc.dev/alpacahq/apis/broker-api/llms.txt) - [OpenAPI document](https://skmtc.dev/alpacahq/apis/broker-api/revisions/381b1ecb3ccc?raw)
