Upload File
Upload an additional data file to an existing dataset entry on Knowledgator.
Endpoint
POST https://api.platform.knowledgator.com/datasets/{dataset_id}/files/upload/
Headers
| Name | Type | Description |
|---|---|---|
KnowledgatorAPI-Key | String | Your API key |
Content-Type | String | multipart/form-data |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dataset_id | String | Yes (path) | Dataset identifier (e.g. 6babd48a-2256-4466-b16b-9fd45ba59688). |
file | Binary File | Yes (form) | JSON data file to append to the dataset. |
Response
{
"id": "6babd48a-2256-4466-b16b-9fd45ba59688",
"status": "valid"
}
Response Fields
id: Dataset identifier (UUID).status: Current validation and processing status (valid,pending, orinvalid).
Error Codes
| Status Code | Description |
|---|---|
200 | OK – File uploaded and validated successfully. |
400 | Bad Request – Invalid file content, malformed JSON, or dataset not found. |
401 | Unauthorized – Invalid or missing API key. |
403 | Forbidden – Permission denied or subscription limit exceeded. |
422 | Unprocessable Entity – Missing file or multipart form error. |
500 | Internal Server Error – Server-side issue. |
Example Usage
SDK Usage
💡 Dedicated SDK Guides: See Python SDK | TypeScript SDK
TypeScript / JavaScript
import { createClient } from '@knowledgator/typescript-sdk';
import { readFile } from 'fs/promises';
const kg = createClient('YOUR_API_KEY');
const fileContent = await readFile('./additional-samples.json');
const result = await kg.datasets.upload('6babd48a-2256-4466-b16b-9fd45ba59688', {
file: new File([fileContent], 'additional-samples.json')
});
console.log(`Upload complete. Status: ${result.status}`);
Python SDK
from knowledgator import Knowledgator
kg = Knowledgator(api_key="YOUR_API_KEY")
with open("additional-samples.json", "rb") as f:
result = kg.datasets.upload("6babd48a-2256-4466-b16b-9fd45ba59688", file=f)
print(f"Upload complete. Status: {result.status}")
Expected SDK Output
Upload complete. Status: valid
Python (Requests)
import requests
url = "https://api.platform.knowledgator.com/datasets/6babd48a-2256-4466-b16b-9fd45ba59688/files/upload/"
headers = {
"KnowledgatorAPI-Key": "YOUR_API_KEY"
}
with open("additional-samples.json", "rb") as f:
files = {"file": ("additional-samples.json", f, "application/json")}
response = requests.post(url, headers=headers, files=files)
print(response.json())
Expected Response (Python Requests)
{
"id": "6babd48a-2256-4466-b16b-9fd45ba59688",
"status": "valid"
}
cURL
curl -X POST "https://api.platform.knowledgator.com/datasets/6babd48a-2256-4466-b16b-9fd45ba59688/files/upload/" \
-H "KnowledgatorAPI-Key: YOUR_API_KEY" \
-F "file=@additional-samples.json;type=application/json"
Expected Response (cURL)
{
"id": "6babd48a-2256-4466-b16b-9fd45ba59688",
"status": "valid"
}
Additional Information
- File Validation: The uploaded file must be formatted as valid JSON and conform to the dataset's task structure.
- Multiple Files: You can append multiple batches of training examples to an existing dataset entry by invoking this endpoint.