## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.cognigy.com/llms.txt)

Use this file to discover all available pages before exploring further.

### Stop a Function Instance

**POST** /v2.0/functions/{functionId}/instances/{functionInstanceId}/stop

#### Example cURL Command
```bash
curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop \
  --header 'X-API-Key: <api-key>'
```

#### Example Python Code
```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop"

headers = {"X-API-Key": "<api-key>"}

response = requests.post(url, headers=headers)

print(response.text)
```

#### Example JavaScript Code
```javascript
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

#### Example PHP Code
```php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "X-API-Key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

#### Example Go Code
```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

url := "https://api-trial.cognigy.ai/new/v2.0/functions/{functionId}/instances/{functionInstanceId}/stop"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}
```

### API Response Status Codes

| Status Code | Error Type             | Description                                      |
|-------------|------------------------|--------------------------------------------------|
| 400         | Bad Request            | Validation failed. Missing payload.               |
| 401         | Unauthorized           | <string>                                       |
| 402         | Payment Required       | Validation failed. Missing payload.               |
| 403         | Forbidden              | <string>                                       |
| 404         | Not Found              | <string>                                       |
| 405         | Method Not Allowed     | <string>                                       |
| 409         | Conflict               | <string>                                       |
| 413         | Payload Too Large      | <string>                                       |
| 500         | Internal Server Error  | <string>                                       |
| 501         | Not Implemented        | <string>                                       |
| 502         | Bad Gateway            | <string>                                       |
| 503         | Service Unavailable    | <string>                                       |
| 504         | Gateway Timeout        | <string>                                       |

### Authorization

**X-API-Key**  
*Type:* string  
*Location:* header  
*Required:* Supply the API Key in the HTTP-Header

### Request Headers

| Header    | Description                                                    |
|-----------|---------------------------------------------------------------|
| Accept    | The `Accept` header specifies the media type that the client expects in the response. Available options: `application/json`, `application/hal+json`, `application/xml`, `text/xml`, `text/csv`. The default value is `application/json`.

### Path Parameters

| Parameter              | Type    | Required | Description                                              |
|-----------------------|---------|----------|----------------------------------------------------------|
| functionId            | string  | true     | The Id of the Function                                   |
| functionInstanceId    | string  | true     | The Id of the Function Instance                           |

### Response

**202**: The stop operation was accepted.
