# Быстрый старт

## API-ключи

Доступны два типа ключей:

| Тип ключа | Запросов/мин | Комиссия                   |
| --------- | ------------ | -------------------------- |
| Free      | 20           | 0%                         |
| Standard  | 60           | Из параметра `feeShareBps` |

Передавайте ключ в заголовке `api-key` при каждом запросе.

> API доступен и без ключа (20 запросов/мин), но для повышенных лимитов и заработка комиссий ключ обязателен.

**Тестовые ключи:**

* Free: `test-sdk-test-sdk-test-sdk-free`
* Standard: `test-sdk-test-sdk-test-sdk-standard`

**Production ключи:** [@Eywa\_BDLead](https://t.me/Eywa_BDLead) / <a.gluhovskij@eywa.fi>

***

## Пример: USDC из Arbitrum в Ethereum

### 1. Получите маршрут

```bash
curl -X POST "https://api.crosscurve.fi/routing/scan" \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_KEY" \
  -d '{
    "params": {
      "chainIdIn": 42161,
      "chainIdOut": 1,
      "tokenIn": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
      "tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "amountIn": "1000000000"
    },
    "slippage": 1
  }'
```

Ответ содержит массив маршрутов с информацией о комиссиях, ожидаемой сумме и времени выполнения. Используйте первый маршрут `routes[0]`.

### 2. Создайте транзакцию

```bash
curl -X POST "https://api.crosscurve.fi/tx/create" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "0xYourWallet",
    "recipient": "0xYourWallet",
    "routing": <объект маршрута из шага 1>,
    "buildCalldata": true
  }'
```

Ответ `{ to, value, data }` готов для отправки через любую Web3 библиотеку.

### 3. Отправьте транзакцию

```javascript
// Approve токена на контракт
await tokenContract.approve(txData.to, amount);

// Отправьте транзакцию
const tx = await signer.sendTransaction(txData);
```

### 4. Отследите статус

```bash
# Найдите requestId по хешу транзакции
curl "https://api.crosscurve.fi/search?search=0xYourTxHash"

# Проверьте статус (polling каждые 5 сек)
curl "https://api.crosscurve.fi/transaction/{requestId}"
```

Статус `completed` означает успешное завершение.

***

## Справочные эндпоинты

| Эндпоинт                          | Что возвращает                                   |
| --------------------------------- | ------------------------------------------------ |
| `GET /networks`                   | Список поддерживаемых сетей с chainId            |
| `GET /tokenlist`                  | Токены по сетям (для свопа нужен тег `can_swap`) |
| `GET /prices/{address}/{chainId}` | Цена токена в USD                                |

***

## Следующие шаги

* [Полная документация API](broken://pages/39194a6ae74fd8b89d87896b8b9d647dacf841f9) — все эндпоинты и параметры
* [TypeScript SDK](https://www.npmjs.com/package/@crosscurve/sdk) — Viem, Ethers, Web3
* [Swagger UI](https://api.crosscurve.fi/api-docs/) — интерактивное тестирование
* [Партнёрская программа](/partnyoram.md) — условия fee sharing

***

**Вопросы?** Напишите нам: [@Eywa\_BDLead](https://t.me/Eywa_BDLead)


---

# 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.crosscurve.fi/bystryi-start.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.
