Complete Dyzo API Documentation - Project Management, Team Collaboration & Time Tracking Platform
Secure access to your APIs
Comprehensive authentication system supporting API Keys, JWT tokens, OTP, and social login.
Simple and permanent authentication for server-to-server integrations
X-API-Key: YOUR_API_KEY1// Using Axios2const axios = require('axios');34const API_KEY = 'your_api_key_here';5const BASE_URL = 'https://api.dyzo.ai';67// Set default header for all requests8axios.defaults.headers.common['X-API-Key'] = API_KEY;910// GET request11const getTasks = async () => {12 try {13 const response = await axios.get(`${BASE_URL}/tasks/`);14 console.log('Tasks:', response.data);15 } catch (error) {16 console.error('Error:', error.response?.data);17 }18};1920// POST request21const createTask = async (taskData) => {22 const response = await axios.post(`${BASE_URL}/create-task/1/`, taskData, {23 headers: { 'X-API-Key': API_KEY }24 });25 return response.data;26};/api-keys/{user_id}/Generate a new API key for programmatic access.
{
"name": "Production Key",
"expires_in_days": 365,
"rate_limit": 1000
}{
"status": 1,
"message": "API key created successfully",
"api_key": {
"id": 5,
"name": "Production Key",
"key": "dyzo_abc123...",
"is_active": true,
"rate_limit": 1000,
"expires_at": "2025-10-29T00:00:00Z"
}
}/api-keys/{user_id}/Get all API keys for a user.
{
"status": 1,
"api_keys": [...]
}/api-keys/{user_id}/Permanently delete an API key.
{
"key_id": 5
}{
"status": 1,
"message": "API key deleted successfully"
}Secure token-based authentication with automatic refresh for web and mobile applications
Authorization: Bearer <access_token>X-Refresh-Token: <refresh_token>1// Axios interceptor for automatic token refresh + retry2axios.interceptors.response.use(3 response => {4 // Check for new tokens in response headers5 const newAccessToken = response.headers['x-new-access-token'];6 const newRefreshToken = response.headers['x-new-refresh-token'];7 8 if (newAccessToken) {9 localStorage.setItem('access_token', newAccessToken);10 console.log('ā
New access token stored');11 }12 13 if (newRefreshToken) {14 localStorage.setItem('refresh_token', newRefreshToken);15 console.log('ā
New refresh token stored');16 }17 18 // Retry original request with new token19 if (newAccessToken) {20 const originalRequest = response.config;21 originalRequest.headers['Authorization'] = `Bearer ${newAccessToken}`;22 23 if (newRefreshToken) {24 originalRequest.headers['X-Refresh-Token'] = newRefreshToken;25 } else {26 const existingRefreshToken = localStorage.getItem('refresh_token');27 if (existingRefreshToken) {28 originalRequest.headers['X-Refresh-Token'] = existingRefreshToken;29 }30 }31 32 console.log('š Retrying original request');33 return axios(originalRequest);34 }35 36 return response;37 }38);3940// Add tokens to every request automatically41axios.interceptors.request.use(42 config => {43 const accessToken = localStorage.getItem('access_token');44 const refreshToken = localStorage.getItem('refresh_token');45 46 if (accessToken) {47 config.headers['Authorization'] = `Bearer ${accessToken}`;48 }49 50 if (refreshToken) {51 config.headers['X-Refresh-Token'] = refreshToken;52 }53 54 return config;55 }56);/login/Authenticate an employee with email and password. Returns JWT access and refresh tokens.
{
"email": "[email protected]",
"password": "securepassword123"
}{
"status": 1,
"message": "Login successful",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"employee": {
"_id": 10,
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"companyId": 1,
"designation": "Software Engineer",
"isActive": true
}
}/api/google-login/Authenticate using Google OAuth token.
{
"token": "google_oauth_token_here",
"email": "[email protected]"
}{
"status": 1,
"access_token": "...",
"employee": {...}
}/otp-login/Login using OTP sent to mobile/email.
{
"phone": "+1234567890",
"otp": "123456"
}{
"status": 1,
"access_token": "..."
}