# REST API

Our API offers a range of benefits for various B2B categories, including Wallets, Node Providers, DEX, Trading Bots and DeFi Protocols:

* Gasless transactions;
* Smart DEX Routing & Cross-chain scaling;
* MEV Protection on any EVM chain;
* Additional revenue stream from arbitrage.

**How it works:** Users make swaps, we make a profit through atomic transaction backrunning and return it to you, you can keep the profit for yourself or share it with users.

## SPLX custom methods

### Request: `getOut`

This request fetches the output of a transaction, detailing all the parameters involved in the trade including tokens, trader, volume, partner and more.

```
https://rpc.splitex.app/api/{chainID}/getOut POST
json body: {
    fromToken, *
    toToken, *
    volume, *
    destChainID
}
```

Response: This returns the amount received from the transaction.

```
json
{
  "out":"89300000",
  "inUSD":"893.00",
  "outUSD":"893.00"
}
```

### Request: `swap`

This request is for performing a token swap operation.

```
shell 
https://rpc.splitex.app/api/{chainID}/swap POST
json body: {
    fromToken: string, *
    toToken: string, *
    volume: string, *
    trader: string, *
    destChainID: number,
    partner: string,
    partnerShare: string,
    burnAmount: number,
    slippage: number, (example: 0.5%>50, 1%>100)
}
```

Response: Returns the transaction hash of the performed swap operation.

If chainID same with destChainID:

```
{
    txhash: bytes32 (H256)
}
```

If chainID not same with destChainID:

```
"tx": {
    "data": "0xbe1eace7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002005ac03042870f7c89e3f569cdc0a4b1ebc0af56d5c06b720632dde2ffd3fa8e9300000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000a5b50c095c261dc508ef8820f07ecd4f84adeee2000000000000000000000000000000000000000000000000c249fdd3277800000000000000000000000000000000000000000000000000000000000000000089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008737461726761746500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000086c6966692d61706900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000c1022dd6d566100000000000000000000000000000000000000000000000000000000000000718680000000000000000000000000000000000000000000000000001fe60ea8fb5cd000000000000000000000000389b410992f0472845425f9ce04f2365386c966f000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000014050e198e36a73a1e32f15c3afc58c4506d82f65700000000000000000000000000000000000000000000000000000000000000000000000000000000000003205ac03042870f7c89e3f569cdc0a4b1ebc0af56d5c06b720632dde2ffd3fa8e9300000000000000000000000000000000000000000000000000000000000000800000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000a5b50c095c261dc508ef8820f07ecd4f84adeee20000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000046b3fdf7b5cde91ac049936bf0bdb12c5d22202e00000000000000000000000046b3fdf7b5cde91ac049936bf0bdb12c5d22202e000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000000000000000000000000000000000000000d4371100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001442646478b000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000000000000000000000000000000000000000d437110000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063000000000000000000000000000000000000000000000000bfc37eff39140bc20000000000000000000000002dfadab8266483bed9fd9a292ce56596a2d1378d00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000004202c2132d05d31c914a87c6611c10748aeb04b58e8f01ffff01254aa3a898071d6a2da0db11da73b02b4646078f002dfadab8266483bed9fd9a292ce56596a2d1378d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
    "value": "0x1fe60ea8fb5cd",
    "from": "0x389b410992f0472845425f9ce04f2365386c966f",
    "chainId": 56,
    "gasPrice": "0x3b9aca00",
    "gasLimit": "0x1020a2"
  }
```


---

# 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://split-docs.gitbook.io/docs/for-developers/rest-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.
