# API

At the moment of Authorization, the issuer queries the Yumi API for a credit limit using an HTTP request:

### a. Endpoint: Send a <mark style="color:orange;">POST</mark> request to the permit endpoint.

```markup
POST https://yumi-app-prod.up.railway.app/underwriting/permit
```

### b. Request Body

<details>

<summary><mark style="color:blue;">underwriteData</mark>    <mark style="color:$info;">object</mark>  <mark style="color:red;">required</mark></summary>

&#x20;    underwriteData.<mark style="color:blue;">EVMwalletAddresses</mark>    <mark style="color:$info;">string\[]</mark>  <mark style="color:red;">required</mark> \
&#x20;           <mark style="color:$info;">EVM wallet addresses of the user</mark>\
&#x20;           <mark style="color:$warning;">Example: \[ "0x123...", "0x456..." ]</mark>

&#x20;    underwriteData.<mark style="color:blue;">SOLwalletAddresses</mark>    <mark style="color:$info;">string\[]</mark>  <mark style="color:red;">required</mark> \
&#x20;           <mark style="color:$info;">SOL wallet addresses of the user</mark>\
&#x20;           <mark style="color:$warning;">Example: \[ "abc...", "def..." ]</mark>

&#x20;    underwriteData.<mark style="color:blue;">walletBalance</mark>    <mark style="color:$info;">number</mark>  <mark style="color:red;">required</mark> \
&#x20;           <mark style="color:$info;">Bank account balance of the user</mark>\
&#x20;           <mark style="color:$warning;">Example: 1000</mark>

</details>

<details>

<summary><mark style="color:blue;">permitData</mark>    <mark style="color:$info;">object</mark>  <mark style="color:red;">required</mark></summary>

&#x20;    permitData.<mark style="color:blue;">spender</mark>    <mark style="color:$info;">string</mark>  <mark style="color:red;">required</mark> \
&#x20;           <mark style="color:$info;">Executor of the permit</mark>\
&#x20;           <mark style="color:$warning;">Example: "0x789..."</mark>

&#x20;    permitData.<mark style="color:blue;">value</mark>    <mark style="color:$info;">number</mark>  <mark style="color:red;">required</mark> \
&#x20;           <mark style="color:$info;">USDC amount the user wants to loan</mark>\
&#x20;           <mark style="color:$warning;">Example: 30</mark>

</details>

{% hint style="info" %}
If the credit is approved, the endpoint returns a permit signature for the requested USDC value, enabling the issuer to withdraw funds from the Yumi vault.
{% endhint %}

### c. Response

<details>

<summary><mark style="color:green;"><strong>Success (Credit approved)</strong></mark></summary>

```json
{
    "code": 1,
    "permit": {
        "signature": {
            "v": 1,
            "r": "0x...",
            "s": "0x..."
        },
        "owner": "0x...", // Yumi vault
        "spender": "0x456...",
        "value": "40000000", // 40 USDC in decimals
        "deadline": "1719000000"
    },
    "creditLimit": 250, // USDC
    "msg": "Credit approved",
    "timestamp": 1761166681347
}
```

</details>

<details>

<summary><mark style="color:green;"><strong>Success (Credit denied)</strong></mark></summary>

```json
{
    "code": 2,
    "permit": null,
    "creditLimit": 30, // USDC
    "msg": "Credit denied",
    "timestamp": 1761166681347
}
```

</details>

<details>

<summary><mark style="color:red;">Exception (Parameter Error)</mark></summary>

```json
{
    "code": 3,
    "permit": null,
    "msg": "parameter error: {error}",
    "timestamp": 1691732593484
}
```

</details>

<details>

<summary><mark style="color:red;">Exception (System Error)</mark></summary>

```json
{
    "code": 4,
    "permit": null,
    "msg": "system error",
    "timestamp": 1691732593484
}
```

</details>


---

# 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://docs.yumi.finance/credit/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.
