> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swaps.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Sell Position

> Sells an existing position in a Polymarket market. This endpoint allows users to exit their positions by selling their outcome tokens using market orders (FOK/FAK).



## OpenAPI

````yaml /swap-api-reference/openapi.json post /workflows/polymarket/sellPosition
openapi: 3.1.0
info:
  title: Swaps API
  description: >-
    The Swaps API provides instant cross-chain swap and bridge functionality for
    decentralized applications.

    It supports multiple virtual machines (EVM, Solana, Bitcoin) and various DEX
    protocols and bridge solutions.
  version: 3.0.0
  contact:
    name: Swaps.xyz
    url: https://swaps.xyz
servers:
  - url: https://api-v2.swaps.xyz/api
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /workflows/polymarket/sellPosition:
    post:
      tags:
        - Polymarket
      summary: Sell Position
      description: >-
        Sells an existing position in a Polymarket market. This endpoint allows
        users to exit their positions by selling their outcome tokens using
        market orders (FOK/FAK).
      operationId: sellPosition
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - evmEoa
                - side
                - tokenID
                - orderType
                - tickSize
                - negRisk
                - amount
              properties:
                evmEoa:
                  $ref: '#/components/schemas/EvmAddress'
                  description: EVM address (wallet address)
                proxyWallet:
                  $ref: '#/components/schemas/EvmAddress'
                  description: Proxy wallet address (optional)
                side:
                  type: string
                  enum:
                    - SELL
                  description: Order side - must be SELL
                tokenID:
                  type: string
                  description: Polymarket CLOB token ID of the position to sell
                orderType:
                  type: string
                  enum:
                    - FOK
                    - FAK
                  description: >-
                    Order type - Fill-Or-Kill (FOK) or Fill-And-Kill (FAK) for
                    market orders
                tickSize:
                  type: string
                  description: Tick size from the market details (e.g., '0.01')
                negRisk:
                  type: boolean
                  description: Negative risk flag from the market details
                amount:
                  type: number
                  description: Amount of tokens to sell (must be a positive number)
                feeRateBps:
                  type: number
                  description: Fee rate in basis points (optional, defaults to 0)
                slippage:
                  type: number
                  description: Slippage tolerance in basis points (optional, defaults to 0)
              example:
                evmEoa: '0xB9519a08267d7B259eCA6DbD8F7286B1f176A41f'
                side: SELL
                tokenID: >-
                  90234889617199443673709150877675264662915727532354468551650133547723659310093
                orderType: FAK
                tickSize: '0.01'
                negRisk: true
                amount: 2
                feeRateBps: 0
                slippage: 100
      responses:
        '200':
          description: Position sold successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  txId:
                    type: string
                    description: Transaction ID
                  orderResponse:
                    type: object
                    properties:
                      success:
                        type: boolean
                        description: Whether the sell order was successful
                      errorMsg:
                        type: string
                        description: >-
                          Error message if the order failed (empty string if
                          successful)
                      orderID:
                        type: string
                        description: Unique order ID
                      transactionsHashes:
                        type: array
                        items:
                          type: string
                        description: Array of transaction hashes
                      status:
                        type: string
                        description: Order status (e.g., 'matched')
                      takingAmount:
                        type: string
                        description: Amount of USDC received
                      makingAmount:
                        type: string
                        description: Amount of tokens sold
                example:
                  txId: >-
                    0xa66c86a47f4f81caae5d767e2d8a5a7def1a191d24eba5bd49f8767297cfe2e5
                  orderResponse:
                    success: true
                    errorMsg: ''
                    orderID: >-
                      0xb9826fe87ddf21261eceaf513977cb5ea1ae31ac173210857c879cef936dfa2b
                    transactionsHashes:
                      - >-
                        0x39ac6726cf2cfb7814bdb2e04aeeea1d3bde2d1ce7e357f79a404cacb6984f35
                    status: matched
                    takingAmount: '1.376'
                    makingAmount: '2'
        '400':
          description: Bad request due to missing or invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      servers:
        - url: https://api-v2.swaps.xyz/api
          description: Core Swap API Server
components:
  schemas:
    EvmAddress:
      type: string
      pattern: ^0x[a-fA-F0-9]{40}$
      description: EVM address (0x prefix + 40 hex characters)
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          description: Always false for error responses
          enum:
            - false
          example: false
        error:
          type: object
          required:
            - code
            - name
            - message
            - title
            - statusCode
            - timestamp
          properties:
            code:
              type: string
              description: Error type code for programmatic handling
            name:
              type: string
              description: Error class name
            message:
              type: string
              description: Detailed error message
            title:
              type: string
              description: Short, user-friendly error title
            statusCode:
              type: integer
              description: HTTP status code
            details:
              type: object
              description: Additional error details
              additionalProperties: true
            timestamp:
              type: string
              description: ISO 8601 timestamp when the error occurred
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'Limited demo key for API Reference: `5c951bc81da566bbd030ba8e20724063`.'

````