## 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.

### Upload a Snapshot Package

#### cURL

```
curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/snapshots/upload \
  --header 'Content-Type: multipart/form-data' \
  --header 'X-API-Key: <api-key>' \
  --form 'projectId=<string>' \
  --form file='@example-file'
```

#### Python

```
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/snapshots/upload"

files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "projectId": "<string>" }
headers = {"X-API-Key": "<api-key>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.text)
```

#### JavaScript

```
const form = new FormData();
form.append('projectId', '<string>');
form.append('file', '<string>');

const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

options.body = form;

fetch('https://api-trial.cognigy.ai/new/v2.0/snapshots/upload', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

#### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/snapshots/upload",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"projectId\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
  CURLOPT_HTTPHEADER => [
    "Content-Type: multipart/form-data",
    "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;
}
?>
```

### Response Codes

- **202**: The snapshot was successfully uploaded and the task to process the snapshot was successfully created.
- **400**: Bad Request
- **401**: Unauthorized
- **402**: Payment Required
- **403**: Forbidden
- **404**: Not Found
- **405**: Method Not Allowed
- **409**: Conflict
- **413**: Payload Too Large
- **500**: Internal Server Error
- **501**: Not Implemented
- **502**: Bad Gateway
- **503**: Service Unavailable
- **504**: Gateway Timeout

### Example Response

#### Successful Response
```json
{
  "_id": "<string>",
  "status": "queued",
  "type": "trainIntents",
  "parameters": {},
  "lastChangedAt": 1594243850,
  "lastCreatedAt": 1594243850,
  "currentStep": 0,
  "totalStep": 100
}
```

#### Error Responses

##### Bad Request
```json
{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

##### Unauthorized
```json
{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 401,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

### Authorizations

**X-API-Key**: Supply the API Key in the HTTP-Header

### Headers

- **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`.

### Body

- **projectId**: String (Required string length: 24, Pattern: `^[a-z0-9]{24}$`)
- **file**: File

### Response

#### 202
- **_id**: String (Required string length: 24, Pattern: `^[a-z0-9]{24}$`)
- **status**: Enum (`queued`, `active`, `done`, `cancelling`, `cancelled`, `error`)
- **type**: String
- **parameters**: Object
- **lastChangedAt**: Number
- **lastCreatedAt**: Number
- **currentStep**: Integer
- **totalStep**: Integer
