# API

### Api V2 document

Endpoint: `https://api.1sol.io`

## `GET` /2/101/token-list

\*\*

#### Request:

* Headers: No specific headers needed.
* Url Params: No specific query parameters needed.
* Body: No specific body attributes needed.

***

#### Response:

* Status: **200**
* Body:

```json
{
  "name": "1Sol Token List",
  "logoURI": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF/logo.png",
  "tokens": [
    {
      "chainId": 101,
      "address": "4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF",
      "symbol": "1SOL",
      "name": "1sol.io Token",
      "logoURI": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF/logo.png",
      "decimals": 8,
      "feeAccount": "2h2Z8YkECHyDKamQt6B7hTqX6m8ANV3pwSa2CjYsss5x",
      "tags": [],
      "extensions": {
          "coingeckoId": "1sol",
          "coingeckoName": "1Sol"
      }
    }
  ]
}
```

## `POST` /2/101/routes

\*\*

#### Request:

* Headers: No specific headers needed.
* Url Params: No specific query parameters needed.
* Body:

```json
{
    "amountIn": 100000,
    "sourceTokenMintKey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "destinationTokenMintKey": "4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF",
    "programs": [
        "SwaPpA9LAaLfeLi3a68M4DjnLqgtticKg6CnyNwgAC8",
        "SSwpkEEcbUqx4vtoEByFjSkhKdCT862DNVb52nZg1UZ",
        "9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP",
        "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
        "DESVgJVGajEgKGXhb6XmqDHGz3VjdgP7rEVESBgxmroY",
        "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8",
        "1MooN32fuBBgApc8ujknKJw5sef3BVwPGgz3pto1BAh"
    ],
    "size": 4,
    "onlyDirect": false,
    "experiment": false,
    "bridgeMints": []
}
```

***

#### Description:

* If the length of response.distributions.routes is `1`, it's a direct exchange.
* If the length of response.distributions.routes is `2`, it's exchanged with a bridge token.

#### Response:

* Type: **Direct**
* Body:

```json
{
    "amountIn": 100000,
    "chainId": 101,
    "sourceTokenMint": {
        "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "decimals": 6
    },
    "destinationTokenMint": {
        "address": "4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF",
        "decimals": 8
    },
    "distributions": [
      {
        "routeType": "Direct",
        "sourceTokenMint": {
          "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
          "decimals": 6
        },
        "destinationTokenMint": {
          "address": "4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF",
          "decimals": 8
        },
        "amountIn": 100000,
        "amountOut": 15122510,
        "routes": [
          [
            {
              "exchangerFlag": "OneMoon",
              "pubkey": "6XXjau4dgEw6mJ9xjy6QWkzTiQYDn3FgWRfYXpANku4G",
              "extPubkeys": [],
              "programId": "1MooN32fuBBgApc8ujknKJw5sef3BVwPGgz3pto1BAh",
              "sourceTokenMint": {
                "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                "decimals": 6
              },
              "destinationTokenMint": {
                "address": "4ThReWAbAVZjNVgs5Ui9Pk3cZ5TYaD9u6Y89fp6EFzoF",
                "decimals": 8
              },
              "amountIn": 100000,
              "amountOut": 15122510
            }
          ]
        ]
      }
    ]
}
```

***

#### Response:

* Type: **WithBridgeMint**
* Body:

```json
{
  "amount_in": 1000000000,
  "chain_id": 101,
  "source_token_mint": {
    "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "decimals": 6
  },
  "destination_token_mint": {
    "pubkey": "So11111111111111111111111111111111111111112",
    "decimals": 9
  },
  "distributions": [
    {
      "source_token_mint": {
        "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "decimals": 6
      },
      "destination_token_mint": {
        "pubkey": "So11111111111111111111111111111111111111112",
        "decimals": 9
      },
      "amount_in": 1000000000,
      "amount_out": 8676914691,
      "routes": [
        [
          {
            "exchanger_flag": "SerumDex",
            "pubkey": "6oGsL2puUgySccKzn9XA9afqF217LfxP5ocq4B3LWsjy",
            "program_id": "9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin",
            "ext_pubkeys": [],
            "source_token_mint": {
              "pubkey": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "decimals": 6
            },
            "destination_token_mint": {
              "pubkey": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
              "decimals": 9
            },
            "amount_in": 999948424,
            "amount_out": 8438000000
          }
        ],
        [
          {
            "exchanger_flag": "SaberStableSwap",
            "pubkey": "Lee1XZJfJ9Hm2K1qTyeCz1LXNc1YBZaKZszvNY4KCDw",
            "program_id": "SSwpkEEcbUqx4vtoEByFjSkhKdCT862DNVb52nZg1UZ",
            "ext_pubkeys": [],
            "source_token_mint": {
              "pubkey": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
              "decimals": 9
            },
            "destination_token_mint": {
              "pubkey": "So11111111111111111111111111111111111111112",
              "decimals": 9
            },
            "amount_in": 8438000000,
            "amount_out": 8676914691
          }
        ]
      ],
    }
  ]
}
```

***

## `POST` /2/101/transactions

\*\*

#### Request:

* Headers: No specific headers needed.
* Url Params: No specific query parameters needed.
* Body:

```json
{
    "route": {
        "sourceTokenMint": {
            "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
        },
        "destinationTokenMint": {
            "address": "So11111111111111111111111111111111111111112"
        },
        "amountIn": 1000000000,
        "amountOut": 8674918662,
        "routes": [
            [
                {
                    "pubkey": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2",
                    "programId": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8",
                    "extPubkeys": [
                        "9wFFyRfZBsuAha4YcuxcXLKwMxJR43S7fPfQLusDBzvT"
                    ],
                    "sourceTokenMint": {
                        "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
                    },
                    "destinationTokenMint": {
                        "address": "So11111111111111111111111111111111111111112"
                    },
                    "amountIn": 1000000000,
                    "amountOut": 8674918662
                }
            ]
        ]
    },
    "minimumAmountOut": 8674910000,
    "wallet": "DTc6DFAH2Jf349NcPLxYCspQcCM44EwByTFrFrQVFeLs",
    "protocolSwapInfo": null,
    "sourceTokenAccount": null,
    "destinationTokenAccount": null,
    "bridgeTokenAccount": null,
    "openOrders": {}
}
```

***

#### Response:

* Status: **200**
* Body:

```json
{
    "transactions": [
        "base64_string_1",
        "base64_string_2",
        "base64_string_3",
    ],
}
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.1sol.io/development/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
