# Загрузка чека

{% hint style="info" %}

## После  загрузки чека, заявка автоматически переходит в статус диспута (Спор) <a href="#metod-zaprosa" id="metod-zaprosa"></a>

{% endhint %}

## Метод запроса <a href="#metod-zaprosa" id="metod-zaprosa"></a>

POST

## Урл запроса <a href="#url-zaprosa" id="url-zaprosa"></a>

/api/v2/transactions/{id}/cheque<br>

## Параметры запроса <a href="#parametry-zaprosa" id="parametry-zaprosa"></a>

#### **Путь (Path) параметры:**

<table><thead><tr><th width="116">Название</th><th width="80" data-type="checkbox">Обяз.</th><th width="201">Формат</th><th>Описание</th></tr></thead><tbody><tr><td>id</td><td>true</td><td>string(1-200)</td><td>Идентификатор транзакции</td></tr></tbody></table>

#### **Тело запроса (Form Data):**

Запрос должен быть выполнен с использованием `multipart/form-data`.

<table><thead><tr><th width="116">Название</th><th width="80" data-type="checkbox">Обяз.</th><th width="201">Формат</th><th>Описание</th></tr></thead><tbody><tr><td>file</td><td>true</td><td>файл (image/png, image/jpeg, pdf)</td><td>Чек (изображение или PDF)</td></tr></tbody></table>

### Заголовки

* **Authorization:** Bearer *{API\_TOKEN}*
* **Content-Type:** multipart/form-data&#x20;

## Пример запроса

{% tabs %}
{% tab title="Curl" %}

```sh
curl --location 'https://{{your_api_domain}}/api/v2/transactions/{id}/cheque'
--header 'Authorization: Bearer {API_TOKEN}'
--form 'file=@"path/to/your/file.png"'
```

{% endtab %}

{% tab title="PHP + Guzzle" %}

```php
<?php

require 'vendor/autoload.php';

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;

$client = new Client([
    'base_uri' => 'https://{{your_api_domain}}',
]);

$transactionId = '{id}'; // Укажите идентификатор транзакции
$apiToken = '{API_TOKEN}'; // Ваш Bearer токен
$filePath = '{/path/to/your/file.png}'; // Путь к файлу для загрузки

try {
    $response = $client->request('POST', "/api/v2/transactions/{$transactionId}/cheque", [
        'headers' => [
            'Authorization' => "Bearer $apiToken",
        ],
        'multipart' => [
            [
                'name'     => 'file',
                'contents' => fopen($filePath, 'r'),
                'filename' => basename($filePath),
            ],
        ],
    ]);

    $body = $response->getBody();
    $result = json_decode($body, true);
    print_r($result);

} catch (RequestException $e) {
    echo $e->getMessage();
    if ($e->hasResponse()) {
        echo $e->getResponse()->getBody();
    }
}
```

{% endtab %}
{% endtabs %}

**Здесь:**

* `{id}` — идентификатор транзакции
* `{API_TOKEN}` — ваш авторизационный токен
* `{path/to/your/file.png}` — путь к файлу, который вы хотите загрузить

## Пример успешного ответа

**Код ответа:** `201 Created`

```json
{
    "message": "File uploaded successfully"
}
```


---

# 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://fkassa.gitbook.io/firekassa-api-v2/transactions/zagruzka-cheka.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.
