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:

Expected JSON Response Format:

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

Error Responses

Authorization:

Required Body Parameters