> ## 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.

# Lock Collateral

> Creates list of contract calls to lock assets as collateral for credit account. Supports both underlying assets (e.g., USDC) which are wrapped into earn vault first, and earn positions (e.g., gtUSDCp) which are deposited directly.

<Info>
  The `asset` parameter is the credit asset symbol — currently supported values are `usdc` and `eure`. The `earnAsset` query parameter is the collateral asset address (underlying token like USDC, or an earn position like gtUSDCp).
</Info>

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url 'https://api.sprinter.tech/credit/v2/accounts/0xUSER/assets/usdc/lock?amount=1000000&earnAsset=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
  ```

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

  response = requests.get(
      "https://api.sprinter.tech/credit/v2/accounts/0xUSER/assets/usdc/lock",
      params={"amount": "1000000", "earnAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"}
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api.sprinter.tech/credit/v2/accounts/0xUSER/assets/usdc/lock?amount=1000000&earnAsset=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
  );
  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/v2/accounts/0xUSER/assets/usdc/lock?amount=1000000&earnAsset=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913")
  	defer resp.Body.Close()
  	body, _ := io.ReadAll(resp.Body)
  	fmt.Println(string(body))
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "calls": [
      {
        "chain": "8453",
        "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "data": "0x095ea7b3000000000000000000000000abcdef1234567890abcdef1234567890abcdef12",
        "value": "0"
      },
      {
        "chain": "8453",
        "to": "0x1234567890abcdef1234567890abcdef12345678",
        "data": "0x2e1a7d4d000000000000000000000000000000000000000000000000000000000005f5e100",
        "value": "0"
      }
    ]
  }
  ```
</ResponseExample>

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


## OpenAPI

````yaml get /credit/v2/accounts/{account}/assets/{asset}/lock
openapi: 3.0.0
info:
  contact: {}
  title: ''
  version: 0.0.1
servers:
  - url: https://api.sprinter.tech
    description: Production server
security: []
paths:
  /credit/v2/accounts/{account}/assets/{asset}/lock:
    get:
      tags:
        - Credit
      summary: Calldata to lock asset as collateral
      description: >-
        Creates list of contract calls to lock assets as collateral for credit
        account. Supports both underlying assets (e.g., USDC) which are wrapped
        into earn vault first, and earn positions (e.g., gtUSDCp) which are
        deposited directly.
      parameters:
        - description: Account that holds the asset and will execute calls
          name: account
          in: path
          required: true
          schema:
            type: string
        - example: usdc
          description: Credit asset symbol (e.g. usdc, eure)
          name: asset
          in: path
          required: true
          schema:
            type: string
        - description: Amount in lowest denomination (e.g., wei for ETH)
          name: amount
          in: query
          required: true
          schema:
            type: string
        - description: >-
            Asset address in eth format - either underlying asset (USDC) or earn
            position (gtUSDCp)
          name: earnAsset
          in: query
          required: true
          schema:
            type: string
        - description: >-
            Earn strategy to wrap asset before depositing. If omitted, asset is
            deposited directly without wrapping.
          name: earn
          in: query
          schema:
            type: string
      responses:
        '200':
          description: List of contract calls to execute locking of collateral
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/credit.Lock.response'
        '400':
          description: Bad request due to invalid input or missing 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.Lock.response:
      type: object
      required:
        - calls
      properties:
        calls:
          type: array
          items:
            $ref: '#/components/schemas/evm.ContractCall'
    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

````