Browse the API reference

Delete Portfolio Block

post/extensions/roboinvestor/{graph_id}/operations/delete-portfolio-block

Part of Extensions: RoboInvestor.

Cascade-delete the portfolio plus all of its positions. When active positions exist, the request must include confirm_active_positions: true — safety belt to prevent accidental cascade. Disposed-only portfolios delete without the flag.

Idempotency: supply an Idempotency-Key header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Authentication

Authenticate in any one of these ways — not all of them:

  • API key in the X-API-Key header.
  • Bearer token in the Authorization header.

Path parameters

NameTypeDescription
graph_idrequiredstringGraph Id

Header parameters

NameTypeDescription
Idempotency-KeyoptionalstringIdempotency-Key

Request body

Required, application/json.

FieldTypeDescription
portfolio_idrequiredstring

Target portfolio ID.

confirm_active_positionsoptionalboolean

Required acknowledgement when the portfolio has active positions. Set `true` to consent to cascade-deleting them; leave `false` and the operation returns 409 if any active positions exist.

Default: false

Example request

curl
curl -X POST "https://api.robosystems.ai/extensions/roboinvestor/{graph_id}/operations/delete-portfolio-block" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "portfolio_id": "port_watchlist_2026"
}'

Responses

200 Successful Response

FieldTypeDescription
operationrequiredstring

Kebab-case operation name

operationIdrequiredstring

op_-prefixed ULID for audit and SSE correlation

statusrequiredstring

Operation lifecycle state

One of: completed, pending, failed

resultoptionalDeletePortfolioBlockResponse

Command-specific result payload

DeletePortfolioBlockResponse fields
FieldTypeDescription
deletedrequiredboolean

`true` when the portfolio row was removed.

portfolio_idrequiredstring

ID of the portfolio that was deleted.

positions_deletedrequiredinteger

Count of position rows cascade-deleted with the portfolio.

atrequiredstring

ISO-8601 UTC timestamp

createdByoptionalstring

User ID that initiated the operation (null for legacy callers)

idempotentReplayoptionalboolean

True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

Default: false

StatusMeaning
400Invalid request
401Authentication required
403Access denied
404Resource not found
409Idempotency-Key conflict — key reused with different body
422Validation error
429Rate limit exceeded
500Internal server error