> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/SiveriusAlter/CurrencyExchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Currencies

> Manage currency definitions and retrieve currency information

## Get All Currencies

<CodeGroup>
  ```bash GET /api/Currency theme={null}
  curl http://localhost:8080/api/Currency
  ```
</CodeGroup>

Retrieves a list of all currencies in the system.

### Response

<ResponseField name="currencies" type="array">
  Array of currency objects

  <ResponseField name="id" type="integer">
    Unique identifier for the currency
  </ResponseField>

  <ResponseField name="code" type="string">
    Three-letter currency code (ISO 4217 format)
  </ResponseField>

  <ResponseField name="fullName" type="string">
    Full name of the currency
  </ResponseField>

  <ResponseField name="sign" type="string">
    Currency symbol
  </ResponseField>
</ResponseField>

### Example Response

```json theme={null}
[
  {
    "id": 1,
    "code": "USD",
    "fullName": "United States Dollar",
    "sign": "$"
  },
  {
    "id": 2,
    "code": "EUR",
    "fullName": "Euro",
    "sign": "€"
  },
  {
    "id": 3,
    "code": "GBP",
    "fullName": "British Pound Sterling",
    "sign": "£"
  }
]
```

***

## Find Currencies

<CodeGroup>
  ```bash GET /api/Currency/{searchString} theme={null}
  curl http://localhost:8080/api/Currency/USD
  ```
</CodeGroup>

Searches for currencies matching the provided search string. The search matches against currency codes and names.

### Path Parameters

<ParamField path="searchString" type="string" required>
  Search term to find currencies (1-24 characters, letters, spaces, and parentheses only)
</ParamField>

### Validation Rules

* Length: 1-24 characters
* Allowed characters: A-Z, a-z, spaces, parentheses
* Pattern: `[^A-Za-z() ]` (special characters not allowed)

### Response

<ResponseField name="currencies" type="array">
  Array of matching currency objects

  <ResponseField name="id" type="integer">
    Unique identifier for the currency
  </ResponseField>

  <ResponseField name="code" type="string">
    Three-letter currency code
  </ResponseField>

  <ResponseField name="fullName" type="string">
    Full name of the currency
  </ResponseField>

  <ResponseField name="sign" type="string">
    Currency symbol
  </ResponseField>
</ResponseField>

### Example Response

```json theme={null}
[
  {
    "id": 1,
    "code": "USD",
    "fullName": "United States Dollar",
    "sign": "$"
  }
]
```

### Error Response

```json theme={null}
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректные символы в строке"]
  }
}
```

***

## Create Currency

<CodeGroup>
  ```bash POST /api/Currency theme={null}
  curl -X POST http://localhost:8080/api/Currency \
    -H "Content-Type: application/json" \
    -d '{
      "id": 0,
      "code": "JPY",
      "fullName": "Japanese Yen",
      "sign": "¥"
    }'
  ```
</CodeGroup>

Creates a new currency in the system.

### Request Body

<ParamField body="id" type="integer" required>
  Currency ID (typically 0 for new currencies, auto-generated by database)
</ParamField>

<ParamField body="code" type="string" required>
  Three to five letter currency code (uppercase letters only)

  **Validation:**

  * Length: 3-5 characters
  * Pattern: A-Z only
  * Automatically converted to uppercase
</ParamField>

<ParamField body="fullName" type="string" required>
  Full name of the currency

  **Validation:**

  * Length: 3-60 characters
  * Allowed: A-Z, a-z, А-Я, а-я, spaces, parentheses
</ParamField>

<ParamField body="sign" type="string" required>
  Currency symbol

  **Validation:**

  * Length: 1-3 characters
  * No whitespace or newlines allowed
</ParamField>

### Example Request

```json theme={null}
{
  "id": 0,
  "code": "JPY",
  "fullName": "Japanese Yen",
  "sign": "¥"
}
```

### Response

<ResponseField name="currency" type="object">
  The created currency object

  <ResponseField name="id" type="integer">
    Generated unique identifier
  </ResponseField>

  <ResponseField name="code" type="string">
    Currency code (uppercase)
  </ResponseField>

  <ResponseField name="fullName" type="string">
    Full name of the currency
  </ResponseField>

  <ResponseField name="sign" type="string">
    Currency symbol
  </ResponseField>
</ResponseField>

### Example Response

```json theme={null}
{
  "id": 4,
  "code": "JPY",
  "fullName": "Japanese Yen",
  "sign": "¥"
}
```

### Error Responses

**Empty or null field:**

```json theme={null}
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не заполнен один или несколько параметров"]
  }
}
```

**Invalid length:**

```json theme={null}
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректное количество символов указано для поля USD валюты. Длина строки может быть от 3-х до 5 символов."]
  }
}
```

**Invalid characters:**

```json theme={null}
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "message": ["Не корректные символы в строке USD123."]
  }
}
```
