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

# Unwrap from Earn Vault

> Creates list of contract calls to unwrap a position from an earn vault,
converting vault shares back to the underlying asset.

> [!NOTE]
>
> The `chain` parameter uses **CAIP-2 format**: `eip155:<chainId>`. For example, `eip155:8453` for Base. See [Supported Chains](https://docs.sprinter.tech/sprinter-credit/overview.md#supported-chains) for the full list.

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.sprinter.tech/credit/earn/unwrap?owner=0xUSER&receiver=0xRECEIVER&amount=1000000&asset=0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61&chain=eip155:8453'
```

```python Python theme={null}
import requests

response = requests.get(
    "https://api.sprinter.tech/credit/earn/unwrap",
    params={
        "owner": "0xUSER",
        "receiver": "0xRECEIVER",
        "amount": "1000000",
        "asset": "0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61",
        "chain": "eip155:8453"
    }
)
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://api.sprinter.tech/credit/earn/unwrap?owner=0xUSER&receiver=0xRECEIVER&amount=1000000&asset=0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61&chain=eip155:8453"
);
const data = await response.json();
console.log(data);
```

```go Go theme={null}
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	resp, _ := http.Get("https://api.sprinter.tech/credit/earn/unwrap?owner=0xUSER&receiver=0xRECEIVER&amount=1000000&asset=0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61&chain=eip155:8453")
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
```

```json 200 theme={null}
{
  "amountOut": "1000000",
  "calls": [
    {
      "chain": "8453",
      "to": "0x1234567890abcdef1234567890abcdef12345678",
      "data": "0xa9059cbb000000000000000000000000000000000000000000000000000000000005f5e100",
      "value": "0"
    }
  ],
  "minAmountOut": "997000",
  "tokenOut": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
```

> [!TIP]
>
> **Machine-readable API spec:** [OpenAPI JSON](https://api.sprinter.tech/swagger/doc.json) | [Swagger UI](https://api.sprinter.tech/swagger/index.html)


## OpenAPI

````yaml get /credit/earn/unwrap
openapi: 3.0.0
info:
  contact: {}
  title: ''
  version: 0.0.1
servers:
  - url: https://api.sprinter.tech
    description: Production server
security: []
paths:
  /credit/earn/unwrap:
    get:
      tags:
        - Credit
      summary: Unwrap position from earn vault
      description: |-
        Creates list of contract calls to unwrap a position from an earn vault,
        converting vault shares back to the underlying asset.
      parameters:
        - example: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
          description: Owner address that holds the vault shares
          name: owner
          in: query
          required: true
          schema:
            type: string
        - example: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
          description: Address that will receive the unwrapped underlying tokens
          name: receiver
          in: query
          required: true
          schema:
            type: string
        - example: '1000000000000000000'
          description: Amount of shares to unwrap
          name: amount
          in: query
          required: true
          schema:
            type: string
        - example: '0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61'
          description: Vault shares token address
          name: asset
          in: query
          required: true
          schema:
            type: string
        - description: Slippage tolerance in percent (e.g. 0.5 = 0.5%)
          name: slippage
          in: query
          schema:
            type: number
            default: 0.3
        - example: eip155:8453
          description: Chain ID in CAIP format
          name: chain
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/credit.UnwrapResponse'
        '400':
          description: Invalid input parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/responses.ErrorResponse'
components:
  schemas:
    credit.UnwrapResponse:
      type: object
      required:
        - amountOut
        - calls
        - minAmountOut
        - tokenOut
      properties:
        amountOut:
          description: Estimated amount of tokens to receive
          type: string
          example: '1000000'
        calls:
          description: List of contract calls to execute the unwrap
          type: array
          items:
            $ref: '#/components/schemas/evm.ContractCall'
        minAmountOut:
          description: Minimum amount of tokens to receive (after slippage)
          type: string
          example: '997000'
        tokenOut:
          description: Token address that will be received after unwrapping
          type: string
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
    responses.ErrorResponse:
      type: object
      required:
        - error
      properties:
        debug:
          type: string
        error:
          type: string
    evm.ContractCall:
      type: object
      required:
        - chain
        - data
        - to
        - value
      properties:
        chain:
          type: string
        data:
          type: array
          items:
            type: integer
        to:
          type: array
          items:
            type: integer
        value:
          $ref: '#/components/schemas/types.BigInt'
    types.BigInt:
      type: object

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.