Skip to main content

Introduction

The Inventario API is a RESTful web service built with Django that provides inventory management capabilities including products, sales, purchases, clients, and suppliers management.

Base URL

All API requests should be made to your Inventario installation’s base URL:
For local development:

API Architecture

The Inventario API follows Django’s URL routing structure with the following main endpoints:
  • /productos/ - Product management
  • /ventas/ - Sales and transactions
  • /compras/ - Purchase orders
  • /clientes/ - Client management
  • /proveedores/ - Supplier management
  • /usuarios/ - User management
  • /reportes/ - Reports and analytics
  • /configuracion/ - System configuration

Request Format

The API accepts both form-encoded data and JSON payloads depending on the endpoint:

Form-Encoded (Standard Django Views)

JSON (AJAX/API Endpoints)

Response Format

HTML Responses

Standard Django views return rendered HTML templates with server-side rendering.

JSON Responses

API endpoints (typically under /api/ paths) return JSON responses:

Error Response

HTTP Status Codes

The API uses standard HTTP status codes:
OK
Request successful
Created
Resource created successfully
Found
Redirect (common in Django form submissions)
Bad Request
Invalid request parameters or validation error
Unauthorized
Authentication required
Forbidden
Insufficient permissions (e.g., vendedor accessing admin-only endpoint)
Not Found
Resource not found
Internal Server Error
Server error

Common Error Codes

Pagination

List endpoints support pagination with query parameters:
integer
default:"1"
Page number to retrieve
Example:
Pagination response includes:
  • has_next - Boolean indicating more pages
  • has_previous - Boolean indicating previous pages
  • number - Current page number
  • num_pages - Total number of pages

Filtering and Sorting

Many list endpoints support filtering and sorting:

Filtering

Sorting

Date/Time Format

All timestamps use ISO 8601 format in America/Bogota timezone:

Decimal Fields

Monetary values use Decimal type with 2 decimal places:

User Roles and Permissions

Inventario implements role-based access control:

Admin Role

  • Full CRUD operations on all resources
  • Can create/manage vendedor users
  • Access to all reports and analytics

Vendedor Role

  • Read-only access to products
  • Can create and view sales
  • Limited access to reports
  • Cannot modify products, purchases, or system settings
See Authentication for details on role enforcement.