Overview
The Forest Configuration API provides CRUD operations for forest management reference data:- Species (
/api/forest/config/species) - Spacings (
/api/forest/config/spacings) - Provenances (
/api/forest/config/provenances) - Vegetal Materials (
/api/forest/config/vegetal-materials) - Product Types (
/api/forest/config/product-types) - Management Schemes (
/api/forest/config/management-schemes) - IMA Classes (
/api/forest/config/ima-classes) - Inventory Types (
/api/forest/config/inventory-types) - Land Use Types (
/api/forest/config/land-use-types) - Level 4 Costs (
/api/forest/config/level4-costs)
Configuration entities are organization-scoped. Users can only access and modify data for their assigned organization.
Species Management
GET /api/forest/config/species
List all species with pagination and search.
Authentication: RequiredPermissions:
forest-config:READ (or any forest-config:CREATE/UPDATE/DELETE)
Query Parameters
Page number (1-indexed)
Items per page (max: 100)
Search filter (matches code, scientificName, or commonName)
Sort field:
code, scientificName, commonName, genus, family, taxonomicOrder, isActive, createdAt, updatedAtSort order:
asc or descResponse
Array of species records
total: Total number of recordspage: Current pagelimit: Items per pagetotalPages: Total number of pages
Example: List Species
cURL
Response
POST /api/forest/config/species
Create a new species.
Authentication: RequiredPermissions:
forest-config:CREATE
Request Body
Unique species code (organization-scoped)
Scientific name (binomial nomenclature)
Common name in local language
Taxonomic genus
Taxonomic family
Taxonomic order
Active status
Response
Returns the created species record.Example: Create Species
cURL
PATCH /api/forest/config/species
Update an existing species.
Authentication: RequiredPermissions:
forest-config:UPDATE
Request Body
Species UUID to update
Updated code
Updated scientific name
Updated common name
Updated genus
Updated family
Updated taxonomic order
Active status
Response
Returns the updated species record.DELETE /api/forest/config/species
Delete a species.
Authentication: RequiredPermissions:
forest-config:DELETE
Request Body
Species UUID to delete
Response
Deleted species UUID
Spacings Management
GET /api/forest/config/spacings
List all planting spacings.
Authentication: RequiredPermissions:
forest-config:READ
Query Parameters
Same as species endpoint:page, limit, search, sortBy, sortOrder
Search fields: code, nameSort fields:
code, name, isActive, createdAt, updatedAt
Response
Returns paginated list of spacing records:POST /api/forest/config/spacings
Create a new spacing configuration.
Authentication: RequiredPermissions:
forest-config:CREATE
Request Body
Unique spacing code
Spacing name/label
Optional description
Distance between rows in meters
Distance between trees in meters
Tree density per hectare (calculated or manual)
Active status
PATCH /api/forest/config/spacings
Update a spacing configuration.
Authentication: RequiredPermissions:
forest-config:UPDATE
Request Body
Same fields as POST, withid required.
DELETE /api/forest/config/spacings
Delete a spacing configuration.
Authentication: RequiredPermissions:
forest-config:DELETE
Request Body
Spacing UUID to delete
Import/Export Operations
All configuration entities support bulk import/export operations.Export Configuration Data
Endpoints:GET /api/forest/config/species/export?format=csv|xlsxGET /api/forest/config/spacings/export?format=csv|xlsxGET /api/forest/config/provenances/export?format=csv|xlsx- etc.
Permissions:
forest-config:READ
Query Parameters
Export format:
csv or xlsxResponse
Returns a downloadable file with all active records for the organization.Example: Export Species to Excel
cURL
Import Configuration Data
Endpoints:POST /api/forest/config/species/importPOST /api/forest/config/spacings/importPOST /api/forest/config/provenances/import- etc.
Permissions:
forest-config:CREATE
Request
CSV or Excel file with configuration data. Must include all required fields.
Response
Number of successfully imported records
Number of failed records
Array of error messages for failed records
Example: Import Spacings
cURL
Response
Other Configuration Entities
The following entities follow the same CRUD pattern:Provenances
Endpoint:/api/forest/config/provenancesFields:
code, name, description, country, region, isActive
Vegetal Materials
Endpoint:/api/forest/config/vegetal-materialsFields:
code, name, description, speciesId, provenanceId, isActiveRelations: Requires valid
speciesId and provenanceId
Product Types
Endpoint:/api/forest/config/product-typesFields:
code, name, description, unitOfMeasure, isActive
Management Schemes
Endpoint:/api/forest/config/management-schemesFields:
code, name, description, rotationYears, isActive
IMA Classes
Endpoint:/api/forest/config/ima-classesFields:
code, name, description, minValue, maxValue, isActiveNote: IMA = Incremento Medio Anual (Mean Annual Increment)
Inventory Types
Endpoint:/api/forest/config/inventory-typesFields:
code, name, description, isActive
Land Use Types
Endpoint:/api/forest/config/land-use-typesFields:
code, name, category, surfaceHa, isActiveNote:
surfaceHa is automatically calculated from Level 4 geometries
Level 4 Costs
Endpoint:/api/forest/config/level4-costsFields:
level4Id, costTypeCode, costTypeDescription, amountUsd, currencyCode, costDateNote: Links cost data to specific Level 4 geometries
Validation Rules
Code Uniqueness
- All
codefields must be unique within the organization - Duplicate codes return
409 Conflictwith message:"Ya existe un registro con ese código"
Referential Integrity
- Cannot delete entities with active relationships (e.g., species with vegetal materials)
- Returns
409 Conflictwith descriptive message
Organization Scoping
- All queries are automatically filtered by
organizationIdfrom authenticated user - Super admins can access all organizations’ data
Audit Logging
All create, update, and delete operations are automatically logged to theAuditLog table:
Audit Log Entry
Audit logs are partitioned by month for efficient querying and archival.
Error Responses
| Status Code | Error | Cause |
|---|---|---|
400 | Parámetros inválidos | Invalid query parameters or request body |
400 | Datos inválidos | Schema validation failure (missing required fields, invalid types) |
403 | Forbidden | Insufficient permissions |
404 | Registro no encontrado | Entity ID doesn’t exist |
409 | Ya existe un registro con ese código | Code uniqueness violation |
409 | No se puede eliminar... | Referential integrity violation |
500 | No fue posible... | Unexpected server error |
Permissions Summary
| Action | Required Permission |
|---|---|
| List/Read | forest-config:READ (or any write permission) |
| Create | forest-config:CREATE |
| Update | forest-config:UPDATE |
| Delete | forest-config:DELETE |
| Import | forest-config:CREATE |
| Export | forest-config:READ |
Super admins bypass permission checks and have full access.
Related Endpoints
- Geospatial Import - Uses land use types from configuration
- Forest Patrimony - Links to species, spacings, and other configs