AgroIA provides three ingestion endpoints to cover different workflows: an asynchronous endpoint for production use, a synchronous endpoint that blocks until the record is written (useful for testing), and a bulk endpoint that accepts a GeoJSON file and processes all features in the background. All three endpoints require Bearer token authentication.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sdarionicolas-boop/AgroIA-RAG/llms.txt
Use this file to discover all available pages before exploring further.
All three endpoints validate the
Authorization header against INGESTA_SECRET_KEY. See API overview and authentication for details.POST /ingesta
Ingests a single agronomic lot asynchronously. The record is written toinformes_lotes and lote_historial in a background task, so the endpoint returns 202 Accepted immediately without waiting for the database write to complete.
Request body
Unique identifier for the lot. Must be between 1 and 100 characters.
Report date in ISO 8601 format. Any format other than
YYYY-MM-DD is rejected with a validation error.Average NDVI value for the lot. Must be between
0.0 and 1.0 inclusive. Optional.Accumulated growing degree days from NASA POWER climate data. Must be
0.0 or greater. Optional.Free-text agronomic report content. This field is embedded with
nomic-embed-text via Ollama and stored as a 768-dimension vector for RAG retrieval. Optional.Arbitrary JSONB metadata for the lot. Stores fields such as
score_total, cv_espacial, cultivo, superficie_ha, zonificacion_activa, and puntos_zona_c when present. Optional.Array of historical year objects for the lot. Each item is written as a row in
lote_historial. Use ASCII key names — anio not año. Optional.Response
Always
"accepted" for this endpoint. The background task may still be processing.Echo of the submitted
lote_id.Echo of the submitted
fecha.Examples
POST /ingesta/debug
Synchronous version of/ingesta. The request blocks until the record is fully written to informes_lotes and lote_historial, then returns the database-assigned ID. Use this endpoint for integration testing and pipeline verification — not for production load.
Request body
Same schema asPOST /ingesta. All fields from the InformeAgricola model apply.
Response
Always
"ok" on success.The database ID of the record in
informes_lotes returned by the RETURNING id clause of the upsert.Echo of the submitted
lote_id.Examples
POST /ingesta/geojson
Accepts a multipart file upload containing a GeoJSON FeatureCollection and processes all features as individual lots in a background task. Each feature’sproperties object is stored as metadata, and lote_id is derived from the id property of each feature (formatted as POLIGONO_<id>). This is the recommended endpoint for ingesting output from the SAM polygon delineator.
The ingestion date (
fecha) is automatically set to today’s date for each feature. NDVI and GDD values default to 0.0 until the full pipeline enriches the record.Request — multipart form
A GeoJSON file in
application/geo+json or application/json format. The file must be a valid FeatureCollection with a non-empty features array.Response
"accepted" when at least one feature was found and processing was scheduled.Human-readable confirmation:
"Archivo GeoJSON recibido y en proceso de carga masiva".Count of features found in the uploaded file that were submitted for processing.