Zhatva API Documentation

Comprehensive REST API reference for UI/UX developers

Overview

This document provides comprehensive API documentation for the Zhatva accounting/billing system, specifically designed for UI/UX developers to build outstanding user experiences.

Base Information

Authentication

Login

POST /api/v1/auth/login Content-Type: application/json { "email": "[email protected]", "password": "password123" }

Response (200 OK):

{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "user": { "id": "user-uuid", "email": "[email protected]", "name": "John Doe" } }

Logout

POST /api/v1/auth/logout Authorization: Bearer {token}

Response (200 OK):

{ "message": "Successfully logged out" }

Firm Management

Create Firm

POST /api/v1/firms Content-Type: application/json { "name": "Acme Consulting Ltd", "default_currency": "USD" }

Response (201 Created):

{ "id": "firm-uuid", "name": "Acme Consulting Ltd", "default_currency": "USD" }

Other Endpoints

User Management

Create User

POST /api/v1/users Authorization: Bearer {token} Content-Type: application/json { "name": "Jane Developer", "email": "[email protected]", "password": "secure123", "billing_rate": { "amount": "150.00", "currency": "USD" } }

Response (201 Created):

{ "id": "user-uuid", "name": "Jane Developer", "email": "[email protected]", "firm_id": "firm-uuid", "billing_rate": { "amount": "150.00", "currency": "USD" }, "is_active": true }

Other Endpoints

Client Management

Create Client

POST /api/v1/clients Authorization: Bearer {token} Content-Type: application/json { "name": "TechCorp Inc", "default_currency": "USD" }

Response (201 Created):

{ "id": "client-uuid", "name": "TechCorp Inc", "firm_id": "firm-uuid", "default_currency": "USD" }

List Clients

GET /api/v1/clients Authorization: Bearer {token}

Response (200 OK):

[ { "id": "client-uuid-1", "name": "TechCorp Inc", "firm_id": "firm-uuid", "default_currency": "USD" }, { "id": "client-uuid-2", "name": "DesignCo Ltd", "firm_id": "firm-uuid", "default_currency": "EUR" } ]

Other Endpoints

Project Management

Create Project

POST /api/v1/projects Authorization: Bearer {token} Content-Type: application/json { "name": "Website Redesign", "client_id": "client-uuid", "project_type": "TIME_AND_MATERIALS", "currency": "USD" }

Project Types:

Response (201 Created):

{ "id": "project-uuid", "name": "Website Redesign", "client_id": "client-uuid", "currency": "USD", "project_type": "TIME_AND_MATERIALS" }

Activities

Activities represent work subdivisions within a project (e.g., "development", "testing", "project management").

POST /api/v1/activities Authorization: Bearer {token} Content-Type: application/json { "project_id": "project-uuid", "name": "Development", "description": "Software development work", "estimated_hours": "40.0" }

Activity Statuses:

Time Tracking

Create Time Entry

POST /api/v1/time-entries Authorization: Bearer {token} Content-Type: application/json { "user_id": "user-uuid", "project_id": "project-uuid", "hours": "8.0", "description": "Implemented user authentication", "work_date": "2025-01-15" }

Response (201 Created):

{ "id": "timeentry-uuid", "user_id": "user-uuid", "project_id": "project-uuid", "hours": "8.0", "description": "Implemented user authentication", "work_date": "2025-01-15", "status": "DRAFT" }

Time Entry Workflow

Time Entry Statuses:

Expense Management

Create Expense

POST /api/v1/expenses Authorization: Bearer {token} Content-Type: application/json { "user_id": "user-uuid", "project_id": "project-uuid", "amount": "125.50", "currency": "USD", "category": "Travel", "description": "Client meeting travel costs", "expense_date": "2025-01-15" }

Expense Statuses:

Invoice Management

Generate Invoice

POST /api/v1/invoices/generate Content-Type: application/json { "client_id": "client-uuid", "from_date": "2025-01-01", "to_date": "2025-01-31" }

Response (201 Created):

{ "id": "invoice-uuid", "invoice_number": "INV-2025-001", "client_id": "client-uuid", "subtotal": "4500.00", "total": "4950.00", "currency": "USD", "line_items_count": 12, "issue_date": "2025-02-01", "due_date": "2025-02-31", "status": "DRAFT" }

Invoice Statuses

Invoice Operations

Error Handling

All endpoints return consistent error responses:

400 Bad Request

{ "error": "validation_failed", "message": "name cannot be empty" }

401 Unauthorized

{ "error": "unauthorized", "message": "authorization header required" }

404 Not Found

{ "error": "not_found", "message": "resource not found" }

500 Internal Server Error

{ "error": "internal_error", "message": "an unexpected error occurred" }

Additional Resources

Back to Home