Direct REST API integration for any programming language or tool.
curl -X POST # No installation required
1# Create a session
2curl -X POST "https://api.cognitora.dev/v1/sessions" \
3 -H "Authorization: Bearer YOUR_API_KEY" \
4 -H "Content-Type: application/json" \
5 -d '{
6 "image": "docker.io/library/python:3.11-slim",
7 "timeout": 300,
8 "persistent": true
9 }'
10
11# Execute code in the session
12curl -X POST "https://api.cognitora.dev/v1/compute/execute" \
13 -H "Authorization: Bearer YOUR_API_KEY" \
14 -H "Content-Type: application/json" \
15 -d '{
16 "session_id": "SESSION_ID_FROM_ABOVE",
17 "command": ["python", "-c", "print(\"Hello from Cognitora!\")"]
18 }'
19
20# Upload a file
21curl -X POST "https://api.cognitora.dev/v1/filesystem/write" \
22 -H "Authorization: Bearer YOUR_API_KEY" \
23 -H "Content-Type: application/json" \
24 -d '{
25 "session_id": "SESSION_ID",
26 "path": "/tmp/data.py",
27 "content": "import pandas as pd\ndf = pd.DataFrame({\"x\": [1,2,3], \"y\": [4,5,6]})\nprint(df)"
28 }'
29
30# Execute the uploaded file
31curl -X POST "https://api.cognitora.dev/v1/compute/execute" \
32 -H "Authorization: Bearer YOUR_API_KEY" \
33 -H "Content-Type: application/json" \
34 -d '{
35 "session_id": "SESSION_ID",
36 "command": ["python", "/tmp/data.py"]
37 }'
38
39# Download results
40curl -X POST "https://api.cognitora.dev/v1/filesystem/read" \
41 -H "Authorization: Bearer YOUR_API_KEY" \
42 -H "Content-Type: application/json" \
43 -d '{
44 "session_id": "SESSION_ID",
45 "path": "/tmp/output.csv"
46 }'
Get started with cURL / REST API and Cognitora in minutes. Secure, scalable, and ready for anything.