# /result

{% hint style="info" %}
Чтобы отправлять авторизованные запросы нужно получить API ключ, как это сделать написано в разделе [**С чего начать?**](https://docs.gptunnel.ru/)
{% endhint %}

## Получить результат выполнения

<mark style="color:blue;">`GET`</mark> `https://gptunnel.ru/v1/faceswap/result`

Запрос возвращает состояния задачи и результат выполнения

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | API ключ    |

#### Request Body

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| taskId<mark style="color:red;">\*</mark> | string | ID задачи   |

{% tabs %}
{% tab title="200: OK Успешный ответ" %}
{% code fullWidth="false" %}

```
{
	"id": "65819c485337280001a609e7",
	"parentId": null,
	"object": "task",
	"type": "@FaceSwap",
	"percent": 100,
	"status": "done",
	"result": "https://storage.yandexcloud.net/timenote/predication/65819c485337280001a609e7_faceswap_result.png",
	"error": null,
	"usage": {
		"prompt_tokens": 0,
		"completion_tokens": 0,
		"total_tokens": 0,
		"prompt_cost": 0,
		"completion_cost": 0,
		"total_cost": 0
	}
}
```

{% endcode %}
{% endtab %}

{% tab title="400: Bad Request Неверный запрос" %}

```json
{
  "error": {
    "message": "'taskId' is a required property",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
```

{% endtab %}

{% tab title="402: Payment Required Недостаточно средств" %}

```json
{
  "error": {
    "message": "Organization balance is too low to use API",
    "type": "insufficient_balance_error",
    "param": null,
    "code": null
  }
}
```

{% endtab %}

{% tab title="401: Unauthorized Ошибка авторизации" %}

```json
{
  "error": {
    "message": "Unauthorized",
    "type": "unauthorized_request_error",
    "param": null,
    "code": null,
  }
}
```

{% endtab %}
{% endtabs %}

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

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

```typescript
import axios from 'axios'

const request = axios({
  method: 'GET',
  url: 'https://gptunnel.ru/v1/faceswap/result?taskId=65819c485337280001a609e7',
  headers: {
    // use your API key here
    Authorization: 'YOUR_API_KEY',
  },
})

request.then((result) => {
  console.log(result)
}).catch((error) => {
  console.error(error)
})
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl --request GET \
  --url https://gptunnel.ru/v1/faceswap/result?taskId=65819c485337280001a609e7 \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
```

{% endtab %}
{% endtabs %}

### Пример ответа

```json
{
	"id": "65819c485337280001a609e7",
	"parentId": null,
	"object": "task",
	"type": "@FaceSwap",
	"percent": 100,
	"status": "done",
	"result": "https://storage.yandexcloud.net/timenote/predication/65819c485337280001a609e7_faceswap_result.png",
	"error": null,
	"usage": {
		"prompt_tokens": 0,
		"completion_tokens": 0,
		"total_tokens": 0,
		"prompt_cost": 0,
		"completion_cost": 0,
		"total_cost": 0
	}
}
```

{% hint style="warning" %}
URL результата может быть удален спустя 3 дня с момента генерации, обязательно сохраняйте результат после получения.
{% endhint %}

А вот так выглядит результат работы нашей нейронной сети:

<figure><img src="/files/szWQYJZRdLZZ92c1Wwlt" alt=""><figcaption><p>Result</p></figcaption></figure>

Вот еще 1 пример, где наглядно видно совместную работу Midjourney и FaceSwap:

<figure><img src="/files/Mcye43LZCLtM0vZ5lnfQ" alt=""><figcaption></figcaption></figure>


---

# 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.gptunnel.ru/faceswap/result.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.
