1. Register an Account
- cURL
- Python
- JavaScript
Copy
curl -X POST https://t0ken.ai/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securepassword123"
}'
Copy
import requests
response = requests.post(
"https://t0ken.ai/api/auth/register",
json={
"email": "[email protected]",
"password": "securepassword123"
}
)
print(response.json())
# {"id": 1, "email": "[email protected]"}
Copy
const response = await fetch('https://t0ken.ai/api/auth/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: '[email protected]',
password: 'securepassword123'
})
});
const data = await response.json();
console.log(data);
// { id: 1, email: "[email protected]" }
2. Login to Get Token
- cURL
- Python
Copy
curl -X POST https://t0ken.ai/api/auth/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "[email protected]&password=securepassword123"
Copy
response = requests.post(
"https://t0ken.ai/api/auth/login",
data={
"username": "[email protected]",
"password": "securepassword123"
}
)
token = response.json()["access_token"]
3. Get Your API Key
Copy
curl https://t0ken.ai/api/keys \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Copy
{
"success": true,
"data": [
{
"id": 1,
"name": "Default",
"key": "omx_xxxxxxxxxxxxxxxxxxxxxxxx",
"is_active": true
}
]
}
4. Create Your First Memory
- cURL
- Python
Copy
curl -X POST https://t0ken.ai/api/v1/memories \
-H "Content-Type: application/json" \
-H "X-API-Key: omx_your_api_key" \
-d '{
"content": "User prefers dark mode in all applications",
"project_id": "default",
"metadata": {
"source": "user_settings",
"importance": "high"
}
}'
Copy
response = requests.post(
"https://t0ken.ai/api/v1/memories",
headers={"X-API-Key": "omx_your_api_key"},
json={
"content": "User prefers dark mode in all applications",
"project_id": "default",
"metadata": {"source": "user_settings"}
}
)
print(response.json())
# {
# "success": true,
# "task_id": "abc123...",
# "status": "pending"
# }
5. Search Memories
Copy
curl -X POST https://t0ken.ai/api/v1/memories/search \
-H "Content-Type: application/json" \
-H "X-API-Key: omx_your_api_key" \
-d '{
"query": "user preferences",
"limit": 10
}'
