Upload a Package - Cognigy Documentation
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Upload a Package
Endpoint:POST /v2.0/packages/upload
Example cURL Command:
curl --request POST \
--url https://api-trial.cognigy.ai/new/v2.0/packages/upload \
--header 'Content-Type: multipart/form-data' \
--header 'X-API-Key: <api-key>' \
--form 'projectId=<string>' \
--form file='@example-file'
Example in Python:
import requests
url = "https://api-trial.cognigy.ai/new/v2.0/packages/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)
Example in JavaScript (Fetch API):
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/packages/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
Response:
- 202: Package successfully uploaded and Task to process the Package successfully created.
Expected JSON Response Format:
{
"_id": "<string>",
"status": "queued",
"type": "trainIntents",
"parameters": {},
"lastChangedAt": 1594243850,
"lastCreatedAt": 1594243850,
"currentStep": 0,
"totalStep": 100
}
Error Responses
- 400: Bad Request
- 401: Unauthorized
- 402: Payment Required
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
Authorization:
X-API-Keyin header (required)
Required Body Parameters
projectId: String, Required, must be 24 characters long and match the pattern^[a-z0-9]{24}$.file: File, Required.