---
updatedAt: 2025-09-22T22:25:02.000Z
agentTools:
  projectIndex: https://dev.tensor.trade/llms.txt
---

# Deposit/Withdraw SOL

Creates the transaction to Deposit/Withdraw SOL to/from a TSwap pool

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "components": {
    "schemas": {
      "OnchainTx": {
        "properties": {
          "tx": {
            "type": "string",
            "format": "byte",
            "nullable": true
          },
          "txV0": {
            "type": "string",
            "format": "byte"
          },
          "lastValidBlockHeight": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "metadata": {
            "additionalProperties": false,
            "type": "object",
            "nullable": true
          }
        },
        "required": [
          "txV0"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "TxResponse": {
        "properties": {
          "txs": {
            "items": {
              "$ref": "#/components/schemas/OnchainTx"
            },
            "type": "array"
          }
        },
        "required": [
          "txs"
        ],
        "type": "object",
        "additionalProperties": false
      },
      "TxResponseRest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TxResponse"
          },
          {
            "properties": {
              "totalCost": {
                "type": "number",
                "format": "double",
                "nullable": true
              }
            },
            "type": "object"
          }
        ]
      },
      "DepositWithdrawAction": {
        "enum": [
          "DEPOSIT",
          "WITHDRAW"
        ],
        "type": "string"
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "x-tensor-api-key",
        "in": "header"
      }
    }
  },
  "info": {
    "title": "Trading API",
    "version": "1.0.0",
    "contact": {}
  },
  "paths": {
    "/tx/tswap/deposit_withdraw_sol": {
      "get": {
        "operationId": "TswapDepositWithdrawSolTx",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TxResponseRest"
                }
              }
            }
          },
          "400": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error"
          }
        },
        "description": "Creates the transaction to Deposit/Withdraw SOL to/from a TSwap pool",
        "summary": "Deposit/Withdraw SOL",
        "security": [
          {
            "api_key": []
          }
        ],
        "parameters": [
          {
            "description": "The action to perform. Either \"deposit\" or \"withdraw\"",
            "in": "query",
            "name": "action",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/DepositWithdrawAction"
            }
          },
          {
            "description": "The address of the swap pool",
            "in": "query",
            "name": "poolAddress",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "The amount of SOL to deposit/withdraw",
            "in": "query",
            "name": "lamports",
            "required": true,
            "schema": {
              "format": "float",
              "type": "number",
              "minimum": 0
            }
          },
          {
            "description": "The blockhash to be passed into the transaction",
            "in": "query",
            "name": "blockhash",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Compute units for the transaction",
            "in": "query",
            "name": "compute",
            "required": false,
            "schema": {
              "format": "int32",
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "description": "The priority in micro-lamports to be used for the transaction",
            "in": "query",
            "name": "priorityMicroLamports",
            "required": false,
            "schema": {
              "format": "int32",
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "tags": [
          "TSwap"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://api.mainnet.tensordev.io/api/v1"
    }
  ]
}
```