# API Integration Flow

{% hint style="info" %}
Please see the [Swagger documentation](https://api.test.legion.cc/integration) for the API reference, output, and more context for each endpoint. &#x20;

Please note: you must request a username and password from the Legion team.
{% endhint %}

<figure><img src="/files/pZQ8MKZaAl1xzJmvg8u6" alt=""><figcaption><p>Integration flow</p></figcaption></figure>

## Authentication Flow for [Pre-Liquid Open Application Sale](/legion/smart-contracts/pre-liquid-open-application-sale.md)

#### 1. Create User

* **Endpoint:** `POST /v1/integration/user`
* **Description:** Creates a new user account in the system

#### 2. Generate Authentication Token

* **Endpoint:** `POST /v1/integration/token`
* **Description:** Generates a JWT token for authentication

## Investment Round Flow

#### 3. List Active Rounds

* **Endpoint:** `GET /v1/integration/rounds`
* **Description:** Retrieves all currently active investment rounds

#### 4. Get Round Details

* **Endpoint:** `GET /v1/integration/rounds/{id}`
* **Description:** Retrieves comprehensive details for a specific investment round

#### 5. Submit Round Application

* **Endpoint:** `POST /v1/integration/rounds/{id}/submit`
* **Description:** A user applies to participate in the selected investment round

## Fund Management Flow

#### 6. Generate Deposit Signature

* **Endpoint:** `GET /v1/integration/rounds/{id}/signature`
* **Description:** Generates a cryptographic signature required for depositing funds

#### 7. Contract Interaction for USDC Deposit

This step involves direct interaction with the smart contract:

1. **Approve USDC Transfer**
   * Authorize the contract to transfer USDC from the user's wallet
2. **Execute Deposit**
   * Use the signature from Step 6 to deposit USDC into the contract
   * A webhook notification will be triggered upon a successful deposit

#### 8. Application Review Process

The project team will review the submitted application and determine one of three outcomes:

* Full Approval
  * The full deposited amount is accepted
* Partial Approval
  * Only a % of the deposited amount is accepted
* Rejection
  * None of the deposited allocation is accepted

#### 9. Track Application Status

* **Endpoint:** `GET /v1/integration/rounds/{id}/application`
* **Description:** Retrieves the current status of a user's round application
* **Path Parameter:** `id` - The unique identifier of the round

## Post-Application Actions

Based on the application status, different actions are required:

#### Rejected Applications

* **Action Required:** Claim USDC refund through contract interaction
* **When:** Immediately after rejection notification

#### Approved Applications

1. **Refund Period:** MiCA states that there must be a 14-day refund period for all available EU citizens
2. **Immediate Action Required:** No action

#### Partially Approved Applications

1. **Refund Period:** MiCA states that there must be a 14-day refund period for all available EU citizens
2. **Immediate Action:** Claim excess USDC refund through contract interaction
3. **Action Required:** Claim tokens through contract interaction
4. **When:** After the vesting period begins


---

# 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://legion-1.gitbook.io/legion/backend/api-integration-flow.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.
