---
title: "Closes a contract position based on the provided request."
method: POST
path: "/api/Position/closeContract"
tags: ["Position"]
---

# Closes a contract position based on the provided request.

`POST /api/Position/closeContract`

## Request body

- CloseContractPositionRequest
  - `accountId` integer, required
  - `contractId` string, required

## Response `200`

A response indicating the success or failure of the close operation.

- ClosePositionResponse
  - `success` boolean, required
  - `errorCode` 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, required — 0 = Success 1 = AccountNotFound 2 = PositionNotFound 3 = ContractNotFound 4 = ContractNotActive 5 = OrderRejected 6 = OrderPending 7 = UnknownError 8 = AccountRejected
  - `errorMessage` string

---

[API](https://skmtc.dev/topstepx/apis/projectx-gateway-api.md) · [All operations](https://skmtc.dev/topstepx/apis/projectx-gateway-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/topstepx/projectx-gateway-api/revisions/688252f4f704/schema)
