---
title: "Assemble Odos quote into transaction"
method: POST
path: "/sor/assemble"
tags: ["Smart Order Routing"]
---

# Assemble Odos quote into transaction

`POST /sor/assemble`

Provide valid call data for a given quoted path. This is called after calling the `sor/quote` endpoint and receiving back a quote and `pathID`.

A quote only lasts for 60 seconds. If it is not assembled in that time, it will not be available to assemble, and the path will need to be quoted again.

Use the information provided by this endpoint directly. Do not try to modify the call data. You will make a mistake and you will end up losing money. **We will not provide support for users modifying the call data provided by our API.** The data the API provides is directly able to be executed on chain.

## Request Body

| Parameter | Description | Required |
| --- | ------- | --- |
| `userAddr` | Address of the user who requested the quote | Yes |
| `pathId` | ID of the Path returned from the `sor/quote/{version}` endpoint | Yes |
| `simulate` | Simulate the transaction to make sure it can actually be executed. This increases the response time to receive transaction data. Defaults to False. | No |
| `receiver` | Optionally, specify a different receiver address for the transaction output, default receiver is `userAddr` | No |

## Response Body

| Parameter | Description |
| --- | --- |
| `deprecated` | If the endpoint or any part of the request is deprecated, this field will be populated with a message. This field is omitted if there is nothing to notify on. |
| `blockNumber` | Block number the quote was generated for |
| `gasEstimate` | A very naive gas estimate |
| `gasEstimateValue` | USD Value of the `gasEstimate` |
| `inputTokens` | List of input token addresses and amounts |
| `outputTokens` | List of output token addresses and amounts |
| `netOutValue` | USD value of the sum of the output tokens after gas |
| `outValues` | A list of the output values of the given output tokens. In the same order as the `outputTokens` list |
| `transaction` | Transaction data needed for execution |
| `simulation` | Simulation results |

### Transaction

This structure can be signed by a wallet and be executed against the Odos router.

In the smart contract that makes the swap, the `data` field of the transaction given in the response can be used in a low level call from another contract:

```solidity
(bool success, bytes memory result) = router.call{value: $ethInput}(data)
```

Where `$ethInput` is `0` unless the native coin of the network is an input, in which case the value should be set to the corresponding path input amount. Approvals for ERC20 inputs should be made to the router address prior to the call. The address of the router can be found in the `to` field of the response, as well as from the `/info/router/{version}/{chain_id}` endpoint.

| Parameter | Description |
| --- | --- |
| `chainId` | The chain ID for the path to execute one |
| `gas` | Suggested gas limit. Either 2X the naive gas estimate or 10% more than the simulated gas estimate |
| `gasPrice` | Gas price used to calculate the path |
| `value` | Input amount of gas token. 0 if the gas token is not one of the inputs |
| `to` | Odos router address to be used for the transaction |
| `from` | Source of the executed transaction |
| `data` | Call data for the Odos router. This is the payload used by our executor contracts to execute the necessary DEX swaps. |
| `nonce` | The standard ETH nonce |


### Simulation

This the result of the simulation

| Parameter | Description |
| --- | --- |
| `isSuccess` | If the transaction reverted or not |
| `amountsOut` | Amounts out when the path was simulated |
| `simGasUsed` | Gas used by the simulation |
| `gasEstimate` | Estimate from a `eth_estimateGas` RPC call for the path |
| `simulationError` | If a simulation error occurs, it will show up here. |

## Request body

- AssemblePathRequest — Assemble Path Request Schema
  - `userAddr` string, required
  - `pathId` string, required
  - `simulate` boolean, nullable
  - `receiver` string, nullable
  - `permit2Signature` string, nullable

## Response `200`

Successful Response

- PathResponse — Assembled Path Transaction Response including quote, transaction, and simulation data Attributes: blockNumber (int): block number of transaction quote gasEstimate (int): gas estimate for transaction quote gasEstimateValue (float): gas estimate value for transaction quote in gwei inputTokens (List[TokenAmount]): list of input token amounts and input values outputTokens (List[TokenAmount]): list of output token amounts and output values netOutValue (float): new out value of transaction from quote outValues (List[str]) out values from transaction quote transaction (Optional[Transaction]): assembled transaction data for quote simulation (Optional[Simulation]): simulation output data if enabled pathVizImage (Optional[str]): path viz image if requested
  - `deprecated` string, nullable
  - `traceId` string, nullable
  - `blockNumber` integer, required
  - `gasEstimate` integer, required
  - `gasEstimateValue` number, required
  - `inputTokens` TokenAmount[], required
    - `tokenAddress` string, required — Token contract address
    - `amount` string, required — Amount of token to swap
  - `outputTokens` TokenAmount[], required
    - `tokenAddress` string, required — Token contract address
    - `amount` string, required — Amount of token to swap
  - `netOutValue` number, required
  - `outValues` string[], required
  - `transaction` Transaction, required — Assembled Transaction Schema Attributes: gas (int): txn gas amount gasPrice (int): txn gas price in gwei value (str): value of the transaction to (str): txn to address from_ (str): txn from address data (str): txn bytecode to execute nonce (int): current user nonce chainId (int): id of the chain transaction was assembled for
    - `gas` integer, required
    - `gasPrice` integer, required
    - `value` string, required
    - `to` string, required
    - `from` string, required
    - `data` string, required
    - `nonce` integer, required
    - `chainId` integer, required
  - `simulation` Simulation, required — Simulation data schema Attributes: is_success (bool): true if no errors were detected during simulation amountsOut (List[int]): list of amounts out from simulation gasEstimate (int): on-chain estimateGas raw response value simulationError (Optional[SimulationError]): simulation error data (if error)
    - `isSuccess` boolean, required
    - `amountsOut` integer[], required
    - `gasEstimate` integer, required
    - `simulationError` SimulationError, required — Simulation error schema Attributes: type (str): error type errorMessage (str): content of the simulation error message
      - `type` string, required
      - `errorMessage` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/odos/apis/odos-api.md) · [All operations](https://skmtc.dev/odos/apis/odos-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/odos/odos-api/revisions/326e35e349c9/schema)
