This endpoint dynamically builds anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/factus_challenge/llms.txt
Use this file to discover all available pages before exploring further.
INSERT statement from the JSON body and executes it against the specified PostgreSQL table. Column names are derived from the object’s keys (get_keys_dict) and values are serialised into the SQL value list (generate_str_of_dict). The newly inserted row is returned via RETURNING *, so the caller immediately receives the full database record — including any auto-generated id, timestamps, or default values.
Endpoint
Path Parameters
Name of the PostgreSQL table to insert into. Examples:
customer, products.Request Body
Send a JSON object where each key is a column name and each value is the data to insert into that column. The controller uses two helpers to build the SQL:get_keys_dict(data)— extracts the keys in insertion order to form the column list.generate_str_of_dict(data, false)— serialises the values: string values are automatically wrapped in single quotes; numeric values are left bare.
Full name of the customer (example field).
Street address (example field).
Contact email address (example field).
Phone number (example field).
Foreign key to
customer_tribute (example field — sent as a number, not quoted in SQL).Foreign key to
municipality (example field).Document / identification number (example field).
Foreign key to
identification_document (example field).Foreign key to
legal_organization (example field).The body fields above correspond to the
customer table used in the reference implementation. When inserting into a different table, simply change the keys to match that table’s column names. There is no server-side schema validation — the PostgreSQL driver will reject mismatched columns with a 500 error.Responses
200 — OK
Returned whenrowCount > 0 (the row was inserted successfully).
Always
200 on success."Datos agregados"The full inserted row as returned by
RETURNING *. Contains all column values, including database-generated ones such as id or created_at.404 — Not Found
Returned whenrowCount === 0 (the insert ran but affected no rows — unusual for a standard INSERT).
500 — Internal Server Error
Returned on any exception thrown by thepg driver (e.g., a NOT NULL violation, a foreign-key constraint failure, or a connection error).
Raw error from the
pg driver. Inspect error.code and error.detail for PostgreSQL error specifics.Examples
Example Response
String quoting is automatic. The
generate_str_of_dict helper inspects each value’s JavaScript type before building the SQL string. Values whose typeof is "string" are wrapped in single quotes (e.g., 'Santiago Rivera'); values whose typeof is "number" are inserted as bare literals (e.g., 21). Always send numeric foreign keys as JSON numbers — not as quoted strings — to avoid type mismatches in PostgreSQL.