Skip to main content

List All Documents

curl -X GET "https://api.example.com/api/documentos" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Retrieves a paginated list of all vehicle documents from the documentos_vehiculos_relaciones view.

Query Parameters

page
integer
default:"1"
Page number for pagination
limit
integer
default:"20"
Number of records per page
placa
string
Filter by vehicle license plate (partial match, case-insensitive)
area_operacion
string
Filter by operating area (partial match, case-insensitive)
sort_by
string
default:"fecha_vencimiento_soat"
Field to sort by (e.g., fecha_vencimiento_soat, fecha_vencimiento_rtm, placa)
sort_order
string
default:"asc"
Sort order: asc or desc

Response

data
array
Array of document records
pagination
object
Pagination metadata

Example Response

{
  "data": [
    {
      "id": 1,
      "placa": "ABC123",
      "area_operacion": "Bogotá Norte",
      "fecha_vencimiento_soat": "2026-06-15",
      "fecha_vencimiento_rtm": "2026-08-20",
      "fecha_vencimiento_poliza": "2026-12-31",
      "pdf_soat": "https://storage.example.com/soat/abc123.pdf",
      "pdf_rtm": "https://storage.example.com/rtm/abc123.pdf",
      "pdf_poliza": "https://storage.example.com/poliza/abc123.pdf"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "totalPages": 8
  }
}

Get Document by ID

curl -X GET "https://api.example.com/api/documentos/1" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Retrieves a single document by its ID.

Path Parameters

id
integer
required
The unique document identifier

Response

Returns a single document object (same structure as list items).

Example Response

{
  "id": 1,
  "placa": "ABC123",
  "area_operacion": "Bogotá Norte",
  "fecha_vencimiento_soat": "2026-06-15",
  "fecha_vencimiento_rtm": "2026-08-20",
  "fecha_vencimiento_poliza": "2026-12-31",
  "pdf_soat": "https://storage.example.com/soat/abc123.pdf",
  "pdf_rtm": "https://storage.example.com/rtm/abc123.pdf",
  "pdf_poliza": "https://storage.example.com/poliza/abc123.pdf"
}

Error Response

{
  "error": "Documento no encontrado"
}

Get Filter Options

curl -X GET "https://api.example.com/api/documentos/filters" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Retrieves unique values for filter fields to populate dropdown filters.

Response

placas
array
Array of unique vehicle license plates
areas_operacion
array
Array of unique operating areas

Example Response

{
  "placas": ["ABC123", "DEF456", "GHI789"],
  "areas_operacion": ["Bogotá Norte", "Bogotá Sur", "Medellín"]
}

Delete Document

curl -X DELETE "https://api.example.com/api/documentos/1" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
Deletes a document by ID from the documentos_vehiculos table.

Path Parameters

id
integer
required
The unique document identifier to delete

Response

Returns HTTP 204 No Content on success.

Error Response

{
  "error": "Error message"
}

Build docs developers (and LLMs) love